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.

Compiler/CC2650: How to set a specific address for assembler AEBI functions?

Part Number: CC2650

Tool/software: TI C/C++ Compiler

We need to calculate and verify the CRC for a single function. But this function uses AEBI functions (for example, __aeabi_ldivmod), which change their address with any minor changes to the code. This leads to a change in the CRC.
How can I make the addresses of these assembler functions permanent? Or maybe there are other methods to solve this problem?

Thank in advance.
Egor Karlin

  • There are methods by which you can fix a function, even a function from the compiler RTS library, at a hard-coded address.  

    But, before I show you that, you should consider using the linker feature for computing the CRC of a section at build time.  Please search the ARM assembly tools manual for the sub-chapter titled Linker-Generated CRC Tables.  Let me know if that looks like it is worth pursuing further.  If so, I'll help you look for examples of using linker generated CRC tables on CC2650 systems.

    Thanks and regards,

    -George

  • The Linker-Generated CRC Tables section looks interesting. In the future I plan to apply this method, but for another case. If I understand correctly, then with each new compilation and linking, the CRC in this table is calculated again and may differ from the previous one.


    But in our case, that part of the code that we need to protect with the help of the CRC should be constant regardless of subsequent compilations. Accordingly, its CRC should also be constant. This part is responsible for metrology and its CRC will be registered in the certificate.

    Kind regards,

    Karlin Egor

  • Please get some general background in linker command files by reading the first part of the article Linker Command File Primer.  Focus on understanding the difference between allocation to a memory range and allocation to a hard-coded address.

    With that background in mind, consider this example ...

       library_output_section
       {
          name_of_library.lib<name_of_file.obj>(.text)
       } > 0x0000B100

    This creates an output section named library_output_section.  It contains one input section.  This input section is the .text section from the object file name_of_file.obj, which a member of the library name_of_library.lib.  It is allocated to the hard-coded address 0x0000B100.

    Thanks and regards,

    -George

  • Thank you George for your advice. Now the function is located at the desired address. But the following problem arose. When I go into debug mode, the continue and suspend buttons are not active, I can only stop the debugging process. As I noticed in the map file, the symbol at the address ENTRY POINT SYMBOL _c_int00 was replaced by _c_int00_noargs. The code snippet with SECTIONS now looks as follows:

    SECTIONS
    {
       output_section_divt2asm
       {
            rtsv7M3_T_le_eabi.lib<ll_div_t2.asm.obj>(.text)
       } > 0x0001f100
    
        .intvecs        :   >  FLASH_APP_BASE
        .text           :   >> FLASH | FLASH_LAST_PAGE
        .const         :   >> FLASH | FLASH_LAST_PAGE
        .constdata    :   >> FLASH | FLASH_LAST_PAGE
        .rodata       :   >> FLASH | FLASH_LAST_PAGE
        .cinit           :   >  FLASH | FLASH_LAST_PAGE
        .pinit           :   >> FLASH | FLASH_LAST_PAGE
        .init_array     :   >> FLASH | FLASH_LAST_PAGE
        .emb_text     :   >> FLASH | FLASH_LAST_PAGE
        .metrology    :   > 0x0001f000
        .ccfg             :   >  FLASH_LAST_PAGE (HIGH)
    
    	.scratchpad     :   > AUX_SRAM
    
    
    
    	GROUP > SRAM
    	{
    	    .data
    	    .bss
    		.vtable
    	    .vtable_ram
    	     vtable_ram
    	    .sysmem
        	.nonretenvar
    	} LOAD_END(heapStart)
    
    	.stack          :   >  SRAM (HIGH) LOAD_START(heapEnd)
    }

    I suspect problems arose after adding output_section_divt2asm.


    I posted this question as related https://e2e.ti.com/support/tools/ccs/f/81/t/918681