I created an additional Bluepill bootloader to allow the use of a simple button switch placed between PA14 and 3.3V (Bluepill JTAG connector pins 2 and 4) to jump into DFU mode instead of BOOT1. The reason for this is those JTAG jumpers pins are soldered in and available on all BP boards and I hate fiddling with the Boot jumpers when I'm in a dev cycle where I need to force things into DFU that the usb reset isn't pulling it's weight (ie: having multiple USB classes configured)
So with this bootloader you can hook up a simple 2-wire switch between the two JTAG pins as follows and hold down button when powering up (or resetting) to force DFU:
A couple things:
it looks like PA13 (the pin adjacent to the 3.3V pin ) doesn't support internal pull-down resistor as when configured for that pin it didn't respond the same way as PA14.
I didn't bother modifying hardware.c to allow activation of internal pull-up resistor (instead of the pull_down) so I could have attached switch the ground pin adjacent to PIN14. If this is what someone wanted (so a simple jumper could be placed between those two pins to force DRU) this could probably be done without too much issue.
Added following lines to Makefile:
build_generic-pc13-pa14: TARGETFLAGS= -DTARGET_GENERIC_F103_PC13_PA14 $(DEFINES)
# Set the linker script
build_generic-pc13-pa14: LDFLAGS +=-T$(ST_LIB)/c_only_md_high_density.ld
build_generic-pc13-pa14: elf bin lss sym
copy_generic-pc13-pa14:
@echo
@echo "Copying to binaries folder"
@echo
cp $(TARGET).bin bootloader_only_binaries/generic_boot20_pc13_pa14.bin
@echo
And these lines to config.h
#elif defined TARGET_GENERIC_F103_PC13_PA14
#define LED_BANK GPIOC
#define LED_PIN 13
#define LED_ON_STATE 0
// Use Boot1 PB2 as the button, as hardly anyone uses this pin as GPIO
// Need to set the button input mode to just CR_INPUT and not CR_INPUT_PU_PD because the external pullup on the jumplink is very weak
#define BUTTON_INPUT_MODE CR_INPUT_PU_PD
#define BUTTON_BANK GPIOA
#define BUTTON_PIN 14
#define BUTTON_PRESSED_STATE 1
Then
$ make generic-pc13-pa14
I've only done a little testing but seems pretty solid. I'll update if I run into issues during the dev cycle.
I created an additional Bluepill bootloader to allow the use of a simple button switch placed between PA14 and 3.3V (Bluepill JTAG connector pins 2 and 4) to jump into DFU mode instead of BOOT1. The reason for this is those JTAG jumpers pins are soldered in and available on all BP boards and I hate fiddling with the Boot jumpers when I'm in a dev cycle where I need to force things into DFU that the usb reset isn't pulling it's weight (ie: having multiple USB classes configured)
So with this bootloader you can hook up a simple 2-wire switch between the two JTAG pins as follows and hold down button when powering up (or resetting) to force DFU:
A couple things:
Added following lines to Makefile:
And these lines to config.h
Then $ make generic-pc13-pa14
I've only done a little testing but seems pretty solid. I'll update if I run into issues during the dev cycle.
cheers