Skip to content

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Sign in
F
fwatch
  • Project
    • Project
    • Details
    • Activity
    • Cycle Analytics
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Charts
  • Issues 8
    • Issues 8
    • List
    • Board
    • Labels
    • Milestones
  • Merge Requests 0
    • Merge Requests 0
  • Wiki
    • Wiki
  • image/svg+xml
    Discourse
    • Discourse
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Commits
  • Issue Boards
  • Projects
  • fwatch
  • Wiki
  • Bootloader

Bootloader

Last edited by Federico Vaga Aug 27, 2014
Page history

Bootloader

Overview

The EFM32GG330F1024 comes with a preprogrammed bootloader from Silicon Labs. Depending on the version of the MCU we have: UART bootloader (AN0003) and UART+USB bootloader (AN0042).

The code of both versions of the bootloader is available within the respective Application Note that you can easily find with simplicity studio. There is not a particular license for this code, the only restrictions are:

  • The origin of this software must not be misrepresented; you must not claim that you wrote the original software.
  • Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
  • This notice may not be removed or altered from any source distribution.

It is also possible to boot from an USB storage device (AN0060). Write your application, put it on an USB drive, connect the driver to the board and then reset the board. The bootloader will load the application from the USB drive.

Other bootloaders

For what I see, the vendor's bootloader is most used for this MCU. Obviously, we can spend days on other bootloaders without practical worth.

Bootloader Modes

The bootloader has two main modes: interactive and direct.

  • interactive mode the user can use the serial interface to perform some simple command (read the application note for the commands description).
  • direct mode, the bootloader just look for the application at offset 0x8000 and run it immediately.

Hardware constraints

The bootloader uses the GPIO E10 (TX) and E11 (RX) for the serial communication.
The bootloader uses the GPIO A0 and GPIO C7 to enter the interactive mode.

Bootloader Source Code

The freewatch bootloader is a modified version of AN0042. You can find the source code at sw/bootloader-an0042 (bootloader-an0042). In order to have a completely free environment we use Make+GCC

By using Simplicity Studio you can download the Application Notes AN0042 with the original source code. Everything is thought to be compiled on a windows system with the IAR workbench; Silicon Labs says that the reason is that IAR compiler guarantees the smallest binary.

Main Modifications

  • use GCC to compile (it replaces IAR)
  • use a dedicated linker script (it replaces IAR)
  • blink before boot to advise the user to press the buttons if he wants to enter the interactive mode
  • use GPIO A0 and GPIO C7 to enter interactive mode (it replaces the usage of SWD_CLK)
  • disable destructive upload to avoid mistakes
  • remove the loader-loader step (useless without destructive mode)
  • bootloader memory size is 0x8000 (it was 0x4000)

How to Compile

We support only the compilation through Make+GCC. To compile the bootloader:

cd sw/bootloader-an0042/make-dir
# make LINUXCS=/path/to/cross/compiler/directory
make LINUXCS=/opt/gcc-arm-none-eabi-4_8-2014q1

Of course, is not mandatory to specify LINUXCS if you placed the toolchain at /opt/gcc-arm-none-eabi-4_8-2014q1. But, it is necessary if you placed the toolchain elsewhere.

The final bootloader binary will be in the exe/usb_uart_bootloader-rom.bin.

How to Flash

In the bootloader's Makefile there is a dedicated rule to flash the binary bootloader using OpenOCD

cd sw/bootloader-an0042/make-dir
# make LINUXCS=/path/to/cross/compiler/directory
make LINUXCS=/opt/gcc-arm-none-eabi-4_8-2014q1 flashmain

Here the OpenOCD command line

cd sw/bootloader-an0042/make-dir
openocd -s ../../openocd -f interface/stlink-v2-1.cfg -f init.cfg -c "program exe/usb_uart_bootloader-rom.bin 0 verify reset"

How to compile an Application to Use with the Bootloader

For applications to work with the bootloader they must be created with a starting address of 0x8000. To modify the starting address of your application you must change the linker script. For this purpose we provide a linker script at sw/common/Device/EnergyMicro/EFM32GG/Source/GCC/efm32gg_bootld.ld (efm32gg_bootld.ld). If you are going to change the bootloader size you have also to update this (or your equivalent) linker script in order to place you application after the bootloader in the FLASH. The position in RAM doesn't need to be changed because it's fine that after boot the application overwrite the bootloader in RAM. Remember also that the size of your application cannot exceed the FLASH size (MAX_APP_SIZE = MAX_FLASH_SIZE - START_POSITION , e.g. 0xF8000 = 0x100000 - 0x8000).

How to Upload an Application Using the Bootloader

To upload your application to the EFM32 you have to:

  • connect the serial interface (USB) to the board
  • reset the MCU
  • enter interactive mode by pushing Top Buttons (both left and right)
  • send command 'u' to enter application upload mode
  • transfer your application with XMODEM-CRC protocol
  • send command 'b'to boot the application, or reset the MCU

Using stty and sx

You can use the sx command to upload you application. Configure the serial port to be used:

stty -F /dev/ttyUSB0

and transfer your file:

sx -vv application.bin

> NOTE: The sx method has not been tested and might not work as a character has to be sent to put the bootloader in upload mode!

Using Minicom

Alternatively, you can use the minicom interface (which internally use sx):

minicom -D /dev/ttyUSB0
[on minicom] u
[on minicom] ctrl-a s
[on minicom] select xmodem
[on minicom] choose your file

What to Do On Operating System Boot

> TODO (sorry) : I wrote some notes but I have to re-think about them and look deeper

Clone repository
  • App tutorial
  • Design review v1
  • Documents
  • Home
  • Outdated not used anymore
  • Software todo
  • Bootloader
  • Buttons
  • Case
  • Documents
    • Marketing
    • Movies
    • Pictures
    • Presentations
    • Project attachments
    • Version 'pcb v1' attachments
More Pages

New Wiki Page

Tip: You can specify the full path for the new file. We will automatically create any missing directories.