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.

RTOS/MSP432P4111: FreeRTOS heap and queue size

Part Number: MSP432P4111

Tool/software: TI-RTOS

Hi,

I try to fix my code that I can use these 2 queues with an FreeRTOS Application:

    xQueue1 = xQueueCreate( 12, 1000 * 2); // uint16_t => 2 byte unsigned integer
    xQueue2 = xQueueCreate(  2, 6000 * 2); // uint16_t => 2 byte unsigned integer

With these queues it ends in vApplicationMallocFailedHook(). I would say that the heap size is to less.

I saw this thread: "RTOS/MSP432P4111: TI-RTOS heap and queue size" and tried to increase the heap size (Prj.Options => build => ARM linker => basic options => heap size=65535).

I also wrote the new heap size 65535 in the cmd file:

*  ======== MSP_EXP432P4111_FREERTOS.cmd ========
 *  Define the memory block start/length for the MSP_EXP432P4111 M4
 */

--stack_size=1024
--heap_size=65535 //0       /* minimize heap since we're using heap_4.c */
--entry_point=resetISR

MEMORY
{
    MAIN       (RX) : origin = 0x00000000, length = 0x00200000
    INFO       (RX) : origin = 0x00200000, length = 0x00008000
    ALIAS
    {
    SRAM_CODE  (RWX): origin = 0x01000000
    SRAM_DATA  (RW) : origin = 0x20000000
    } length = 0x00040000
}

/* Section allocation in memory */

SECTIONS
{
    .text       :   > MAIN
    .const      :   > MAIN
    .cinit      :   > MAIN
    .pinit      :   > MAIN
    .init_array :   > MAIN

    .TI.ramfunc : {} load=MAIN, run=SRAM_CODE, table(BINIT)

    .data   :   > SRAM_DATA
    .bss    :   > SRAM_DATA
    .sysmem :   > SRAM_DATA
    .stack  :   > SRAM_DATA (HIGH)

    .intvecs :  > 0x00000000
    .vtable  :  > SRAM_DATA
}

/* Symbolic definition of the WDTCTL register for RTS */
WDTCTL_SYM = 0x4000480C;

But it always ends in the vApplicationMallocFailedHook() function.

What I'm doing wrong?

Thanks

  • Since you are using FreeRTOS in you application, those instructions are not relevant as the heap size is managed by FreeRTOS.

    FreeRTOS is provided as a separate project for the SimpleLink MSP432P4 SDK. This project uses "heap_4" implementation that is provided by FreeRTOS. When any example dependent on FreeRTOS is imported into CCS, this separate project (freertos_builds_MSP_EXP432P$111_release_ccs) gets automatically imported.

    To update the heap size, the label "configTOTAL_HEAP_SIZE" in FreeRTOSConfig.h file in the project "freertos_builds_MSP_EXP432P$111_release_ccs" should be updated.

    Hope this helps!

    Regards,
    Sai
  • Great! That changed the heap size. But it is a little bit ugly because it's a "global" setting for all FreeRTOS projects... So I have to copy/implement the whole "freertos_builds_MSP_EXP432P$111_release_ccs" project in my application project to make the heap size only for this project bigger. Or is there another way?

    Thanks to Sai !

  • Glad it's working!

    You could create a different FreeRTOS project (and name it something different like "freertos_builds_MSP_EXP432P4111_<EXAMPLE>_release_ccs") and link it to you application. This way you will continue to have the same set-up as the one provided in the SDK. Potentially you could reuse this "custom" FreeRTOS project for other applications in the future.

    Thanks,
    Sai
  • Okay, thank you Sai!

**Attention** This is a public forum