close
OpenRTLS
OpenRTLS
Search

Software:AntBoot

Contents

AntBoot Bootloader

It is a small and versatile bootloader with environment.

The bootloader manages an environment with variables and can start a firmware from Flash memory.

Normally the bootloader is invisible, output is disabled by default.

  • The minimal memory requirement of AntBoot for SAM3S is around ~1.2 KiB of flash and 3KiB of RAM
  • The minimal memory requirement of AntBoot for SAM3S with environment support is around ~4.2 KiB of flash, 4KiB of flash for environment and 4KiB of RAM
  • The Shell offers commands for manipulation with the memory and environment
  • The commands to modify environment are compatible with the commands in U-Boot, as well as the format of the variables
  • There are by default 4 copies of the environment. Each time when the environment is saved, it will be written to the next allocated address
    • That enables fallback to previous working environment and wear leveling of memory, making the system more robust
  • Environment commands are available also via the eCos application, e.g. 120-ecos-current/contrib/app/shell-test
  • AntBoot can boot theoretically any amount of firmware stored in the flash. The address of firmwares are controlled via variables

By default there are two booting options in the environment that correspond to two default firmware linkages in eCos (fw1 and fw2)

  • OC8-R: fw1 is linked at 0x8000, fw2 at 0x34000
  • TagKiwi: fw1 is linked at 0x4000, fw2 at 0x10000
  • The Bootloader occupies 0 to 0x3000
  • The environment is stored from 0x3000 till 0x4000 (4 copies of 0x400 each)
  • OC8-R: 0x4000…0x8000 is the private section used for certificates

Repository

Get the AntBoot sources from the OpenRTLS git repository:

$ git clone git@git.openrtls.com:119-antboot.git

To access the repository a key is needed. Send your public key to us to get access.

To update the git repository:

$ cd 119-antboot
$ git pull

Building

Use the make tool to build the AntBoot binary for the Tag:

$ cd 119-antboot/build/tagkiwi
$ make

Load the binary into the Tag flash memory:

$ make load

Example output in the console:

AntBoot 2014.01 (Jul  4 2014 13:16:48)
Autoboot in 1 seconds
AntBoot>

- or -

Starting image at address 0x00004000
...

Configuring

Enable output by having these defines in the Makefile:

DEFINES += CONSOLE_ENABLED=1
CONFIG_RPRINTF=y

Enable the Shell by having these defines in the Makefile:

DEFINES += CONFIG_SHELL=1
CONFIG_SHELL = y

Each command/function can be enabled separately in the Makefile:

CONFIG_<NAME>=1

Environment

AntBoot maintains a list of variables, stored in flash memory. A number of variables control the further boot process.

fwN_version - e.g. fw1_version=0x00000001 - antboot will try to boot the version with highest value first
fwN_attempts - e.g. fw1_attempts=0x00000001 - will be incremented before booting if smaller than fwN_max_attempts
fwN_max_attempts - e.g. fw1_max_attempts=0x00000001 - indicates maximal amount of attempts to boot firmware N

If fwN_attempts is greater than fwN_max_attempts, the firmware version for N will be cleared and will not be used for the next boot attempt.

fwN_max_attempts=0xffffffff means this firmware has been confirmed/working and no attempt counter will be incremented or checked next time.

To boot the 2nd firmware, set fw1_version to a higher value then fw0_version:

AntBoot> printenv
...
fw0_addr=0x00004000
fw0_attempts=0
fw0_max_attempts=0xffffffff
fw0_version=1
fw1_addr=0x00010000
fw1_attempts=0
fw1_max_attempts=0xffffffff
fw1_version=8