stm32f4xx-hal
stm32f4xx-hal copied to clipboard
Restrict access to JTAG pins
I ran into another one of these classic embedded failures: Locking yourself out of the chip by reconfiguring the debug pins. (Easy to fix if you know how)
Apparently this is espeacially easy to achieve on the f4 chips, since you only have to configure the gpio pins with the normal gpio functions (e.g. into_push_pull_output()).
The F1 HAL has a protection mechanism, and only provides access to the JTAG pins with a special function: https://docs.rs/stm32f1xx-hal/0.7.0/stm32f1xx_hal/afio/struct.MAPR.html#method.disable_jtag
I'd suggest to implement something simmilar for the F4 HAL as well and restict the access to the pins via e.g. GPIOA.split().gpioa.pa15