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.

SIMPLELINK-CC3220-SDK: CC3220SF RAM usage questions

Part Number: SIMPLELINK-CC3220-SDK

Hi,

I finished porting my CC3200 based program (based on latest CC3200SDK_1.3.0) to CC3220SF (based on the latest cc32xx_sdk_1_40_01_00). Now I am testing my CC3220SF program and getting many RAM related issues. My CC3220SF program uses the same configuration as network_terminal example in latest cc32xx_sdk_1_40_01_00.

In CC3200, my program and data are all in 256KB RAM. It works on CC3200 very well.

When I ported to CC3220SF, I didn't add any new code, just ported to new CC3220SF. I found that my program uses much more RAM in CC3220SF than in CC3200. I am now getting "Application Malloc Failed" error. When I check into it and found that CC3200 SDK uses FreeRTOS 8.0.1 while CC3220 SDK uses FreeRTOS 9.0.0.

In FreeRTOSConfig.h file, there a major difference:

In CC3200SDK, configTOTAL_HEAP_SIZE = 5000

In CC3220SDK, configTOTAL_HEAP_SIZE = 0x8000

Q1: Why are they so different?

I tried decreasing configTOTAL_HEAP_SIZE in my CC3220SF program. But I got strange "Application Malloc Failed" and memory free error.

Q2: How to allocate heap size and stack size in CC3220SF?

In my CC3200 project properties -> CCS Build -> ARM Linker -> Basic Options, 0x8000 is set in both "Heap size for C/C++ dynamic memory allocation" and "Set C system stack size". However, in CC3220SF project properties, those two items are NOT set. Should I set any number over there? If not, at any other place I should set for heap size and stack size?

Q3: Is there a way to put my program in CC3220SF internal flash and at the same time I can use XDS110 to debug my program?

Right now I am debugging my program in CC3220SF, I suppose all my program and data are in 256KB RAM. If I can move my program to CC3220SF internal flash, my data can use all 256KB. At least, I can see if my program can run the same as in CC3200 platform.

Thanks in advance for your suggestion.

Al

  • After some time searching and reading, now I understand that CC3200SDK uses FreeRTOS heap_3 in which configTOTAL_HEAP_SIZE has no effect. CC3220SDK uses heap_4  in which configTOTAL_HEAP_SIZE has effect. Hence, I don't need to compare them.

    Now I am getting vPortFree() error. The screen shot is below. My program works well for CC3200 with CC3200SDK. After porting to CC3220SF, I don't understand why I am getting memory free issue.

    Any idea?

    Al

  • Hi Al,

    Thanks for the question. Please allow some time for us to respond to this question
  • Hi, Austin.

    Thanks for your reply. It seems that I am really having problems with CC3220SDK memory management.

    If I comment out those 2 configASSERT lines in heap_4.c, my program can run much further.
    // configASSERT( ( pxLink->xBlockSize & xBlockAllocatedBit ) != 0 );
    // configASSERT( pxLink->pxNextFreeBlock == NULL );

    However, when I try my field upgrade command, I found one of the memory block is allocated to address 0x00000008 which is an invalid memory location for the application buffer. Then my program fails.

    My old CC3200 program runs well with CC3200SDK (which uses heap_3.c). My question is:
    Is it easy I can switch from heap_4 to heap_3 in CC3220SDK so I can try to see if my program works?

    I tried simply replacing heap_4.c contents with heap_3.c contents. Compilation was fine but I got a run time error when I ran my program.

    Please let me know if it's possible for me to switch from heap_4 to heap_3 in CC3220SF SDK.

    Thanks,

    Al
  • Another question:

    In my CC3220SF application, can I mix pthread_create() and xTaskCreate() to create tasks?

    Some new code in my program, I use pthread_create() to create tasks. In my legacy code from CC3200 project, I didn't change the way to create tasks so I still use xTaskCreate() to create tasks. Will it create any memory related issues?

    Thanks,

    Al
  • Hi Al,

    1. The heap size and the stack size are likely different due to more dynamic memory allocation in the Gen2 SDK as opposed to the Gen1 SDK.

    2. For gen2 the sizes for the heap + stack can be set in the "XXX...XXX.cmd" file

    3. Yes, please see the link below for more details.

    4. I don't know much about freeRTOS, but I don't see why xTaskCreate() would cause this problem.

    Perhaps you should checkout our porting guide to make as an initial sanity check.