Skip to main content
Associate
April 28, 2024
Solved

RAM overflowed on nucleo32 board (stm32f303k8) board while using FreeRTOS.

  • April 28, 2024
  • 5 replies
  • 5293 views

Hi team,

I am trying to implement FreeRTOS on nucleo32 board (stm32f303k8) on building the same with the one FreeRTOS task, I am getting a error that RAM overflowed by 66456 bytes.

It can be resolved or I need to go with some other high memory boards?

Screenshot (12).png

 

    This topic has been closed for replies.
    Best answer by Tesla DeLorean

    If you increase the size of the FLASH in the linker script, or related dialogs, the linker can get closure, with an unusable image, but you can inspect the .MAP file to see what's allocated to what/whom

    5 replies

    Tesla DeLorean
    Guru
    April 28, 2024

    Unless you can make your RAM utilization smaller you'll need a more capable part. Doesn't your current choice only have 12KB SRAM

    What are you statically allocating that's going to put you 64KB over the available space?

    Got some large 32-bit or float arrays? Too many tasks, too much stack space for each?

    Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
    Associate
    April 28, 2024

    I'm making just one task that too stack size of 30. I just want to print something as I am just a beginner with RTOS.

    Still I don't know where it wants this much space.

    Screenshot (15).png

     

    Tesla DeLorean
    Tesla DeLoreanBest answer
    Guru
    April 28, 2024

    If you increase the size of the FLASH in the linker script, or related dialogs, the linker can get closure, with an unusable image, but you can inspect the .MAP file to see what's allocated to what/whom

    Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
    Associate
    April 29, 2024

    As you told to increase the size of FLASH in linker script,  I tried that, but the error was still there so I tried to increase the size of RAM (I know it's out of range) the error got resolved here, but I know it won't work for the future. While debugging the project it stuck in the HardFault_Handler.

    As I inspected through built analyzer to check memory usage, I got that ucHeap is consuming around 75KB of memory. How can we reduce it?

     

    Screenshot (16).png

    Andrew Neil
    Super User
    April 29, 2024

    @neelesh_vish wrote:

    I am trying to implement FreeRTOS on nucleo32 board (stm32f303k8) o


    Why?

    That chip has only 12K of RAM - it seems highly unlikely that any application which will fit into just 12K RAM is going to benefit from an RTOS !

     


    @neelesh_vish wrote:

    It can be resolved or I need to go with some other high memory boards?


    Going with a more appropriately-sized chip would seem like the most sensible way forward.

    Maybe an expert could shoe-horn this into such a small processor - but that doesn't seem like a sensible approach for a novice?

    Maybe a better learning approach would be to use the Windows Simulator:

    https://www.freertos.org/FreeRTOS-Windows-Simulator-Emulator-for-Visual-Studio-and-Eclipse-MingW.html

     

    A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
    Associate
    April 30, 2024

    Actually, I just started learning RTOS and I have only this chip board available with me. So I tried some printing task on this. I don't think the printing of one or two task will consume this much of memory.

    Currently I am able to fix the issue, but yeah for the next I will go ahead with some higher memory boards.

     

    Thanks @Tesla DeLorean  and @Andrew Neil 

    mƎALLEm
    Technical Moderator
    April 30, 2024

    Currently I am able to fix the issue,


    Hello @neelesh_vish ,

    Could you please tell us how you did fix the issue?

    As said by @Andrew Neil, this chip has only 12K of SRAM and there is no sense to increase its size more.

    To give better visibility on the answered topics, please click "Best answer" on the reply which solved your issue or answered your question.
    Associate
    April 30, 2024

    In the linker script of the project the total heap size was defined as 75*1024 (#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 75 * 1024 ) )that is because I have copied this FreeRTOSconfig.h linker script from other project. now I change it to (#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 10 * 1024 ) ))  and it started working. 

    I will change the board for next, as I just want to print some lines that why I used it.