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.

TDA4VM: Compiler Placement of String Literals (.rodata.str)

Part Number: TDA4VM


Tool/software:

Hello,

We are using the ti-arm-clang-3.2.0 compiler/toolchain for a project aimed

at Cortex-R5F/Armv7-R. Due to requirements, we need to map rodata.str1.* sections to different memory regions with varying attributes, such as cached vs. non-cached.

I have tried to do the following but have yet to be successful.



#pragma clang section data   = ".my_data"
#pragma clang section bss    = ".my_bss"
#pragma clang section text   = ".my_text"
#pragma clang section rodata = ".my_rodata"

static void foo(foo foo)
{
 ...
 const char[] foo = "Helllo World!";
 ...
}

#pragma clang section data   = ""
#pragma clang section bss    = ""
#pragma clang section text   = ""
#pragma clang section rodata = ""

The documentation doesn't say much



Best Regards,

Ali Mohamed 

  • Is it practical to control it on a file by file basis?  Don't use any compile options or pragmas.  The control is implemented in the SECTIONS directive of the linker command file.  For example ...

        rodata_strings1
        {
            f1.obj(.rodata.str1*)
            f2.obj(.rodata.str1*)
        } > SPECIAL_MEMORY1
        
        rodata_strings2
        {
            f3.obj(.rodata.str1*)
            f4.obj(.rodata.str1*)
        } > SPECIAL_MEMORY2

    This collects all the strings from the object files f1.obj and f2.obj into an output section named rodata_strings1.  It is allocated to a memory range named SPECIAL_MEMORY1.  The output section rodata_string2 is similar, but for different files and a different memory range.

    Thanks and regards,

    -George

  • Hello George,

     

    It will suffice for now as the files are limited; however, the underlying OS (an AUTOSAR BSW) is configuration-based and generates header files with pragmas.

    Is there a possibility of enforcing the placement of rodata.str with pragmas as described above in the next increment?

     

    Best regards,

    Ali

  • Is there a possibility of enforcing the placement of rodata.str with pragmas as described above in the next increment?

    I am unable to make any promises.  But I did file EXT_EP-11829 to request a feature be added to the compiler.  You are welcome to follow it with that link.

    Thanks and regards,

    -George