world leader in high performance signal processing
Trace: » compiling

Compiling U-Boot

The latest release of Das U-Boot for the Blackfin processor can be found on the Blackfin Linux website in the U-boot project Files. There you can find tested precompiled images as well as the source archive.

Unpack

Once you've download the source code for the latest version, you can unpack the source archive by doing (replace u-boot-2013.07-2013R1.tar.bz2 with whatever filename you downloaded if it is not the same):

$ tar jxf u-boot-2013.07-2013R1.tar.bz2

Now simply change directory to the U-Boot directory that was just created (replace u-boot-2013.07-2013R1 as applicable):

$ cd u-boot-2013.07-2013R1

Configure/Build

Then run the following commands:

The Blackfin toolchain must be installed before U-Boot can be compiled. For more information, see Installing the Blackfin Toolchain.

$ make <board>

Replace <board> with the specific board you are using. See the boards list for board configs that may be available depending on the release.

The BFIN_BOOT_MODE define in the board configuration file controls the board boot mode (parallel flash / serial flash / uart / etc…). See the customizing document for more information.

Binaries

Once U-Boot has compiled successfully the following files will be created in the U-Boot directory:

File Description
u-boot Compiled ELF image
u-boot.bin u-boot converted to a raw binary
u-boot.srec u-boot.bin converted to Motorola S-records format
u-boot.ldr u-boot converted to Blackfin Loader format

These files are also available if you tell the build system to make them (simply run make <filename>).

File Description
u-boot.hex u-boot.bin converted to Intel Hex format
u-boot.ldr.hex u-boot.ldr converted to Intel Hex format
u-boot.ldr.srec u-boot.ldr converted to Motorola S-records format

Which file format you need depends on how you're booting the processor and what tool you're using to do the programming. The u-boot ELF file is never used to boot, only for reference/debugging with the standard toolchain.

If you're booting the processor in “Bypass” mode, then you will need the u-boot.bin file (or one of its derivatives). For every other boot mode, you need the u-boot.ldr file (or one of its derivatives). The u-boot.bin file is also used regardless of boot mode for a quick runtime test (executing via the go command).

If you're using U-Boot to do the programming, then you want the u-boot.bin or u-boot.ldr file. You do not want the hex or srec formats.

If you're using VDSP to do the programming, then you probably want the u-boot.hex or u-boot.ldr.hex file. VDSP can program the raw binary file as well, but many people feel more comfortable with the hex file. Other JTAG programming tools may also require the hex format.

If you want the srec format, you probably don't know what you're doing. Please rethink what you're attempting, read some documentation, or ask for help. If you're 100% sure you need the srec files, they are provided in the rare off-chance.

Generating By Hand

If you just have a U-Boot binary file and need to convert it by hand for whatever reason, he's the appropriate voodoo incantations. Remember that the U-Boot build system has targets for you to use already (e.g. make u-boot.ldr.hex).

// Convert ELF to Binary
$ bfin-uclinux-objcopy --gap-fill=0xff -O binary u-boot u-boot.bin

// Convert ELF to Hex
$ bfin-uclinux-objcopy --gap-fill=0xff -O ihex u-boot u-boot.hex

// Convert Binary to Hex
$ bfin-uclinux-objcopy --gap-fill=0xff -I binary -O ihex u-boot.bin u-boot.hex

// Convert LDR to Hex
$ bfin-uclinux-objcopy --gap-fill=0xff -I binary -O ihex u-boot.ldr u-boot.ldr.hex

Testing

Rather than blindly flashing the newly built U-Boot and resetting the board only to find out something is wrong and you're left with a bricked board, you can dynamically test the new U-Boot first.

Simply load the u-boot.bin file (always use this file and no other) into external memory and use the go command. U-Boot will automagically relocate itself from the load address to its normal runtime address and allow you to test it. This way your changes are only tested in memory while the known good U-Boot is still written in flash.

Keep in mind that if you do want to flash the new version, you will have to reload the file into external memory (and load the correct file for your boot mode).

For help on how to transfer the u-boot.bin file as well as actual examples (with board output), see the loading files page.

Flashing

Actually upgrading U-Boot is covered in the upgrading document.