Colleagues, tell me, please, why I get such a huge code?
I'm compiling the classic Blink program for BluePill (F103C8). USB support is disabled. Optimize is Smallest.
The built code takes up 10752 KB, 16% of the total memory for the program. Global variables use 836 bytes.
The program in five lines reads and writes only one port.
For God's sake, what does the compiler put in there?
Ogogon.
BluePill: why such a huge code size?
BluePill: why such a huge code size?
"'But oh, beamish nephew, beware of the day, If your Snark be a Boojum! For then
You will softly and suddenly vanish away, And never be met with again!"
You will softly and suddenly vanish away, And never be met with again!"
Re: BluePill: why such a huge code size?
You can do some customization to reduce size:
https://github.com/stm32duino/Arduino_C ... tes-of-ram
https://github.com/stm32duino/Arduino_C ... nmap-array
https://github.com/stm32duino/Arduino_C ... tes-of-ram
https://github.com/stm32duino/Arduino_C ... nmap-array
Re: BluePill: why such a huge code size?
if you use USB (CDC) serial, that one consumes quite a bit of flash. then ADC etc. For what is worth, the codes isn't catering to a simple 'Uno' type scenario, but practically across the swatch of stm32 series.
get an mcu with more flash and ram e.g. stm32f401/f411 ce or better f401re,ve/f411re,ve/f405re,ve. Those have plenty of flash and ram and can easilly fit lots of codes and data. stm32duino is more than just bare metal programming, it is a little os in itself.
get an mcu with more flash and ram e.g. stm32f401/f411 ce or better f401re,ve/f411re,ve/f405re,ve. Those have plenty of flash and ram and can easilly fit lots of codes and data. stm32duino is more than just bare metal programming, it is a little os in itself.
Re: BluePill: why such a huge code size?
10k is not bad. It has time keeping, various tables, interrupts, constants, ...
I think the bare minimum is somewhere around 2k. And then you pay a price for 32bit code density...
I think the 8bit Arduino compiles to around 10k as well.
I think the bare minimum is somewhere around 2k. And then you pay a price for 32bit code density...
I think the 8bit Arduino compiles to around 10k as well.
Re: BluePill: why such a huge code size?
Re-do the test by doing customization:
with Serial disabled, USB disabled and hal_conf_extra.h:Sketch uses 4320 bytes (6%) of program storage space. Maximum is 65536 bytes.
Global variables use 72 bytes (0%) of dynamic memory, leaving 20408 bytes for local variables. Maximum is 20480 bytes.
Code: Select all
#define HAL_ADC_MODULE_DISABLED
#define HAL_I2C_MODULE_DISABLED
#define HAL_RTC_MODULE_DISABLED
#define HAL_SPI_MODULE_DISABLED
#define HAL_TIM_MODULE_DISABLED
#define HAL_DAC_MODULE_DISABLED
#define HAL_EXTI_MODULE_DISABLED
#define HAL_OSPI_MODULE_DISABLED
Re: BluePill: why such a huge code size?
I bet it's a bit smaller if you use the libmaple core, too.
-
- Posts: 1
- Joined: Sat Mar 25, 2023 6:43 am
Re: BluePill: why such a huge code size?
Ah ok. Thanks. That's crazy markup. A lot of these chips (tens of thousands?) could fit in a box that could ship from china for $10. I can see how this is very lucrative for Digikey. netgear login
pikashow.ltd
pikashow.ltd
Last edited by nahihua535 on Tue Apr 04, 2023 4:12 pm, edited 1 time in total.
Re: BluePill: why such a huge code size?
ic smuggling is a big business.That's crazy markup. A lot of these chips (tens of thousands?) could fit in a box that could ship from china for $10.
Code: Select all
I can see how this is very lucrative for Digikey.
1. they make little money for large quantity orders (aka 10K chips)
2. they make lots of money for small quantity orders (aka 10 resistors).
so you can think of their pricing on 1K chips as basically their cost basis. the large quantity pricing is so you place an order for your entire bom with them.