3.3 Configure the First Stage Bootloader to Boot from the Serial Flash Memory

The first-stage bootloader must be configured to boot from serial Flash memory. This can be done using SAM-BA commands. To information about the boot process and first-stage boot configuration, refer to the section "Boot Strategies" of the respective data sheet.

Note: This is not a mandatory step for SAM9X60-EK.
Note: A Windows command line must be open to run the SAM-BA commands.

The user accesses a list of all applets available by entering the command:

sam-ba -p <port> -b <board> -a help

Options:
  1. -p, --port <port[:options:...]> where port can be j-link or serial
  2. -b, --board <board[:options:...]> where board can be sam9x60-ek or sama7g54-ek

The boot configuration packet (BCP) can be written either to Emulation SRAM or to OTPC (One Time Programmable Memory Controller).

The user can program BCP to Emulation SRAM during the development phase and to OTPC during production phase.

The SAM-BA commands listed below can be used to program BCP to Emulation SRAM:

  1. Enable emulation:

    sam-ba -p <port> -b <board> -a bootconfig -c writecfg:bscr:EMULATION_ENABLED

  2. Read bscr and verify emulation is enabled:

    sam-ba -p <port> -b <board> -a bootconfig -c readcfg:bscr

  3. Emulation SRAM reset:

    sam-ba -p <port> -b <board> -a bootconfig -c resetemul

  4. Refresh Emulation SRAM:

    sam-ba -p <port> -b <board> -a bootconfig -c refreshcfg:emul

  5. Enable QSPI0 as external NVM:

    sam-ba -p <port> -b <board> -a bootconfig -c writecfg:bcp-emul:QSPI0_IOSET1

  6. Read bcp_emul and verify whether QSPI is set as external NVM:

    sam-ba -p <port> -b <board> -a bootconfig -c readcfg:bcp-emul

  7. Reset the board by pressing and then releasing the reset button.

An example using SAMA7G54-EK is shown below:

Note: Boot configuration using Emulation SRAM must to be set up every power cycle.
Warning: Once OTPC is programmed, Emulation mode is disabled.

The steps below can be used to program BCP to OTPC:

  1. Disable emulation:

    sam-ba -p <port> -b <board> -a bootconfig -c writecfg:bscr:EMULATION_DISABLED

  2. Read bscr and verify emulation is disabled:

    sam-ba -p <port> -b <board> -a bootconfig -c readcfg:bscr

  3. Refresh OTP:

    sam-ba -p <port>-b <board> -a bootconfig -c refreshcfg:otp

  4. Enable QSPI0 as external NVM:

    sam-ba -p <port> -b <board> -a bootconfig -c writecfg:bcp-otp:QSPI0_IOSET1

  5. Read bcp_otp and verify whether QSPI is set as external NVM:

    sam-ba -p <port> -b <board> -a bootconfig -c readcfg:bcp-otp

  6. Reset the board by pressing and then releasing the reset button.