.text will not fit in region rom

DrBanana
Sat Aug 27, 2016 3:38 am
I have a small project of 32K that runs on Mega2560, but now I want to use the same project on STM32F103C8T6 blue boards. They are faster and works on 3v3. The project has Adafruit ili9341 library and couple of fonts. All is working find on mega, but whenever I try to compile the project with generic STM32F103C8TG board I get following error on Visual Micro. The error is similar with arduino IDE except longer.

Compiling 'Test' for 'Generic STM32F103C series'
ld.exe: C:\Users\[USER]\AppData\Local\Temp\VMicroBuilds\Test\Arduino_STM32_genericSTM32F103C\Test.ino.elf section .text will not fit in region rom
ld.exe: region rom overflowed by 35592 bytes

libnosys.a(sbrk.o)*: In function _sbrk
sbrk.c*: (.text._sbrk+0x30): warning: undefined reference to end

collect2.exe*: error: ld returned 1 exit status

Error compiling for board Generic STM32F103C series


RogerClark
Sat Aug 27, 2016 10:00 pm
I doubt if this is the problem, but the Bootloader takes some space, if you are using it.

simonf
Sat Aug 27, 2016 10:19 pm
DrBanana wrote:

But the entire project is 32K, and STM32103C8 has 65K flash. What is going on ?


RogerClark
Sat Aug 27, 2016 11:04 pm
simonf wrote:DrBanana wrote:

But the entire project is 32K, and STM32103C8 has 65K flash. What is going on ?


DrBanana
Sun Aug 28, 2016 8:20 am
I always use int_16 and int_32 to avoid confusion. Also since I’m uploading through St Link, I do not think bootloader will stay there?

And yes I read somewhere that C8 also have 128KB and it works. But problem remains how a 32K sketch became 100K sketch?

One possible thing could be the Adafruit libraries using int.


RogerClark
Sun Aug 28, 2016 8:42 am
One common reason for the sketch suddenly getting very large is the linker needing to bring in a whole bunch of memory management code needed for the “new” operator.

This has been posted about elsewhere on the forum and can’t be avoided as we use the normal ARM libraries


DrBanana
Tue Aug 30, 2016 12:12 pm
Anyway to fix this ?

edogaldo
Tue Aug 30, 2016 12:28 pm
The error is similar with arduino IDE except longer.
Can you post the arduino IDE error? Maybe it provides some more useful information..

DrBanana
Tue Aug 30, 2016 12:37 pm
edogaldo wrote:The error is similar with arduino IDE except longer.
Can you post the arduino IDE error? Maybe it provides some more useful information..

edogaldo
Tue Aug 30, 2016 12:48 pm
Maybe this can be useful: https://e2e.ti.com/support/development_ … 07#1347507

[EDIT] One more suggestion: try to compile for STM32F103VET6 or STM32F103ZET6, these have 512Kb flash, then if they compile successfully you should be able to check your sketch size..


simonf
Tue Aug 30, 2016 2:50 pm
Have you tried

C:\Users\Banana\Documents\Arduino\hardware\Arduino_STM32\STM32F1\libraries\Adafruit_ILI9341_STM

I haven’t used it but it says it is modified to work for the STM


DrBanana
Wed Sep 07, 2016 2:34 pm
Both are almost same size.

edogaldo
Wed Sep 07, 2016 3:28 pm
What’s your sketch size?

DrBanana
Wed Sep 07, 2016 3:34 pm
edogaldo wrote:What’s your sketch size?

edogaldo
Wed Sep 07, 2016 4:02 pm
DrBanana wrote:edogaldo wrote:What’s your sketch size?

Rick Kimball
Wed Sep 07, 2016 4:29 pm
Why don’t you post the code and we can see what is going on.

DrBanana
Wed Sep 07, 2016 6:39 pm
edogaldo wrote:DrBanana wrote:edogaldo wrote:What’s your sketch size?

edogaldo
Wed Sep 07, 2016 6:51 pm
DrBanana wrote:edogaldo wrote:
32K? Isn’t it the size for the Mega2560?!

DrBanana
Wed Sep 07, 2016 6:56 pm
edogaldo wrote:DrBanana wrote:edogaldo wrote:
32K? Isn’t it the size for the Mega2560?!

edogaldo
Wed Sep 07, 2016 8:01 pm
You can check which are the bigger object files in the compilation folder and try to understand if there is any that you don’t need then search a way to exclude it from the compilation process.
You can also try to optimize yourself some library commenting unneeded code.
Only you know your code so only you can decide what you need and what you don’t..
You can try playing with the compiler options in order to try to optimize the code size.
Finally you can go back to AVR..

No magics as far as I know.

Edit: you can also buy ARMs with bigger flash, 128k for an arm seems to me a very minimum and you were using an avr with 256k…


DrBanana
Thu Sep 08, 2016 1:22 am
edogaldo wrote:Edit: you can also buy ARMs with bigger flash, 128k for an arm seems to me a very minimum and you were using an avr with 256k…

RogerClark
Thu Sep 08, 2016 1:58 am
All STM32F103 devices are generally supported even if not in the list as the internal MCU is basically the same for all devices in the series

You may just need to modify a linker file and the boards.txt file


edogaldo
Thu Sep 08, 2016 6:49 am
103xC and 103xE are quite easy to find, quite cheap, ootb supported by stm32duino and fairly equipped:
103xC: 48k ram – 256k flash
103xE: 64k ram – 512k flash

Leave a Reply

Your email address will not be published. Required fields are marked *