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

Part Number: TMS570LS1114
Other Parts Discussed in Thread: HALCOGEN

Tool/software: TI C/C++ Compiler

I am trying to create a custom bootloader for Hercules microcontroller using CCS 9.3.0.00012 and TI v18.12.4.LTS.

My bootloader works nicely but only on the current compiled version (ie it can only be used to update the current version of the code over itself).

As I make changes to my main code space area the bootloader code and libraries code spaces (halcogen generated code) change. Changes in code relate to accessing memory locations in the boot code and libraries space areas.

It would appear that the bootloader and libraries flash areas change with each compile. I have verified this by comparing the two binary images of two different compiles/files and making some minor changes to my main code space.

Furthermore, the interrupt vectors in the first page (0x00000000) are changing as well between code revisions.

So when I try and perform an update via the bootloader I crash my program.

I have experimented with the ARM Linker \ Advanced Options \ Linker Output for

-          Produce absolute executable object file

-          Produce a relocatable output module

If I select both options at the same time I get a message “#10017 combining options --absolute (-a) and --relocatable (-r) is not supported when producing ELF output files

When I select “Produce a relocatable output module” I get multiple errors “linker will only generate a CRC Table when creating an executable file”, “program will not fit into available memory”, “Placement with alignment fails for section”.

I don’t know how I can create a bootloader that does not change when I make changes to my main code space area and recompile, ie the code in the bootloader and libraries needs to be independent from the main code space area.

Could you please comment on how to fix this behavior?

Rob

  • Update: i have corrected the vectors and bootloader flash sections.  Had commented out some code during debug section in .cmd and my notifications,c was referencing outside the bootloader areas.

    I now just have to resolve the HalCoGen Libraries that is placed into a fixed Flash location that should never be updated. 

    I have traced down the changing code (i think) to the use of the memset library routing which is a standard C Library Function. 

    I can see that the memset function is called in the HalCoGen libraries. (Turned on compiler option to generate .aux and .lst files). 

    Some of the HalCoGen  (.aux) files are referencing the memset function which is outside the bootloader code space and subject to being moved around with new code/compile.

    My question now is, how do I fix the standard String library into a segment of flash code space (my bootcode space)  so it doesn’t shift around when i do a compile?

  • Hello,

    how do I fix the standard String library into a segment of flash code space (my bootcode space)

    You can use the same way used in example linker cmd to allocate the lib to specified location.

    MEMORY
    {
    VECTORS (X) : origin=0x00000000 length=0x00000020
    FLASH_API (RX) : origin=0x00000020 length=0x000014E0
    FLASH0 (RX) : origin=0x00001500 length=0x002FEB00
    SRAM (RW) : origin=0x08002000 length=0x0002D000
    STACK (RW) : origin=0x08000000 length=0x00002000
    }
    SECTIONS
    {
    .intvecs : {} > VECTORS
    flashAPI :
    {
    Fapi_UserDefinedFunctions.obj (.text)
    bl_flash.obj (.text)
    --library = ..\..\..\lib\F021_API_CortexR4_BE.lib (.text)
    } load = FLASH_API, run = SRAM, LOAD_START(api_load), RUN_START(api_run), SIZE(api_size)