Bootloader Handling In Embedded Studio

From SEGGER Wiki
Jump to: navigation, search

Simple embedded systems are built with a single firmware binary only, which executes immediately on device reset. More complex systems might run on a controller which needs to execute a ROM bootloader before jumping to the firmware, or incorporate a software bootloader, which executes first before eventually jumping to the firmware. A combination of first-level ROM bootloader and second-level software bootloader is possible, too.

Debugging a simple system with Embedded Studio is easy. Per default Embedded Studio resets the device, programs the firmware image, and starts execution from the entry point of the application. To debug a system with a bootloader, the project needs to be configured accordingly.

Software Bootloader

With a software bootloader there are 3 possible scenarios:

  1. The bootloader is already programmed to the system and not to be replaced.
  2. The bootloader should be programmed on debug start and is available as a pre-built binary.
  3. The bootloader should be programmed on debug start and is built by a second project in the solution.

Already programmed Bootloader

When the bootloader is already programmed to the system, it behaves like a ROM bootloader to Embedded Studio.

  • Set project option Debug -> Debugger -> Start From Entry Point Symbol to No to run through the bootloader on debug start.
  • Optionally, if debug symbols for the bootloader are available, select them in Debug -> Debugger -> Debug Symbols File.

Program pre-built Bootloader

When the bootloader is available as a pre-built binary, it can be programmed on debug start along with the firmware.

  • Select the bootloader file in the project options Debug -> Loader -> Additional Load File.
  • If the file is a simple binary (.bin) file, set its start address in Debug -> Loader -> Additional Load File Address.
  • Set project option Debug -> Debugger -> Start From Entry Point Symbol to No to run through the bootloader on debug start.
  • Optionally, if the bootloader file is an executable (.elf) file, select it in Debug -> Debugger -> Debug Symbols File.

Program additional Project as Bootloader

When the bootloader is developed as a second project in the same solution, it can be programmed on debug start along with the firmware project and debugged in source.

  • Select the bootloader project in the firmware's project option Debug -> Debugger -> Load Additional Project.

ROM Bootloader

With a ROM bootloader simply set Debug -> Debugger -> Start From Entry Point Symbol option to No.

Note: Some devices require a reset after download. In that case set Debug -> Target Script -> Load End Script to TargetInterface.resetAndStop();. This way the target is explicitly reset another time after the download has finished. That is needed e.g. if your ROM bootloader does some signature check of your just downloaded application which would fail if no additional reset is issued.