STM32F1 Blue Pill stuck in DFU mode after upload

Only a guess atm…

The linker script that bluepill_f103c8.json sets the flash memory size, and bluepill_f103c8_128k.json does not have a valid linker file at present. I do however suspect after a quick look at the stm32duino to so how they account for 64K and 128K that a valid version of the linker file just needs to be changed to specify 128K, instead of 64K as it currently does. i.e, a copy of this file, and the relevant changes made to the 128k json file to point to a new linker file, and the relevant line changed there.

However, when I tried exactly that, I got a Warning! Cannot find linker script for the current target! and the compiler now has stage fright, so I got no idea what I missed editing there… I thought it was a matter of ‘create missing linker file with minor change, update path to it in board json, job done’ … but no, it wants to be … DIFFICULT!

Not to be dissuaded, I decided to go about it entirely the wrong way, and edited stm32f103x8.ld so that it said FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 128K on line 4, and line 55 of bluepill_f103c8.json to read "maximum_size": 131072, … and well, yes, it did compile and say the right things… but that was entirely the wrong way to do it! :open_mouth:

btw, there is no reason you couldn’t do the same to genericSTM32F103C8.json … I just happened to be poking around in the bluepill_f103c8.json. But the real question would be… does it blend… er, sorry… does it still work!?

PS: these files are located in %userprofile%\.platformio\platforms\ststm32\

image

1 Like