This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Specifying lib load and run sections in ARM-based linker script

Hello,

I am currently trying to use the TI F021 Flash API for a project that I am building with Keil's ARM Tools (target is TI's Hercules TMS570LS0432 microcontroller). The API specifies that API code must not be executed from the same flash bank as it is trying to initialize/modify/etc. Thus, I need to have the API's load address in flash but the run address in RAM. This is accomplished in the linker script (sys_link.cmd) when built using the TI Tools (as follows):

MEMORY {
  VECTORS    (X)  : origin=0x00000000 length=0x00000020
  FLASH_API  (RX) : origin=0x00000020 length=0x000014E0
  FLASH0     (RX) : origin=0x00001500 length=0x0005EB00
  STACK      (RW) : origin=0x08000000 length=0x00002000
  RAM        (RW) : origin=0x08002000 length=0x00006000
}

SECTIONS {
  .intvecs : {} > VECTORS
  
  flashAPI : {
    ..\Release\Fapi_UserDefinedFunctions.obj (.text)
    ..\Release\flash.obj (.text)

    --library= F021_API_CortexR4_BE.lib < FlashStateMachine.IssueFsmCommand.obj
                                          FlashStateMachine.SetActiveBank.obj
                                          // ...
                                          // other API funcs that aren't important here
                                          // ...
                                          Read.WsService.obj
                                          Async.WithAddress.obj
                                          Program.obj > (.text)
  } load = FLASH_API, run = RAM, LOAD_START(api_load), RUN_START(api_run), SIZE(api_size)
  

  .text  > FLASH0
  .const > FLASH0
  .cinit > FLASH0
  .pinit > FLASH0
  .data  > RAM
  .bss   > RAM
}

I have highlighted the sections relevant to the Flash API.

From the reading I have done, it appears that the larger block of Flash API-related code is creating a copy table, and the api_load, api_run, and api_size symbols can be referenced later when actually copying the API from flash to RAM.

What I would like to accomplish is have the same (or at least similar) functionality as this linker script, but in a script built using Keil's ARM Tools, as my project requires that I use those.

At the very minimum, I need to linker to know that I have space in flash and space in RAM reserved for this API, and that the API should actually be run from RAM. A plus would be not having to manually specify this, especially every time I automatically generate a new linker script.

Thanks in advance for any help! Let me know if more information or clarification is needed.
-Gawan