RPI U-boot run TFTP application
From arrizza.org wiki
Jump to navigation Jump to searchRaspberryPi ⇫ Up | ||
---|---|---|
Previous Page ⇦ RPI U-boot Custom command |
Prerequisites (do once)
A "dual-homed" laptop or PC with:
- an RJ-45 (wired ethernet) jack
- a wireless connection
The strategy is to use a statically allocated ip address on the wired ethernet jack to connect to the RPI. The wireless connection allows access to the internet, Google, local devices on your LAN, etc.
Configure PC (do once)
see http://www.davidsudjiman.info/2006/03/27/installing-and-setting-tftpd-in-ubuntu/
- install tftp on PC
sudo apt-get install xinetd tftpd tftp sudo mkdir /tftpboot sudo chmod -R 777 /tftpboot sudo chown -R nobody /tftpboot sudo gedit /etc/xinetd.d/tftp [ add this entry] service tftp { protocol = udp port = 69 socket_type = dgram wait = yes user = nobody server = /usr/sbin/in.tftpd server_args = /tftpboot disable = no } sudo service xinetd restart
- create a statically allocated IP address on the PC. I'm assuming your home network is 10.0.0.xxx based. Choose a separate subnet for the RPI to PC connection:
Name : RPI Connection Connect Automatically: unchecked IPv4 settings Method : Manual IP address: 10.1.0.2 subnet : 255.255.255.0 gateway : 10.1.0.1 (or blank) IPv6 settings Method : Ignore
- TODO: wireless does not work while RPI connection is up
Configure RPI
- attach an ethernet cable from the RPI to the laptop/PC RJ-45 jack
- attach the serial cable from the RPI to the laptop/PC USB port
- the following steps have to be done every time the RPI is reset
1. start the terminal emulator 2. start the USB subsystem. The ethernet jack on the RPI is on the USB bus
U-Boot> usb start (Re)start USB... USB0: Core Release: 2.80a scanning bus 0 for devices... 3 USB Device(s) found scanning usb for storage devices... 0 Storage Device(s) found scanning usb for ethernet devices... 1 Ethernet Device(s) found U-Boot>
3. select "RPI connection" on your PC's list of ethernet connection 4. set the IP address on the RPI
U-Boot> setenv ipaddr 10.1.0.3 U-Boot> setenv serverip 10.1.0.2
5. test the connection from the RPI (10.1.0.3) to your PC (10.1.0.2)
U-Boot> ping $serverip Waiting for Ethernet connection... done. Using sms0 device host 10.1.0.2 is alive U-Boot>
6. note: there is no ping server on the RPI, so you cannot test the connection from your PC (10.1.0.2) to the RPI (10.1.0.3)
- TODO: create script or command to preload all the above
- TODO: enable CONFIG_CMD_SAVEENV to enable saveenv command to save environment to FLASH; load at boot time
Load file using tftp
1. copy the image to load into the /tftpboot directory
(on the PC) cd ~/projects/uboot cp build/examples/standalone/hello_world.bin /tftpboot/
2. load file using tftp
(on the RPI) U-Boot> tftp 0x0c100000 hello_world.bin Waiting for Ethernet connection... done. Using sms0 device TFTP from server 10.1.0.2; our IP address is 10.1.0.3 Filename 'hello_world.bin'. Load address: 0xc100000 Loading: # done Bytes transferred = 594 (252 hex)
3. run the image
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: enable CONFIG_CMD_TFTPPUT to try tftp puts (from RPI to PC)