Navigation
External Links
Donate
Show your appreciation for OpenBLT
and support future development by
donating.
External Links
Donate
Show your appreciation for OpenBLT
and support future development by
donating.
When using the OpenBLT bootloader, both the bootloader and the user program (your firmware) resides in the same flash memory. Furthermore, the bootloader needs to always run first after each microcontroller reset event. As such, the first part of flash memory is reserved for the bootloader. This is the part where the CPU expects the vector table with the reset handler. Consequently, the base address of where the user program is located in flash, needs to be moved forward to make room for the bootloader.
To determine and control how much space the bootloader reserves for itself, take a closer look at the flash driver. Specifically the flashLayout[] array. You'll notice that the first few entries in this table are commented out. The commented out entries defined the space reserved for the bootloader. Refer to the following example:
This flashLayout[] array reserves the first 32kb (0x8000) bytes of flash for the bootloader. In this case, you need to move the base address of your user program forward by 32kb. With other words, you need to edit your firmware's linker script to change the base address of non-cached flash from 0xA0000000 to 0xA0008000 and of cached flash from 0x80000000 to 0x80008000
Refer to the demo user program for an example on how you can achieve this. There a macro named OPENBLT_RESERVED_SIZE was added to the linker script. With the help of this macro, everything that is normally located at the start of program flash 0 is moved forward by 32kb. Brief overview of the affected linker script sections:
A 32-bit signature checksum value is programmed by the bootloader at the end of a programming session. After each power-on or reset event, the bootloader verifies the correctness of this checksum to determine if a user program is present and can be started.
On the TriCore AURIX TC2, the signature checksum is calculated over the first 28 bytes (0x1C) of the user program. The bootloader stores the 32-bit checksum value from 0x3C-0x3F after the base address of the user program in flash.
For this to work, you need to add a 32-bit dummy constant value to your application and then make sure the linker places this constant value at 0x3C-0x3F after the base address of the user program in flash. Example for the Tasking compiler:
1) Add a constant 32-bit dummy value for the signature checksum to one of your source files, together with a compiler specific #pragma to define a new section. This section name can later on be used in the linker script to make sure it is placed at 0x3C-0x3F after the base address of the user program in flash.
2) Add group “cssig” to the linker script to place variable “bltChecksumSignature” 0x3C bytes after the base address of the user program.
OpenBLT's PC tools for performing a firmware update on your microcontroller, assume that the firmware file of your user program is in the Motorola S-record format. All software development IDEs support a feature for generating a firmware file in the Motorola S-record format. You just need to enable this feature.
In the case of the AURIX Development Studio, you can add the following to the linker's command line pattern:
-Wl${OUTPUT_FLAG}"${BuildArtifactFileBaseName}.srec:SREC"