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.

CCS/IWR1642BOOST: How does 1642 allocate a piece of memory to store data separately?

Part Number: IWR1642BOOST
Other Parts Discussed in Thread: IWR1642

Tool/software: Code Composer Studio

Hello, TI engineers, how can IWR1642 separately allocate a piece of memory to store the data that you need? For example, allocate 10kb memory to save your own algorithm or target amplitude? Is it distributed directly in cmd or is it using other methods? How is the MMW_ALLOC_BUF() function used? What is its role? Is there a specific routine? Thank you。I still want to ask. How much memory is left in the 1642 for us to use? Can we still allocate our own memory? Thank you

  • Hi ZHG,

    1. Please refer to the following resources first to understand the linker command file. The commands here are used to create named sections corresponding to physical memory ranges based on the Memory map of the device.

    http://software-dl.ti.com/ccs/esd/documents/sdto_cgt_Linker-Command-File-Primer.html

    Advanced Linker Techniques for Convenient and Efficient Memory Usage

    2. Then in dss_data_path.c, global buffers are created and placed in the above named sections using #Pragmas 

    /*! L3 RAM buffer */
    #pragma DATA_SECTION(gMmwL3, ".l3data");
    #pragma DATA_ALIGN(gMmwL3, 8);
    uint8_t gMmwL3[SOC_XWR16XX_DSS_L3RAM_SIZE];
    
    /*! L2 Heap */
    #pragma DATA_SECTION(gMmwL2, ".l2data");
    #pragma DATA_ALIGN(gMmwL2, 8);
    uint8_t gMmwL2[MMW_L2_HEAP_SIZE];
    
    /*! L1 Heap */
    #pragma DATA_SECTION(gMmwL1, ".l1data");
    #pragma DATA_ALIGN(gMmwL1, 8);
    uint8_t gMmwL1[MMW_L1_HEAP_SIZE];


    3. After this point all memory allocation and management is done in the application using the MMW_ALLOC_BUF macro (you can look at the code in this function) which basically allocates memory buffers from the above global buffers e.g.:

    #ifdef NO_OVERLAY
    #define MMW_ALLOC_BUF(name, nameType, startAddr, alignment, size) \
            obj->name = (nameType *) ALIGN(prev_end, alignment); \
            prev_end = (uint32_t)obj->name + (size) * sizeof(nameType);
    #else
    #define MMW_ALLOC_BUF(name, nameType, startAddr, alignment, size) \
            obj->name = (nameType *) ALIGN(startAddr, alignment); \
            uint32_t name##_end = (uint32_t)obj->name + (size) * sizeof(nameType);
    #endif
    
        uint32_t heapUsed;
        uint32_t heapL1start = (uint32_t) &gMmwL1[0];
        uint32_t heapL2start = (uint32_t) &gMmwL2[0] + l2HeapOffset;
        uint32_t heapL3start = (uint32_t) &gMmwL3[0];

    Also, look at the Memory Usage section in the mmw demo doxygen to understand the total memory usage / available free space etc: 

    file:///C:/ti/mmwave_sdk_02_01_00_04/packages/ti/demo/xwr16xx/mmw/docs/doxygen/html/index.html

    Thanks

    -Nitin

  • Hi Nitin,

    Thank you very much, your answer solved our troubles very well.

    Thanks

    ZHG