RPI U-boot run sd card application
From arrizza.org wiki
Jump to navigation Jump to searchRaspberryPi ⇫ Up | RPI U-boot run TFTP application ⇨ Next Topic | |
---|---|---|
Previous Page ⇦ RPI U-boot Custom command |
Prepare application
There is an example application "hello_world.c" that is provided in u-boot.
- update the Makefile, with your standalone application. In this case hello_world is already built:
ELF-y := hello_world
- re-compile
./doit
- check that the build directory has a .bin version
uboot$ ll build/examples/standalone/hello_world.* -rwxrwxr-x 1 arrizza arrizza 594 Jun 19 21:22 build/examples/standalone/hello_world.bin* -rw-rw-r-- 1 arrizza arrizza 5616 Jun 19 21:22 build/examples/standalone/hello_world.o -rwxrwxr-x 1 arrizza arrizza 1904 Jun 19 21:22 build/examples/standalone/hello_world.srec* -rw-rw-r-- 1 arrizza arrizza 41 Jun 19 21:22 build/examples/standalone/hello_world.su
- copy the hello_world.bin to the SD card
determine the load address
- read u-boot-pi-rpi/doc/README.standalone It says ARM based boards default load and start address is 0x0C100000
- if there is any doubt load the s-rec version first, see RPI U-boot run s-rec application to see how to do it:
U-Boot> loads ## Ready for S-Record download ...
## First Load Addr = 0x0C100000 ## Last Load Addr = 0x0C10024E ## Total Size = 0x0000024F = 591 Bytes ## Start Addr = 0x0C100000 U-Boot>
- Note that the Start address is 0x0C100000
load the bin
- start the RPI
- check the .bin is in the sd card
mmc rescan fatls mmc 0
- load it
U-Boot> load mmc 0 0x0c100000 hello_world.bin reading hello_world.bin 594 bytes read in 11916 ms (0 Bytes/s)
run it
U-Boot> go 0x0c100000 ## Starting application at 0x0C100000 ... Example expects ABI version 6 Actual U-Boot ABI version 6 Hello World argc = 1 argv[0] = "0x0c100000" argv[1] = "<NULL>" Hit any key to exit ... ## Application terminated, rc = 0x0 U-Boot>
- TODO: change the start address