Very large program storage generate in Arduino

Development environment specific, Arduino, Eclipse, VS2013,Em::Blocks etc
danieleff
Posts: 336
Joined: Thu Sep 01, 2016 8:52 pm
Location: Hungary
Contact:

Re: Very large program storage generate in Arduino

Post by danieleff » Sat May 13, 2017 2:59 pm

hamsafar_a85 wrote: with STM32F103C8 IC is:
Sketch uses 12876 bytes (19%) of program storage space. Maximum is 65536 bytes.
Global variables use 2816 bytes of dynamic memory.
Most of this is the USB code for Serial communication.

hamsafar_a85
Posts: 11
Joined: Tue May 09, 2017 10:48 am
Contact:

Re: Very large program storage generate in Arduino

Post by hamsafar_a85 » Sun May 14, 2017 3:56 am

stevestrong wrote:
hamsafar_a85 wrote:I compile my project for UNO and my program size is about 16kB but when compile it for Maple mini code is too big!!!
Sketch uses 85056 bytes (76%) of program storage space. Maximum is 110592 bytes.
Global variables use 6272 bytes of dynamic memory.

How can I reduce the program space?
I really doubt that it is exactly the same program code which on UNO is only 16kB.

Anyway, I checked your MAP file and everything looks fine.
These are the largest modules:

stm32f1_code.jpg
Thanks

hamsafar_a85
Posts: 11
Joined: Tue May 09, 2017 10:48 am
Contact:

Re: Very large program storage generate in Arduino

Post by hamsafar_a85 » Sun May 14, 2017 3:58 am

Rick Kimball wrote:
hamsafar_a85 wrote:
stevestrong wrote:Can you show us your code?
Yes,
my code:
https://ufile.io/olblz
Where is the version that compiles for stm32f103? This code seems to have avr specific code.

Which FastLED code are you using? There seems to be an issue with the first FastLED library I found using google.

https://github.com/FastLED/FastLED/issues/142
Yes, this code is for AVR, but I want to change it to use with STM.
I use this fastled library:
https://github.com/evq/FastLED/tree/stm32f103

hamsafar_a85
Posts: 11
Joined: Tue May 09, 2017 10:48 am
Contact:

Re: Very large program storage generate in Arduino

Post by hamsafar_a85 » Sun May 14, 2017 4:10 am

ag123 wrote:among the differences, uno probably won't support many things that's *just there* on stm32, that we mostly 'take for granted'
e.g. on stm32 there is usb-serial and stm32f1 is a native usb device, uno *don't do usb and can't do usb*, stm32 also has many more other resources such as 2 SPI ports, uarts, ADCs, DMA, clocks that can be programmed on the fly, turning on / off clocks to individual peripheral buses, multiple AFIO assignments, low power states etc etc. having support for these hardware may inevitably require more codes to support it hence a somewhat bulkier binary size
Thanks.That's right
ag123 wrote:hence my guess is when compilers are building for atmega328, things that is 'not there' is simply *skipped* as the mcu won't have the hardware to support them and would result in compile errors if they are built after all
Yes, I also have the same idea
ag123 wrote:the FastLeds library seemed rather large i'd think, i'm not too sure if it contain ifdefs that perhaps to skip over sections of code that's not used, otherwise when the library is compiled, all the related objects may be included in the binary hence contributing to binary bloat as well
The fastled library is very large and perfect library and it contain ifdefs too!

hamsafar_a85
Posts: 11
Joined: Tue May 09, 2017 10:48 am
Contact:

Re: Very large program storage generate in Arduino

Post by hamsafar_a85 » Tue May 16, 2017 7:12 am

Wow
After a while, and try and error I add

Code: Select all

-fno-threadsafe-statics
flag to

Code: Select all

compiler.cpp.flags
and size change from:
Sketch uses 85088 bytes (64%) of program storage space. Maximum is 131072 bytes.
Global variables use 6272 bytes of dynamic memory.
to:
Sketch uses 24892 bytes (18%) of program storage space. Maximum is 131072 bytes.
Global variables use 3032 bytes of dynamic memory.
Thanks for all. ;)

Post Reply