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.

F021 Flash API position-independent code

Other Parts Discussed in Thread: RM46L852, SEGGER

Hello!

Is there build of F021 Flash API library suitable to build position-independent application?

F035 Flash API is. In F035 Flash API libraries, there is no .data section. In F021 Flash API there is .data section for two object files (FlashStateMachine.ScaleFclk.obj and FlashStateMachine.SetActiveBank.obj).

For Keil MDK-ARM, there is file: Keil/ARM/Flash/RM46LXXX1_25MB.FLM wich is build using position-independent version of F021 Flash API library. Where can I get that position-independent version of library for programming flash for RM46L852? There are differencies in function names between Flash API in RM46LXXX1_25MB.FLM and F021 Flash API. For example, Fapi_initializeAPI() vs Fapi_initializeFlashBanks().

Or Keil company has full access to source code of F021 Flash API or full description to do flash programming and compile that library with positon-independent options?

Thanks!

  • Hi Vitaliy,
    Which F021 API library version do you use?
  • Hello, Charles.
    I use F021 Flash API 02.01.01
  • TI has not made a position independent version of the F021 Flash API. The code is relocatable, but not position independent. I have checked with my colleagues and we have no knowledge of the Flash API source being provided to Keil. We do not generally provide the source as it would encourage modifications and we cannot guarantee proper programming and erasing of the devices if the code is modified. The function Fapi_initizeBanks() is from an earlier version of the API and is currently supported with the "Compatibility.h" header file.

    Why do you want a position independent flash API? Note that programming and erasing the flash is inherently non-reentrant.
  • Hello, Bob.

    Thanks for explanations.

    I use Segger JLink. Segger inroduce Open Flash Loaders

    Keil has Flash Programming Algorithms

    So, it is very easy at development stage to program any non-volatile memory connected to external bus, or program internal Flash Bank 7, or program internal OTP region. I just push "debug" button and IDE is automatically program external memory. To do this I need some number of .elf files each of which contains programming algorithm for each address space. If IDE is using GDB, or directly JLinkARM.DLL, then IDE may transparently call suitable ".elf open flash loaders file" to do programming of each region found in "user .elf file". It is almost all IDE in market, except CCS and maybe ARM DS-5.

    I may include AJSM key in working source code and place it in suitable address space. At development stage, I may use stubs in one of ".elf open flash loader" to not program OTP (for AJSM). At productions stage I just change ".elf open flash loader file" to .elf file which does real programming of OTP.

    Segger JLinkARM.DLL open flash loader concept does not require positon-independent code at this time, but Keil need for programming algorithmes to be a position-independent .elf file. So, for now it is possilble to build four "open flash loaders" for: bank0, bank7, customer-OTP, external flash. And at stage of development working code there is no any other work to program any of that memories.

    Keil/ARM/Flash/RM46LXXX1_25MB.FLM is a posititon-independent .elf file which use a register R9 as a pointer to .data and use only ARM mode. So, Keil must have full source code to compile in ARM mode (F021 Flash API from TI is compiled in THUMB mode).

    My question was a study for situation "if Segger JLinkARM.DLL switch to position-independent open flash loaders instead of a position-dependent mode".