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.

CC3220: Program does not fit into available memory

Part Number: CC3220

Dear Team,

I have a tough situation with memory. Not sure what's the best approach to deal with it and where is the best place to start, so I am asking for your advice.

Below is the overall picture. The ".text" seems very big. Is it usually the case in your programs as well? 

Thanks,

David

  • Hi David,

    Your memory requirement to CC3220S device are too big. You have have following options:

    - switch your design to CC3220SF device (recommended way)
    - optimise your code or remove some features from the code

    As start point you can try to move .data section into SRAM0 and decrease size of heap if 32kB of heap is not required by code. But I think this will not be real solution for long time. Other option can be dynamically load part of code at runtime. Example how do that you find at CC3200 SDK at example dynamic_lib_loader (it it for 1st generation of CC32xx, but idea is same for CC3220). But real solution is CC3220SF.

    For example .text section of my very large project is 350kB. But it is not issue, because I use CC32xxSF.

    Jan
  • Hi Jan,

    Unfortunately my prototype has CC3220S and I am kind of stuck with it for now.

    I really hope it should be possible with option 2. I observed, that when I remove "--define=ENABLE_IOT_INFO --define=ENABLE_IOT_ERROR --define=ENABLE_IOT_WARN --define=ENABLE_IOT_DEBUG" from ARM Compiler flag set then I save a couple of Kb. Also, I deleted a lot of UART_PRINT statements that saved also.

    I want to try your suggestion about moving .data section into SRAM0 and decreasing size of heap. Can you advise where to find the commands to do that or if it is quick may be you could share the commands here?

    Another big chunk of memory is consumed by certificates for AWS. My code is based on "shadow_sample" example and in that example certificates are stored in "certs.h" file and that takes a lot of memory as you can see in the below screenshot:

    Do you know if there is a good reason to move those certificates into external flash? 

    Thanks for your valuable advice.

    David

  • Hi David,

    I am not familiar about AWS examples, from this reason I can give you only common advices how to decrease utilization of RAM.

    - yes , disabling debug messages from libraries will save few valuable kB of RAM
    - enabling optimization in compiler decrease size of code
    - place of section and stack size is configurable via linker file inside your project (*.cmd file). Information about stack requirements can give you stack peak in ROV
    - moving certificates from RAM into sFlash will save small piece or RAM also. I am not sure how much of space you can save. You need to try it.
    - you should check if you not use some long strings inside your code. Moving long strings into sFlash can save some memory.
    - you can try optimise RTOS configuration (e.g. use minimalistic exception handler, reduces the .const footprint, etc.)

    Jan
  • Hi Jan,

    By moving .data section into SRAM0 and decreasing size of heap from 32kb to 24kb solved th ememory problem.

    In the below notation I am not sure what the keyword HIGH means in parenthesis, do I need to have it for .data as well?
    .data : > SRAM0
    .stack : > SRAM0(HIGH)

    I am using less than 12kb of SRAM0. Can I reduce it's size to 0x300 as shown below?
    MEMORY
    {
    SRAM0 (RWX) : origin = 0x20000000, length = 0x3000
    SRAM (RWX) : origin = 0x20004000, length = 0x00040000 - 0x3000
    }

    Is the CC3220S_LAUNCHXL_TIRTOS.cmd file the only place where I must make the above changes?

    Thanks,
    David
  • Hi David,

    - You should use .data section without HIGH directive.

    - No. Reducing length of RAM0 does not solve anything. Reason why is RAM splitted into two sections you find here - http://dev.ti.com/tirex/content/simplelink_cc32xx_sdk_2_10_00_04/docs/cc3220/CC3220_ROM_services.html (Bootloader / User Application – Sharing MCU RAM).

    - ... BTW you also should also check, if you have set this TI-RTOS config:

    var m3Hwi = xdc.useModule('ti.sysbios.family.arm.m3.Hwi');
    m3Hwi.excHandlerFunc = null;
    
    var Text = xdc.useModule('xdc.runtime.Text');
    Text.isLoaded = false;

    Jan

  • Hi Jan,

    Thanks, the settings are correct. Do you know what .cinit is for? It doesn't seem to be clear from Memory Allocation view.

    Thanks,
    David
  • Hi David,

    Section .cinit is for initialised global variables. Description of linker sections you find here software-dl.ti.com/.../sdto_cgt_Linker-Command-File-Primer.html

    Jan