STM32F103C6T6 region 'FLASH' overflowed

hello everyone, hope you all have a great day today!

i’m trying to use simple FOC library with my STM32F103C6T6 not the " C8 bluepill" one. im using arduino IDE (as my skill set is not good enough for messing with platform IO). i use this mcu because it’s dirt cheap like 2$ and readily available in my country.

i have storm32 bgc and have a sucess controling 3 motors in open loop 3 PWM mode, when i try to use the C6 it won’t compile as it says ‘FLASH’ overflowed, then i try using C8 one with 72KB flash it won’t compile either… i’m using open_loop_velocity_example using 3 pwm driver using PA8, PA9, PA10 pin.

i’d try to flashing to different bootloader, first i use HID bootloader by Serasidis. after it won’t compile i change to the rogerclarkmelbourne one it’s say ‘FLASH’ overflowed again haha getting a little frustated in here

ah yeah i use Arduino IDE 2.03 version (latest), the board manager is STM32 MCU based boards by STMicroelectronics version 2.30 (latest) and Simple FOC library version 2.2.3 (latest)

does changing the Arduino IDE version or the board manager can fix this?

i want to build a servo driver for 3d printer X and Y axis, i need around 150rad/s with 12s18p motor. im thinking to use AS5048A encoder, a step/dir listener, current sense and 6pwm driver is a bonus

i’m trying to keep the cost down as low as possible, the size of the board doesn’t really matter. any suggestion?


I dont think there is a way to reduce the memory footprint that much. Even C8 are borderline for meaningful work. CB is the recommended memory size — 128k flash — for what you want, or even higher.

yeah, too much to ask from 2$ mcu, trying to get a blackpill STM32F411CEU6 is that enough?

We can’t run with that core… only the official ST-micro one will work. I don’t know if you can mix boot loaders, but I would not recommend it. I’d use the official boot loader…


I doubt it. As @Valentine said, 128kB minimum is recommended, and that’s for one motor. Running 3 of them I’m not surprised it doesn’t fit in 64kB…

not 3 motors only one, sorry i didn’t verify that up…

i’m trying different setup with 6 PWM it did compiled around 75kB, 3 PWM 48kB and stepper 44kB using SPI sensor and step/dir listener

then i’m thinking to use that mcu as a Z axis, i’m trying with stepper and encoder it did compiled at 40KB. so close…

i’m using the C8 on board part number as “what if scenario”

yeah this board is a “No Go” example lol as i think that 35KB on arduino UNO (8bit) as the same as the 32bit one, thanks for the feedback!

It should fit if you don’t use the Commander interface. Especially if you set optimization to “Smallest (-Os) with LTO”. Then I get 50kb without Commander, and 65kb with it.

He has C6 which is 32k, that’s not going to fit no matter how hard he tries.


Oh, that is indeed hopeless. I thought it was 64kb.