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.
- Keil
- sdcc
- Simplicity Studio
-
In the project viewer, right click the project target and select Options for Target.
-
Click the C51 tab and set the Interrupt vectors at address option to
0x0400
.
- Click the BL51 Locate tab and set the Code segment to
0x0400
.
- Open the startup .A51 assembly file and modify the
CSEG AT 0h
toCSEG AT 0400h
- 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
- 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
- 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
-
In the project explorer, right click the project name and select properties.
-
Under the C/C++ Build tree item, select Settings.
-
Ensure that the current tab is
Tool Settings
and select General Settings. Make sure theUse Extended Linker (LX51) instead of BL51
is not checked.
- Click the General tree view entry under the
Keil 8051 Compiler
entry. Set theInterrupt vectors at address
to 0x0400
!
- Click the Miscellaneous tree view entry under the
Keil 8051 Linker
entry. Set theAdditional Flags
toCODE (0x0400)
- Open the startup .A51 assembly file and modify the
CSEG AT 0h
toCSEG AT 0400h
- 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