AVR32 Linux Development/Upgrading U-boot
From AVRFreaks Wiki
The STK1000 flash is preprogrammed with u-boot, but in some cases the user wants to upgrade or reprogram the flash with u-boot. A binary version of U-boot is therefore available on the BSP CD (u-boot.bin). This section describes how to reprogram the flash with this image with or without a JTAGmkII emulator.
Contents |
With JTAGmkII emulator
Erase the flash before programming with u-boot:
avr32program erase -f0,8Mb
Program the flash using the avr32program utility:
avr32program program -vf0,8Mb u-boot.bin
Without JTAGmkII emulator
Use the AVR32 Flash Upgrade Utility. The utility is available from the BSP CD at /software/flash-upgrade/
This is a standalone utility to do flash upgrades on AVR32 devices. The utility itself is distributed as a single file which contains the upgrade image as well as any necessary programming code for the particular board the upgrade is meant for. It can be loaded by U-boot via SD/MMC card, TFTP or any other supported boot method, the same way as any Linux kernel image.
The easiest way to upgrade U-boot is probably to replace the file 'uImage' on your SD card with the upgrade image. This way, U-boot will boot the upgrade image by default.
Programming the flash
The utility does not initialize the USART at startup. Rather, it depends on one of them being initialized by u-boot already and tries to detect it. This way, if the user can interact with U-boot, chances are that he will be able to interact with this utility as well.
When the utility starts up, it displays some information about the detected flash chip and some other information. After this, it asks the user to confirm the operation by pressing `y'. This is done to ensure that the user is actually seeing the status information and can interact with the programmer before starting to do anything potentially destructive.
If something goes wrong while doing "destructive" flash operations, there is not much the programmer can do about it except to ask the user if he wants to retry, in case we're dealing with a transient failure. If retrying does not help, the system is left unbootable. In this case, the only way to recover is to re-program u-boot using the JTAGmkII emulator. Please contact avr32@atmel.com if this ever happens.
After a successful upgrade, power cycle the board and make sure U-boot doesn't load the flash upgrade utility again, e.g. by replacing uImage with a real Linux kernel image.
Building custom upgrade images
To create a flash upgrade image, simply copy the flash upgrade binary into this directory and run "make", possibly after tweaking some settings in config.mk like the name of the binary image.
cd "your working directory" cp /bsp-cd/software/flash-upgrade/* . cp /bsp-cd/builds/stk1000/u-boot.bin . make
The resulting flash-upgrade.uimg file can be loaded by u-boot via SD/MMC card, TFTP or any other supported boot method.
This utility can be built using the avr32 (standalone) toolchain as well as the avr32-linux toolchain. It does not matter.