[SOLVED] stmf303 Blink led because so much memory used?

Thu Nov 09, 2017 8:13 am
Hello friends, after compiling for the stmf303 the led example to see how the resources go. I see this:

Sketch uses 10504 bytes (16%).
Var Global 2936 bytes (23%)
I already know that the boot occupies, but you can eliminate some of the core that was not used.?

I have searched but I do not see anything that tells you clearly if you can or not.

a greeting

Thu Nov 09, 2017 8:24 am
So with Arduino IDE it is ok but not with VSmicro ?

Thu Nov 09, 2017 9:06 am
I do not understand the question. :shock:

Thu Nov 09, 2017 9:22 am
Which build environment you use?
Official Arduino IDE ? other ?

About the clean the build already removed unused function.
But there are several pre-instanciate instance (Serial, I2C, SPI,…)

Thu Nov 09, 2017 9:46 am
I use visual micro.
But when using the debug function does not work with this board.

After compiling blink led in visual micro ide:
Program size: 10.404 bytes (used 16% of a 65.536 byte maximum) (65,80 secs)
Minimum Memory Usage: 2328 bytes (19% of a 12288 byte maximum)

After compiling blink led ide arduino:
Sketch uses 10504 bytes (16%).
Var Global 2936 bytes (23%)

Thu Nov 09, 2017 10:13 am
Ok so you use VSMicro.

What is exactly your request ?
Decrease the size of the binary and the RAM consumption ?

The small difference btw the 2 results probably came from different built options (-Ox, gcc version,…) I do not use VSMicro, so I don’t know how this is configured.

One option to decrease the size is to remove some instances preinstanciate I think. And also disable some HAL feature (ex for blink I2C, SPI, PWM , DAC, ADC are not required)

Thu Nov 09, 2017 10:17 am
Visual micro gives these options, are the image in the attachment

What id do you use?

Thu Nov 09, 2017 11:06 am
by default -OS.
It seems VSMicro uses well the boards.txt and platform.txt of the core.
As I said I do not know the VSMicro.
To have a little gain, for blink sketch you can set the Option 2 to No serial this will remove the Serial instance

Thu Nov 09, 2017 11:19 am
What ide do you use?

Thu Nov 09, 2017 12:44 pm
Official Arduino IDE

Thu Nov 09, 2017 12:53 pm
The bad thing is that the official ide has no debugger.

The visual micro works well, the debugger works well, in the arduino board versions uno,nano,micro ,mega…

Also modify or see libraries used in the project is very fast from the same ide of visual studio.

I have sent a query to the visual micro to implement the debugging of the nucleo of st.

Thu Nov 09, 2017 9:39 pm
Seems like you may be using the stm32duino core.
There are currently 3 main STM32 cores for Arduino, each may use a bit more or less RAM and Flash with a minimum sketch, but as FPI pointed out, there are pre-instantiated objects that take memory, and the functions to setup the MCU and its peripherals take flash space.

What you get is about average for setting up the MCU and all the peripherals. There are multiple threads about the subject:
viewtopic.php?f=3&t=1902&p=25247&hilit= … tch#p25246

You couldmodify the core and eliminate timers, spi ports, usart, gpio etc etc to reduce the size, but in reality after that initial size the sketches don’t grow that much other than your own code, so unless you are writing a program that’s running out of memory, you can ignore this and just leave with the fact that an empty sketch takes 10KB. Until you take all the memory, it wont make a difference to the MCU if you are using 10%, 20%, 50% or 90% of it.

Fri Nov 10, 2017 9:16 am
Hello and thanks for your response.
I currently use the NUCLEO-F303K8 that uses a mcu stm32f303k8t6 with 64k and 16k ram.

I have also seen that it does not have eeprom and emulates it in the library, assigning it by flash
the eeprom.read and write of arduino.

I will review your data and the post that you indicate to me.

Thank you very much.

Leave a Reply

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