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.

AM2732-Q1: How to specify the allocation of data to a certain memory space?

Part Number: AM2732-Q1
Other Parts Discussed in Thread: AWR2243, AM2732

Tool/software:

Hello,

During the development process using AM2732+2*AWR2243, I frequently encounter situations where the L2 storage space is insufficient, forcing me to rigorously optimize and streamline my code. However, when I examine the map file, I notice that there is still space available in other memory regions.

Could you please advise on how I can allocate a specific segment of data to a designated memory space? What rules should I follow for this allocation? For instance, I would like to allocate a struct data segment to R5F_TCMA, R5F_TCMB, or HWA_RAM in order to reduce the occupancy of L2.

MEMORY CONFIGURATION

name origin length used unused attr fill
---------------------- -------- --------- -------- -------- ---- --------
R5F_VECS 00000000 00000040 00000040 00000000 RWIX
R5F_TCMA 00000040 00003fc0 00000000 00003fc0 RWIX
R5F_TCMB 00080000 00004000 00000000 00004000 RWIX
SBL_RESERVED_L2_RAM 10200000 00020000 00000000 00020000 RW
MSS_L2 10220000 000c8000 000a24e0 00025b20 RWIX
HWA_RAM 82000000 00020000 00000000 00020000 RW
DSS_L3 88000000 00390000 00000000 00390000 RWIX
RTOS_NORTOS_IPC_SHM_M c5000000 00001f40 00001c80 000002c0 RWIX

Please provide some assistance on this matter.

Thank you.

  • Hi Miles,

    You can use the combination of the __attribute__() and the matching linker.cmd to accomplish it:

    In your application code,

    /* .dataSec has to be defined in linker.cmd */
    uint8_t gDataBuf[DATA_BUF_SIZE] __attribute__((aligned(128), section(".dataSec")));

    In your linker.cmd,

    SECTIONS
    {

    ...

    .dataSec : {
    } > R5F_TCMA

    ...

    }

    Best regards,

    Ming

  • Sure, so which of these spaces can I use to store my own defined struct data?

    DSS_L2 00800000 00060000 0005f139 00000ec7 RWIX
    HWA_RAM 82000000 00020000 00000000 00020000 RWIX
    DSS_L3_RSV 88000000 00008000 00000000 00008000 RWIX
    DSS_L3 88008000 00388000 00386ca8 00001358 RWIX
    RTOS_NORTOS_IPC_SHM_M c5000000 00001f40 00001c80 000002c0 RWIX

  • If I place some data structures into L3, then the compiled bin file will become much larger. It has increased from the original 470KB to the current 3812kB.

  • 	uint8_t arrayToAntMapping[48]   __attribute__((aligned(1)))=	{23, 15, 22, 14, 21, 13, 20, 12,19, 11, 47, 7, 46, 6,45, 5,44, 4, 43, 3,
    																				16,8,40,0,
    																				17,9,41,1,
    																				24,
    																				18,10,42,2,
    																				25,
    																				32,
    																				26,
    																				33,
    																				31,30,29,28,27,
    																				34,
    																				39,38,37,36,35};
    
    				uint8_t mbazimSamplesind[20]   __attribute__((aligned(1)))=   {0,2,4,6,16,18,24,26,30,32,35,36,39,40,51,52,59,60,65,66};
    				uint8_t sum[47]  __attribute__((aligned(1)))={1,3,5,7,8,9,10,11,12,13,14,15,17,19,20,21,22,23,25,27,28,29,31,33,34,37,38,41,42,43,44,45,46,47,48,49,50,53,54,55,56,57,58,61,62,63,64};
    				uint8_t sum1[47]  __attribute__((aligned(1)))={11,10,10,12,6,10,4,10,4,12,4,12,10,10,6,12,6,12,14,14,8,10,10,10,11,12,13,16,17,16,17,14,15,14,15,14,15,16,17,16,17,16,17,18,19,18,19};
    				uint8_t sum2[47]  __attribute__((aligned(1)))={10,9,8,9,4,7,3,6,2,7,1,6,5,4,2,5,1,4,7,6,1,3,2,1,1,1,1,5,5,4,4,3,3,2,2,1,1,3,3,2,2,1,1,2,2,1,1};
    
    #pragma DATA_ALIGN(sum, 1U);
    #pragma DATA_SECTION(sum, ".l3ram");
    #pragma DATA_ALIGN(sum1, 1U);
    #pragma DATA_SECTION(sum1, ".l3ram");
    #pragma DATA_ALIGN(sum2, 1U);
    #pragma DATA_SECTION(sum2, ".l3ram");
    #pragma DATA_ALIGN(mbazimSamplesind, 1U);
    #pragma DATA_SECTION(mbazimSamplesind, ".l3ram");
    #pragma DATA_ALIGN(arrayToAntMapping, 1U);
    #pragma DATA_SECTION(arrayToAntMapping, ".l3ram");
    

  • Hi Ming,

        Another question, for instance, I have an array that occupies 1024 bytes of space. When I switch from L2 to L3 space, I notice that the occupation in L3 increases by 1024 bytes, but the space in L2 does not decrease by 1024 bytes; it only decreases by 268 bytes. Why is this the case?

    Best Regards,

    Miles

  • Hi Miles,

    Try to remove the  __attribute__((aligned(1))) and all #pragma DATA_ALIGN.

    Best regards