This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Used 25% of memory, but the program restarts due to insufficient memory

At the very beginning of the program in the main function, my stack pointer is 0x20026390, although I expected it to be in the 0x20040000 area.

In this case, static memory is used 26% - 35072 bytes.
Those. my static memory should be in the memory area 0x20020000 - 0x20028900, it turns out that I have already crossed the memory boundary by the stack pointer

The question arises, what could this be related to? I did not change the memory configuration in any way, i.e. sram0_ns is used with a size of 128 KB

Kind regards,

Yuri

Parents
  • In the end, I experimentally found out that the stack pointer is not set to the end of flash memory, but to the end of the main thread, because of this I got confused.

    In addition, the CONFIG_MAIN_STACK_SIZE parameter does not set the main thread's stack size directly, it only increases the memory size by CONFIG_MAIN_STACK_SIZE. This also caused problems in my understanding.

    As a result, it turns out that the size of the stack memory available for the main thread is 0x8000 + CONFIG_MAIN_STACK_SIZE
    Where 0x8000 came from, I still do not understand.

    Therefore, if there is not enough memory, you need to increase CONFIG_MAIN_STACK_SIZE or CONFIG_HEAP_MEM_POOL_SIZE if there is not enough heap.

    Correct me if I am wrong somewhere

Reply
  • In the end, I experimentally found out that the stack pointer is not set to the end of flash memory, but to the end of the main thread, because of this I got confused.

    In addition, the CONFIG_MAIN_STACK_SIZE parameter does not set the main thread's stack size directly, it only increases the memory size by CONFIG_MAIN_STACK_SIZE. This also caused problems in my understanding.

    As a result, it turns out that the size of the stack memory available for the main thread is 0x8000 + CONFIG_MAIN_STACK_SIZE
    Where 0x8000 came from, I still do not understand.

    Therefore, if there is not enough memory, you need to increase CONFIG_MAIN_STACK_SIZE or CONFIG_HEAP_MEM_POOL_SIZE if there is not enough heap.

    Correct me if I am wrong somewhere

Children
No Data
Related