# Memory issue in free RTOS

**URL:** <https://forums.freertos.org/t/memory-issue-in-free-rtos/16129>\
**Category:** Libraries\
**Tags:** debug, trace, tutorial, blog\
**Created:** [November 7, 2022, 5:26am UTC](https://forums.freertos.org/t/memory-issue-in-free-rtos/16129 "2022-11-07T05:26:34Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![\_sagar](https://avatars.discourse-cdn.com/v4/letter/_/e5b9ba/32.png) [@\_sagar](https://forums.freertos.org/u/_sagar)\
**Post date:** [November 7, 2022, 5:26am UTC](https://forums.freertos.org/t/memory-issue-in-free-rtos/16129/1 "2022-11-07T05:26:34Z")

</div>

In my project i want to run multiple tasks simultaneously, for that i have created two task one is default and my\_task\_01 so here when i am trying to blink 2 led and it is running simultaneously without any error, and then call my ADC reading in the default task and Nextion display task in my\_task\_01 and it gives me an error like this.

 ![Screenshot 2022-11-04 184006](https://d2v6vdsk2p900z.cloudfront.net/original/2X/3/369b78dc23446f8879523307461a674ae85b3d47.png)  
so, if anybody have idea on this please let me know.  
thank you.

---

<div class="post-metadata">

**Author:** ![aggarg](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/aggarg/32/4245_2.png) [@aggarg](https://forums.freertos.org/u/aggarg)\
**Post date:** [November 7, 2022, 6:00am UTC](https://forums.freertos.org/t/memory-issue-in-free-rtos/16129/2 "2022-11-07T06:00:31Z")

</div>

This does not seem to be a FreeRTOS issue but more of a tooling issue. You’d be better asking on ST forums. A quick Google search gives the following which may be useful - [ST Community](https://community.st.com/s/question/0D53W00000Laws9SAB/stm32l15xxdstm32l162xd-error-operation-exceeds-memory-limits).

---

<div class="post-metadata">

**Author:** ![\_sagar](https://avatars.discourse-cdn.com/v4/letter/_/e5b9ba/32.png) [@\_sagar](https://forums.freertos.org/u/_sagar)\
**Post date:** [November 7, 2022, 6:37am UTC](https://forums.freertos.org/t/memory-issue-in-free-rtos/16129/3 "2022-11-07T06:37:22Z")

</div>

Hello Sir,

Thanks for the reply, actually i raised a query in ST forum also but till now i didn’t get any response from them that’s why i raised query here.  
i have never seen such a forum who was not responding anything from last 2 months.  
any other suggestion from your side.  
thank you.

---

<div class="post-metadata">

**Author:** ![hs2](https://avatars.discourse-cdn.com/v4/letter/h/a4c791/32.png) [@hs2](https://forums.freertos.org/u/hs2)\
**Post date:** [November 7, 2022, 9:27am UTC](https://forums.freertos.org/t/memory-issue-in-free-rtos/16129/4 "2022-11-07T09:27:11Z")

</div>

I’m not familiar with the ST programming tools, but your screenshot shows

> Flash size: 64 kBytes

Is this correct for your MCU type ? Seems very little…

---

<div class="post-metadata">

**Author:** ![richard-damon](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/richard-damon/32/38_2.png) [@richard-damon](https://forums.freertos.org/u/richard-damon)\
**Post date:** [November 7, 2022, 3:28pm UTC](https://forums.freertos.org/t/memory-issue-in-free-rtos/16129/5 "2022-11-07T15:28:24Z")

</div>

As Hartmut says, your processor says it has only 64k of flash, but your program is 92k long, so doesn’t fit.

I would have expected you to have gotten a linking error, but maybe you linked with files for a different processor that told the linker you have more flash than you actually do.

---

<div class="post-metadata">

**Author:** ![aggarg](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/aggarg/32/4245_2.png) [@aggarg](https://forums.freertos.org/u/aggarg)\
**Post date:** [November 7, 2022, 5:22pm UTC](https://forums.freertos.org/t/memory-issue-in-free-rtos/16129/6 "2022-11-07T17:22:55Z")

</div>

From your other post, you are using [STM32F750N8](https://www.st.com/en/microcontrollers-microprocessors/stm32f750n8.html)? If so, it actually has 64K which, as @richard-damon pointed, probably indicates that your linker script is not correct.

---

<div class="post-metadata">

**Author:** ![\_sagar](https://avatars.discourse-cdn.com/v4/letter/_/e5b9ba/32.png) [@\_sagar](https://forums.freertos.org/u/_sagar)\
**Post date:** [November 8, 2022, 3:41am UTC](https://forums.freertos.org/t/memory-issue-in-free-rtos/16129/7 "2022-11-08T03:41:39Z")

</div>

I agree that my processor has 64KB, but i need to use the same processor since the design and everything did. so is there any other ways to increase the flash size to run a bulk code.??

---

<div class="post-metadata">

**Author:** ![hs2](https://avatars.discourse-cdn.com/v4/letter/h/a4c791/32.png) [@hs2](https://forums.freertos.org/u/hs2)\
**Post date:** [November 8, 2022, 6:20am UTC](https://forums.freertos.org/t/memory-issue-in-free-rtos/16129/8 "2022-11-08T06:20:09Z")

</div>

You have to decrease the image size. Verify your code including the linker script as Richard already proposed and the resulting map-file to find the reason. A rather simple application like yours should be way smaller.  
Be aware that building for debugging without any optimization (e.g. GCC flag -O0) is very nice but leads to a larger image than building with a bit optimization (e.g. GCC flag -Og). The latter is a bit less comfortable (local variables could get optimized away) but you might be able to fit the image into your flash also with reasonable debugging support.

---

<div class="post-metadata">

**Author:** ![\_sagar](https://avatars.discourse-cdn.com/v4/letter/_/e5b9ba/32.png) [@\_sagar](https://forums.freertos.org/u/_sagar)\
**Post date:** [November 8, 2022, 6:30am UTC](https://forums.freertos.org/t/memory-issue-in-free-rtos/16129/9 "2022-11-08T06:30:38Z")

</div>

Thanks for the reply, However, i am gonna add some more code to my project so definitely it will go more than 100 KB so for this what should i do can i use SDRAM externally to store the flash data or is any other ways to achieve it without any memory errors .

---

<div class="post-metadata">

**Author:** ![hs2](https://avatars.discourse-cdn.com/v4/letter/h/a4c791/32.png) [@hs2](https://forums.freertos.org/u/hs2)\
**Post date:** [November 8, 2022, 6:45am UTC](https://forums.freertos.org/t/memory-issue-in-free-rtos/16129/10 "2022-11-08T06:45:16Z")

</div>

I afraid you are limited to the given size. Or do you have any other persistent storage mounted ? But … you can write quite a lot of code that fits into 64k with ‘optimization for size’ (-Os for GCC). You might have problems with debugging so you could end up selectively setting optimizer flags for dedicated files or pieces of code. Makes life a bit harder, but it’s doable.  
You really should find the reason for the current image size and watch it later on while developing.
