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.

RTOS/TMDXIDK437X: Changing the placement of the memory area function

Part Number: TMDXIDK437X

Tool/software: TI-RTOS

Hello
In my project, I am trying to change the function location section using void myFunc (void) __attribute__ ((section (". AppCode"))) ; I want to change the memory area from DDR to OCMCRAM. I compile the project, but my function is missing in the map file. My linker.cmd file:

MEMORY
{
    OCMCRAM (RWX) : org = 0x40300000, len = 0x20000
    L2SRAM (RWX) : org = 0x40500000, len = 0x40000
    EXT_RAM : org = 0x80000000, len = 0x8000000
}

SECTIONS {

    .c_int00 : {
        KEEP (*(.c_int00))
    } > REGION_TEXT
	
	.appData (NOLOAD) : {
		*(.appData)
        *(.appData.*)
    } > OCMCRAM
	
.appCode (NOLOAD) : {
		*(.appCode)
        *(.appCode.*)	
	} > OCMCRAM
}

  

Could you help me?

  • Can you please try to use the same section name in the source and the linker command file. The section name is with first alphabet capitalized but the linker command file is not.  Change the .appCode in the linker command file to .AppCode as this may be case sensitive. Also make sure that you are using the custom function in the code when you have optimization turned on and remove the flag  --gc-sections from the linker to prevent it from removing unused functions in you code.

    If this doesn`t work then also provide the syntax that you have used in your source for us to review.  Here is an simple example that I am able to see in the map file when using __attributes__:

    main.c:

    #include <stdio.h>
    
    void foobar (void) __attribute__ ((section ("bar")));
    
    /**
     * hello.c
     */
    
    int main(void)
    {
    	printf("Hello World!\n");
    	
    	return 0;
    }
    
    void foobar (void){
        return ;
    }
    

    Linker command file:

    MEMORY
    {

    SRAM : o = 0x402F0000, l = 0x00010000 /* 64kB internal SRAM */
    L3OCMC0 : o = 0x40300000, l = 0x00010000 /* 64kB L3 OCMC SRAM */
    M3SHUMEM : o = 0x44D00000, l = 0x00004000 /* 16kB M3 Shared Unified Code Space */
    M3SHDMEM : o = 0x44D80000, l = 0x00002000 /* 8kB M3 Shared Data Memory */
    DDR0 : o = 0x80000000, l = 0x80000000 /* 2GB external DDR Bank 0 */

    }

    ENTRY(Entry)
    
    SECTIONS
    {
        .rsthand :
        {
            . = ALIGN(0x10000);
            KEEP(*(.isr_vector))
            *startup_ARMCA9.o (.text)
        } > DDR0
        
        . = ALIGN(4);
        .text :
        {
            *(.text*)
    
            KEEP(*(.init))
            KEEP(*(.fini))
           
            *(.rodata*)
    
            KEEP(*(.eh_frame*))
        } > DDR0
    	.bar (NOLOAD):
        {
            *(bar*)
    
            KEEP(*(.init))
            KEEP(*(.fini))
    
        } > DDR0
    
       ............................ // Addtional section placement for heap, stack, etc
     }
    
    

    Hope this helps.