I have the following project that uses USB Serial.
Back when I wrote this code the default serial port was USB Serial. I used it like this:
12 months ago it built fine, but now I get an error saying the function should take an argument. It appears that USB Serial is no longer the default, so I modified my platformio.ini according to the fix proposed in Maple mini with USB serial in Arduino fails
[env:bluepill_f103c8] platform = https://github.com/platformio/platform-ststm32.git board = bluepill_f103c8 framework = arduino upload_protocol = dfu upload_port = anything build_flags = -D USBD_USE_CDC -D PIO_FRAMEWORK_ARDUINO_ENABLE_CDC -D PIO_FRAMEWORK_ARDUINO_USB_FULLMODE -D USBCON -D USBD_VID=0x0483 -D USB_MANUFACTURER="Unknown" -D USB_PRODUCT="\"BLUEPILL_F103C8\"" -D HAL_PCD_MODULE_ENABLED
However now the chip does not have enough ram to hold the USB serial code.
Linking .pio\build\bluepill_f103c8\firmware.elf c:/users/koen van vliet/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: .pio\build\bluepill_f103c8\firmware.elf section `._user_heap_stack' will not fit in region `RAM' c:/users/koen van vliet/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: region `RAM' overflowed by 1248 bytes collect2.exe: error: ld returned 1 exit status *** [.pio\build\bluepill_f103c8\firmware.elf] Error 1
Then I reversed my changes of the platformio.ini file, and used the UART instead by using
Serial.begin(9600);. This fit in ram and built succesfully.
I want to use USB serial on my Blue Pill board again. How can I make it fit in ram of the STM32F103C8T6?