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.

CC3135: FreeRtos memory management

Part Number: CC3135

Hi, 

I am using STM32L4 microcontroller and the BOOSTXL-CC3135 WIFI module interfaced through SPI, 

I have successfully ported the CC3135 driver that I found in the simplelink_sdk_wifi_plugin_2_40_00_22, and I used the DPL source files that I found under the simplelink_cc32xx_sdk_3_30_01_02\kernel\freertos\dpl SDK to interface the CC3135 module with FreeRTOS, 

Note that in my STM32 application, I am using the FreeRTOS V10.0.1, and IAR embedded workbench, And I have already implemented a custom application using this version. 

As a result, I can successfully start the CC3135 module in STA mode, Connect to an access point, ping, scan of available network .... 

However, In my project, I am using Heap_1 as a type of memory manager, and It is working fine with the CC3135 and MQTT network layer since I didn't use sl_stop neither MQTTClient_delete functions, 

my question is, how to use sl_stop and MQTTClient_delete functions with heap_1 ? 

I have to stop the CC3135 WIFI module and MQTT client and restart it in the run time of my project. should I use Heap_3 as recommended in simplelink_sdk_wifi_plugin demonstration ? 

Regards, 

Ghada DHIBI

  • Hi Ghada,

    I believe that heap_3 would be more appropriate given that the use of the sl_Stop / MQTTClient_delete functions assumes the system is capable of freeing memory that has been allocated dynamically. This is definitely the most straightforward solution.

    I believe that if your goal is to reduce the memory footprint of your application (by reducing kernel size), it would be better to avoid dynamic memory allocation altogether. The existing libraries (SimpleLink host driver and networking application libraries) aren't really designed to work with an allocation scheme that does not permit freeing of memory. 

    Best Regards,

    Ben M

  • Hi 

    Let me thank you first for your quick reply, 

    Unfortunately, I have to use the heap_1 in my project, also to use sl_stop and MQTTClient_delete functions.  

    Is there any possibility, or a code example that uses theses functionalities with heap_1 ? 

    In my code, it asserts in a vPortFree function that is called in the disconnection procedure. 

    what should I do to ignore this assertion, using heap_1 ? 

    Regards, 

    Ghada

  • Hi Ghada,

    Unfortunately, the MQTT client does allocate memory upon creation and frees it upon deletion.

    You shouldn't use MQTTCleint_delete if you are using the heap_1.

    If you need to to delete and create the MQTT_client multiple times, you will quickly run out memory if you ignore the "free" requests.

    Br,

    Kobi