I also tested it by printing through the serial monitor more than 64K of flash text.
My problem is when uploading in Debug Mode, I managed to make it compile to 128K with the following line: “board_upload.maximum_size = 131072”, but when uploading it autodetects the Flash size as 64K: “Info : flash size = 64kbytes”, to make it upload I had to modify the file “.platformio/packages/tool-openocd/scripts/target/stm32f1x.cfg” by changing the autodetect flash size to the value required:
# autodetect size it was 0
set _FLASH_SIZE 0x20000
My question is, is there any way to set this _FLASH_SIZE to the desired value, similar to the command “upload_flags = -c set FLASH_SIZE 0x20000” but for the Debug upload_flags?
This might a case of the ID code being that of a C8 but internally really having 128KB (C8 come from the same die as CB and are just less tested), and then OpenOCD rejecting the upload. But yes, OP can give that a try too.
and it is still autodetected as 64k and the upload fails.
just in case I also tried putting a random command and I get an invalid command error, so it is executing those commands from that file.
I noticed something, when the command above is present I get a random 0x20000 printed in the console:
xPack OpenOCD, x86_64 Open On-Chip Debugger 0.11.0-00155-ge392e485e (2021-03-15-16:43)
Licensed under GNU GPL v2
For bug reports, read http://openocd.org/doc/doxygen/bugs.html
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
Info : tcl server disabled
Info : telnet server disabled
Info : clock speed 1000 kHz
Info : STLINK V2J31S7 (API v2) VID:PID 0483:3748
Info : Target voltage: 3.258614
Info : stm32f1x.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : starting gdb server for stm32f1x.cpu on pipe
Info : accepting ‘gdb’ connection from pipe
Info : device id = 0x20036410
Info : flash size = 64kbytes
Hi! Were you able to get around the issue?
I’m stuck with the same problem and discovered that openocd_extra_args gets appended at the end of openocd command, after it processes the target/stm32.cfg file, so openocd still does flash autodetect. Interestingly, upload_flags are prepended to openocd command, so it works when uploading.
Was able to fix this by creating a boards folder in my project, creating a new board json using the contents of bluepill_f103c8_128k.json and changing "openocd_target": "stm32f1x", to "openocd_target": "../board/stm32f103c8_blue_pill",. On platformio.ini change the board parameter to the name of the new json.