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.

TMS320F28388D: Flash API GCC Compatibility Issue on TMS320F28388D CM Core (Absolute Address Access)

Part Number: TMS320F28388D
Other Parts Discussed in Thread: C2000WARE

Hello TI,

I am reaching out regarding a GCC compatibility issue observed with the Flash API on the TMS320F28388D (CM core).

When executing the Flash API from RAM with GCC, several functions (such as CM_FLASHREGS_LOCK and CM_FLASHREGS_UNLOCK) access absolute addresses instead of using the base address provided via Fapi_initializeAPI().
For example, the CM_FLASHREGS_LOCK function dereferences address 0x00001FD8, which is not within the CM’s RAM or Flash register region:

movw    r1,#0x1FD8
movt    r1,#0x0
ldr     r1,[r1]
ldr.w   r1,[r1,#0x2FC]
mov.w   r0,#0x5A5A5A5A
str.w   r0,[r2,#0x2FC]
bx      r14

This absolute addressing prevents the Flash API from being relocated to RAM and leads to bus faults during execution.
The issue appears to originate from internal symbols or linker-defined constants assumed by TI’s build environment.

Summary:

Device: TMS320F28388D

Core: CM

Compiler: GCC

Library: C2000Ware → libraries/flash_api/f2838x/cm/include/FlashAPI

Problem: Flash API uses fixed addresses (e.g. 0x1FD8) → breaks RAM execution under GCC

Goal: Enable Flash API execution from RAM using GCC toolchain

Could you please confirm:

Whether a GCC-compatible or relocatable version of the Flash API exists or is planned, and

If not, whether there is a recommended workaround or patch (e.g. redefining the address symbols or modifying the linker command file)?

This limitation currently blocks our flash programming support in Lauterbach tools, so any guidance or update would be greatly appreciated.

Best regards,
Dhia

  • Hi Dhia,

     I checked the code I see only register is getting updated in that code patch.However, I am checking with our Flash API expert, will come back this in a day. 

    Regards,

    Rajeshwary

  • Hi Rajeshwary,

    Thank you for the update and for checking with the Flash API expert. I’ll wait for your feedback.

    Best regards,
    Dhia

  • Hi Rajeshwary,

    Any update about this topic?

    Best regards,
    Dhia

  • Hi Dhia,

    I am still waiting for his feedback. I will follow-up with him.

    Regards,

    Rajeshwary

  • Hi Rajeshwary,

    I just wanted to check in again regarding the GCC Flash API compatibility issue.

    We currently have a customer actively working on this topic, and the lack of a relocatable Flash API is blocking their integration on our side. Any update or estimated timeline from the Flash API expert would really help us plan the next steps.

    Best regards,
    Dhia

  • Dhia,

    Apologies for the delay on this. I will look into this and get back to you by Monday.

    Thanks,

    Sira

  • Dhia,

    Just to understand which portion of the problem to focus on, can you confirm whether the CM Flash API library provides by us works with your GCC compiler toolchain when running from Flash?

    In other words, I want to know whether the issue is just the execution from RAM part, or if the GCC toolchain part is also playing a role here. (as you know, the Flash API library was compiled with the TI ARM compiler).

    Thanks,

    Sira

  • Hello Sira,

    Yes, I can confirm that the CM Flash API library runs correctly with our GCC toolchain when executed from Flash.
    The issue appears only when relocating the Flash API to RAM.

    In RAM execution, several functions (e.g., CM_FLASHREGS_LOCK, CM_FLASHREGS_UNLOCK) rely on absolute addresses embedded in the TI-built library, which leads to invalid memory accesses when run from RAM under GCC.

    So, in summary, the problem is specifically the RAM-relocation case, due to absolute addressing inside the Flash API.

    Please let me know if you need disassembly excerpts or additional test results.

    Best Regards,
    Dhia

  • Hi Dhia,

    Thanks for confirming that there's no issue with GCC + lib running from Flash.

    When I look at the definitions of these functions in the source code, I see:

    static inline void CM_FLASHREGS_LOCK(void)
    {
         Fapi_GlobalInit.m_poFlashControlRegisters->FrdIntfCtrlLock.FRD_INTF_CTRL_LOCK_BITS.LOCK    = (uint32)0x5A5A5A5AU;
    }

    static inline void CM_FLASHREGS_UNLOCK(void)
    {
         Fapi_GlobalInit.m_poFlashControlRegisters->FrdIntfCtrlLock.FRD_INTF_CTRL_LOCK_BITS.LOCK    = (uint32)0xA5A5A5A5U;
    }
    In your first post, you sent some disassembly code. Is that the disassembly for CM_FLASHREGS_LOCK when running from RAM?
    If yes, can you also send the disassembly for this function when running from Flash?
    Also, can you explain how you copied the Flash API lib from Flash to RAM? And did you confirm that the contents in RAM match Flash?
    Thanks,

    Sira

  • Hello Sira,

    Yes, the disassembly I previously shared was taken with the Flash API running from RAM.

    Regarding your question about copying the library:
    I am not performing a manual memcpy of the lib from Flash to RAM.
    Instead, I am compiling my complete flash-algorithm (including the Flash API library) so that the entire image is linked to execute from RAM.
    So the Flash API is never placed in Flash – it is already built into a RAM-loadable binary.

    This means the issue is not related to relocation or copying, but rather to how GCC handles certain internal references inside the API.

    Additionally, it is possible that we could review the Flash API source internally if TI provides it under NDA. This would help us understand why GCC resolves these references as absolute addresses on the CM core.

    If you can confirm whether providing the Flash API source under NDA is possible, we will be happy to proceed accordingly.

    Best Regards,
    Dhia

  • Hi Dhia,

    Thanks for the updates. I can send you a private link to request access. I'll send you a friend request.

    Thanks,

    Sira

  • Hi Sira,

    Thank you for the update. Please let me know if you need any information from my side to request access.

    Best Regards,
    Dhia

  • Hi Dhia,

    I sent you a Connect request on e2e. Please accept it so I can send you a request link to the Flash API source code.

  • Hi Sira,

    I wasn’t able to locate the connect request on TI E2E. Could you please advise how I can find it, or resend the request if possible?

    Thanks for your support!

  • Dhia,

    Can you please click on your profile in e2e and explore around? I am unable to resend the request without first canceling it.

    Thanks,

    Sira

  • Hi Sira,

    I found it, it was a bit tricky, but I managed to locate it, and I’ve now accepted the request.

    Best Regards,
    Dhia

  • Great, I just messaged you the request link.