This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Compiler/TMS570LS1114: Bootloader Code changes with recompile

Part Number: TMS570LS1114


Tool/software: TI C/C++ Compiler

I have developed a bootloader for remote software updates (Hercules LS1114).

Everything is working OK except my bootloader code segment is changing when I make changes to my main code segments (I use a crc check). Ie the bootloader code is not independent of my main code.

In the bootloader segment I include 

   flashAPI :

   {

           Flash.obj (.text)

 

           crc16.obj (.text)

 

           Fapi_UserDefinedFunctions.obj (.text)

 

     --library= F021_API_CortexR4_BE.lib

   }

all code/libraries associated with the bootloader so there are no intentional references outside the bootloader code segment.

I’m assuming the included F021 flash library has some global variables defined or references to the C Library which is causing the code in the bootloader to change when I add new code to the main code segments.

The intention is not to update the bootloader during firmware updates and I have some smarts to protect the update process if something goes wrong during the flash update, ie I first download the new firmware into a separate flash area and verify before transferring the new code to my main code space area.

How do I get around this issue ? Any suggestions most welcome.

Rob

  • Hi Rob,

    How is the bootloader segment changed by the main code? The bootloader is pre-programmed to the flash, and the bootloader may use the data stored in Flash or FEE by the main function, but the bootloader doesn't use any variables defined in the main application. 

    CRC16() calculate the CRC of the content of flash sectors (whole sector) which contains the main application code. The returned CRC value is affected by the changes of the main application code, but the obj of crc16() should not be affected.

  • Hi QJ,
    when i comapre two .bin files of different versions of my code i can see that some of the F021_API_CortexR4_BE code is changing in the bootocode segment.  looks like the library it is referencing an external function or ram address ? That is why the CRC of this segment changes when i make changes to my Main Code segment?
  • Hello Bob,

    I guess you use the flash APIs to erase the flash sectors and program your application code to the erased flash sectors, and program the status to the erased flash sectors or to the eeprom (bank 7). 

    Does the CRC16() use TMS570 CRC HW module? Is the CRC16() used to calculate the CRC of flash content? or used to calculate CRC of a block of message from the bootloader host?

    Any difference between the map files?