About Us
Museum

Nand-burn-bootloader

From RFID Guardian

First, we describe how to build the necessary variants of u-boot. Alternatively, you may grab those from the Download page, and jump to the section Install the bootloader below. Then you must replace u-boot-uart.ldr with u-boot-uart-rXX.ldr (the downloaded version), and u-boot-nand.ldr with u-boot-nand-rXX.ldr (the downloaded version).

Contents

Create a UART u-boot for boot-burning into NAND flash

For building u-boot, you will need toolchains and a u-boot source checkout. The Download page shows how to get these.


The BlackFin NAND booter has a different spare area layout than standard MTD. Also, MTD doesn't support hot-swapping of spare area layout. So, to burn a boot loader into NAND flash, we must make a boot loader that speaks the NAND booter layout. The default for bf547-radiotuna/sharkbytes depends on the kind of bootloader; the UART bootloader has a boot-capable layout, the NAND bootloader has the standard MTD layout.


Edit U-BOOT/include/configs/bf547-radiotuna.h or .../bf547-sharbytes.h:

Select UART boot mode: (around line 22)

// #define CONFIG_BFIN_BOOT_MODE       BFIN_BOOT_PARA
#define CONFIG_BFIN_BOOT_MODE       BFIN_BOOT_UART
// #define CONFIG_BFIN_BOOT_MODE       BFIN_BOOT_SPI_MASTER
// #define CONFIG_BFIN_BOOT_MODE       BFIN_BOOT_NAND

Build: type

$ make bf547-radiotuna_config
for building u-boot for the RFID Guardian; or
$ make bf547-sharkbytes_config
for building for SharkBytes; then
$ make clean; make
$ cp u-boot.ldr u-boot-uart.ldr

Create a NAND u-boot

For real works, u-boot will need to speak the MTD spare layout lingo.

Edit U-BOOT/include/configs/bf547-radiotuna.h (or bf547-sharkbytes.h):

Select NAND boot mode: (around line 24)

// #define CONFIG_BFIN_BOOT_MODE       BFIN_BOOT_PARA
// #define CONFIG_BFIN_BOOT_MODE       BFIN_BOOT_UART
// #define CONFIG_BFIN_BOOT_MODE       BFIN_BOOT_SPI_MASTER
#define CONFIG_BFIN_BOOT_MODE       BFIN_BOOT_NAND

Build: type

$ make clean; make
$ cp u-boot.ldr u-boot-nand.ldr
$ cp u-boot-nand.ldr /tftpboot/

Install the bootloader

For RFB40revA: Now boot over uart by rotating the switch to 0x7

For RFB40revB: Now set the jumpers to UART boot

Reset a few times. Then type to your host:

$ bfin-uclinux-ldr -l u-boot-uart.ldr /dev/ttyS0 && minicom -w

Or, if you are a Windows user, use LdrViewer to upload u-boot-uart.ldr to the RFID Guardian. If that finished successfully (tens of hex characters appear in LdrViewer's log pane), disconnect LdrViewer and connect with HyperTerm (or your favorite terminal program).

The settings for minicom/HyperTerm are: 57600 baud, 8N1.

In the minicom/HyperTerm window you should see a u-boot prompt bfin> (after hitting <enter>).

You need to run a TFTP server. For Linux, install/enable tftpd or tftpd-hpa. For Windows, use e.g. SolarWinds. Ensure that u-boot has the correct setting for your TFTP host; e.g. let the TFTP server be 192.168.0.37:

bfin> setenv serverip 192.168.0.37

Then copy the NAND u-boot-nand.ldr into the TFTP server directory on your TFTP host. Upload the NAND u-boot by typing in minicom/HyperTerm:

bfin> tftpboot 0x01000000 u-boot-nand.ldr
####### progress markers
bfin>

Now, after this upload has been done, notice the file size printed by the tftpboot command; it is in hex. Up-round it to a multiple of 20000 (hex, too). Let this be <filesize>. It will be 60000 as often as not, so that is what it is in this example:

bfin> nand erase 0 60000
bfin> nand write 0x01000000 0 60000

Rotate the switch to 0xd (RFB40-revA) or set the jumpers to boot from NAND (RFB40-revB) and reboot:

nand/bfin> reset

and lo and behold! u-boot prompt from NAND flash!

You may have to quickly type ^C to stop the autoboot.

Upgrading the bootloader from live u-boot

For upgrading from a live NAND u-boot, an easier procedure is available:

  • configure u-boot for UART booting, build and install u-boot.bin into your tftp service area
  • from u-boot, upload this u-boot.bin
bfin/nand> tftp 0x01000000 u-boot.bin
bfin/nand> go 0x01000000
... rebooting into UART-type bfin ...
bfin>
This gives you a running u-boot with a spare layout fit for booting. Do not reboot!
  • reconfigure u-boot for NAND booting, build and install u-boot.ldr into your tftp service area
  • from the running UART u-boot, continue:
bfin> tftp 0x01000000 u-boot.ldr
bfin> nand erase 0 60000
bfin> nand write 0x01000000 0 60000
bfin> reset

Setup the environment in the NAND flash

Ethernet MAC address:

bfin> setenv ethaddr=00:E0:22:FE:BC:FE

If you want no autoboot:

bfin> setenv bootdelay=-1

If you do want autoboot (this will be default):

bfin> setenv bootdelay=5

Set up the stuff to boot the eCos application:

bfin> .... find this out, preprogram it ...

The next step needs only to be done once for a board! Now the essential step where u-boot currently differs from specx:

bfin> nand scrub 0x60000 0x20000

Answer y to the question whether you are sure.

Now save the environment to a NAND flash sector:

bfin> saveenv