I did some work on this .. Now the Orange Pi bare metal code is ready .. This is tested for Orange Pi Pc , Other boards should also work .. // Procedure 1. write any orange pi Linux OS to the SD Card , I have used Lubuntu_1404_For_OrangePiPC_v0_8_0_.img This will write the bootloader in proper place . ( this method is pretty simple , otherwise you have to use linux & write the bootloader in the particular partition) 2. Copy the "blink.bin" in the fat partition, same folder where "script.bin" & "uimage" is present (you can use any windows/linux OS ) 3. Connect USB-UART to the orange Pi , open serial putty (use http://www.putty.org/ or any serial application ) 4. Power ON , now you can see boot messages in the putty screen , press any key immediately, this will stop the control goes to linux .. 5. Now you can see "sunxi#" prompt , enter the below command fatload mmc 0 0x41000000 blink.bin; go 0x41000000 6. Now ""hello world " message appears .. compiling , I use gcc-arm-none-eabi-4_7-2013q3-20130916-win32.exe , on windows just "make" code , refer the attachment unsigned int count=0; int notmain ( void ) { uart_print("Hello world \n"); while(1) { if(count) { PUT32(PIO_BASE+PA_DATA_REG, 1<<15); //pa15 red led refer schematics count=0; } else { PUT32(PIO_BASE+PA_DATA_REG, 0); count=1; } uart_send(uart_recv()); // wait till it gets new char - echo } return(0); } many thanks to David Welch , this code is based on his bare metal code .. I would love to add additional functionalities like , GPIO , SPI ,I2C ,Timer ,PWM , Interrupts ,Display .. Once its added we can easily port to other Embedded OS , like , FreeRTOS , Windows CE & QNX One major good thing with this Allwinner H3 board is , it has "ehci" "ohci" USB stack , which is very easy to port . . thats where raspberry pi fuckked up , designware OTG(raspberry uses) has no documentation & hard to implement .. https://drive.google.com/file/d/0B02sL8YIqsjCd21BR0Q3d0ljdW8/view?usp=sharing |
Monday, 29 August 2016
Orange Pi Bare Metal code
Subscribe to:
Posts (Atom)