Building bootloadable firmware - shraken/gboot GitHub Wiki

Example projects targeting various EFM8 families with gboot bootloader support for Keil, sdcc, and Simplicity Studio is provided here.

  1. Keil
  2. sdcc
  3. Simplicity Studio

Keil

  1. In the project viewer, right click the project target and select Options for Target.

  2. Click the C51 tab and set the Interrupt vectors at address option to 0x0400.

Keil C51 tab options

  1. Click the BL51 Locate tab and set the Code segment to 0x0400.

Keil BL51 Locate tab options

  1. Open the startup .A51 assembly file and modify the CSEG AT 0h to CSEG AT 0400h

Keil A51 startup modification

  1. Convert the Intel Hex firmware image to a binary file and remove the 0x400 code offset. srec_cat -Disable_Sequence_Warnings <input.hex> -Intel -offset -0x0400 -Output <output.bin> -Binary

sdcc

  1. Add the --code-loc 0x0400 directive to the sdcc final compile and link command.

sdcc --code-loc 0x0400 -Iinc/ --model-large src/main.c -o build/main.ihx 2. Convert the ihx to an Intel Hex firmware image packihx build/main.ihx > build/main.hex

  1. Convert the Intel Hex firmware image to a binary file and remove the 0x400 code offset. srec_cat -Disable_Sequence_Warnings <input.hex> -Intel -offset -0x0400 -Output <output.bin> -Binary

Simplicity Studio

  1. In the project explorer, right click the project name and select properties.

  2. Under the C/C++ Build tree item, select Settings.

  3. Ensure that the current tab is Tool Settings and select General Settings. Make sure the Use Extended Linker (LX51) instead of BL51 is not checked.

Simplicity Studio disable LX51 configuration

  1. Click the General tree view entry under the Keil 8051 Compiler entry. Set the Interrupt vectors at address to 0x0400

!Simplicity Studio Interrupt Offset address

  1. Click the Miscellaneous tree view entry under the Keil 8051 Linker entry. Set the Additional Flags to CODE (0x0400)

Simplicity Studio Code segment location

  1. Open the startup .A51 assembly file and modify the CSEG AT 0h to CSEG AT 0400h

Simplicity Studio A51 startup modification

  1. Convert the Intel Hex firmware image to a binary file and remove the 0x400 code offset. srec_cat -Disable_Sequence_Warnings <input.hex> -Intel -offset -0x0400 -Output <output.bin> -Binary
⚠️ **GitHub.com Fallback** ⚠️