when I build the project, it is showing the error of
1. .text' will not fit in region `FLASH'
2. `FLASH' overflowed by 12480 bytes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-05-04 3:19 AM
Hello everyone,
I am working with stm32f070c6 , I am developing an application of USB_CDC , When I build the project it is showing the error of
1. .text' will not fit in region `FLASH'
2. `FLASH' overflowed by 12480 bytes
actually I had increase the heap size to 0x400 and stack size 0x400, In my program I am using a buffer size of 64 bytes,
can you please help me out how to overcome flash overflow error.
Solved! Go to Solution.
- Labels:
-
STM32F0 Series
-
USB
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-05-08 3:39 PM
A few things I do with every ARM Cortex:
- Compile with the link time optimizer (-flto)
- For release builds, unless I absolutely need speed optimizations, I optimize for size (-Os)
- Let the linker remove unused sections (--gc-sections)
- Link with newlib-nano (--specs=nano.specs)
- Never use syscalls (--specs=nosys.specs)
If none of these do the trick, then there must be something in your project that allocates large chunks of FLASH. Any large static const arrays, by any chance?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-05-04 8:15 AM
Options:
- Reduce the size of your program. One easy way to do this is to compile in Release mode.
- Switch to a different chip with more memory.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-05-04 12:36 PM
Perhaps review what exactly you have sucking up all the resources, is it code, or static data?
You can perhaps tell the linker it has more memory to work with so it can get closure, and then inspect the .MAP to determine the resource hogs.
Bitmaps? Data Tables?
Are you using a lot of heap space? How much stack is actually being utilized?
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-05-04 10:09 PM
Thanks for your reply @TDK is there any alternatives to overcome that flash overflow error, I reduced the static variables in my program but the problem is remains same
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-05-04 10:18 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-05-08 3:39 PM
A few things I do with every ARM Cortex:
- Compile with the link time optimizer (-flto)
- For release builds, unless I absolutely need speed optimizations, I optimize for size (-Os)
- Let the linker remove unused sections (--gc-sections)
- Link with newlib-nano (--specs=nano.specs)
- Never use syscalls (--specs=nosys.specs)
If none of these do the trick, then there must be something in your project that allocates large chunks of FLASH. Any large static const arrays, by any chance?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-05-17 1:50 AM
Can you elaborate on how to make these changes? I'm a newbie to CubeIDE. Thanks!
