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.

binit ramfuncs with different run sections for CLA?

I've been successfully using the new CGT15 feature that automatically copies ramfuncs at boot using BINIT table.  This is a great feature, and I was wondering if it was possible for CLA-related things.  For now, I am still copying manually using memcpy (CLA program, and CLA math library).

Right now, I have the following definition in my cmd file for ramfuncs

    .TI.ramfunc             : {
                                -lFlash2803x_API_V100.lib(.econst)
                                -lFlash2803x_API_V100.lib(.text)
                              }
                              LOAD = FLASH_A_H,
                              RUN = RAML0,
                              TABLE(BINIT)

which automatically copies FlashAPI functions and all other ramfunc-attributed functions successfully from flash to RAM.

Is it possible somehow to have several .TI.ramfunc sections so that they can have different RUN locations?  My CLA math lib runs on CLARAM1 and CLAprog runs in RAML3.  I was thinking I could just create another .TI.ramfunc section but with different RUN location (same section name).  Or, if I can't have the same name, just create another section and include TABLE(BINIT).

For the CLA math library, I have tried converting the old section

    CLA1mathTables          : LOAD = FLASH_A_H,     PAGE = 0,
                              RUN = CLARAM1,        PAGE = 1,
                              LOAD_START(_Cla1mathTablesLoadStart),
                              LOAD_SIZE(_Cla1mathTablesLoadSize),
                              RUN_START(_Cla1mathTablesRunStart)

to another .TI.ramfunc section

    .TI.ramfunc.2             : {
                                -lcla0_math_library.lib
                              }
                              LOAD = FLASH_A_H,     PAGE = 0,
                              RUN = CLARAM1,          PAGE = 1,
                              TABLE(BINIT)

but it complains about mixing CLA and non-CLA sections.  What is different about .TI.ramfunc.2 vs CLA1mathTables that it has CLA and non-CLA sections?  Both have LOAD in FLASH_A_H and both RUN from CLARAM1?  Anyway, I feel like I'm trying to do something that's not really supported at the moment, but thought maybe there is a clever workaround.

  • I'm not sure how to put things together so that I can see this problem ...

    Fulano de Tal said:
    it complains about mixing CLA and non-CLA sections.

    so I am not certain that the suggestion in this post really works.

    That said, I can tell you that the table(BINIT) feature does not care about the name of the output section.  I see that you named it .TI.ramfunc.2, but I don't know why.  I suspect the linker is trying to combine it with the other .TI.ramfunc output section, and that causes problems.  But there is no reason to combine those output sections.  Leave .TI.ramfunc as is, and call your CLA related output section CLA1mathTables as before.  In summary, write it this way ...

    CLA1mathTables : 
       {
          -lcla0_math_library.lib
       }
       LOAD = FLASH_A_H, PAGE = 0,
       RUN  = CLARAM1,   PAGE = 1,
       TABLE(BINIT)

    Thanks and regards,

    -George

  • George,
    Thanks greatly for your help. That did end up working fine. I am able to create multiple sections with same load addresses and different run addresses, that all use TABLE(BINIT) and get copied at boot time.


    One thing to note is (as mentioned here: processors.wiki.ti.com/.../Placing_functions_in_RAM ) that if you use __attribute__((ramfunc)), the section MUST be named .TI.ramfunc, otherwise the linker gives an error.

    If instead of using the attribute, I use #pragma CODE_SECTION(MyFunction, "blahblah") then the section can have an arbitrary name.