HAL general support for DISABLE_JTAG option (#11211)
Some STM32-based boards may use multiplexed JTAG pins as IO. Up to now the `DISABLE_JTAG` option (defined in pins files) was only supported for AT90-based boards. This commit generalizes the code and adds support for boards based on STM32F1 and STM32F4.
This commit is contained in:
parent
c575c5d5f6
commit
84926b1d5a
4 changed files with 14 additions and 3 deletions
|
@ -352,6 +352,10 @@ inline void HAL_adc_init(void) {
|
||||||
|
|
||||||
#define HAL_SENSITIVE_PINS 0, 1
|
#define HAL_SENSITIVE_PINS 0, 1
|
||||||
|
|
||||||
|
#ifdef __AVR_AT90USB1286__
|
||||||
|
#define JTAG_DISABLE() do{ MCUCR = 0x80; MCUCR = 0x80; }while(0)
|
||||||
|
#endif
|
||||||
|
|
||||||
// AVR compatibility
|
// AVR compatibility
|
||||||
#define strtof strtod
|
#define strtof strtod
|
||||||
|
|
||||||
|
|
|
@ -249,4 +249,6 @@ void HAL_enable_AdcFreerun(void);
|
||||||
#define GET_PIN_MAP_INDEX(pin) pin
|
#define GET_PIN_MAP_INDEX(pin) pin
|
||||||
#define PARSED_PIN_INDEX(code, dval) parser.intval(code, dval)
|
#define PARSED_PIN_INDEX(code, dval) parser.intval(code, dval)
|
||||||
|
|
||||||
|
#define JTAG_DISABLE() afio_cfg_debug_ports(AFIO_DEBUG_NONE)
|
||||||
|
|
||||||
#endif // _HAL_STM32F1_H
|
#endif // _HAL_STM32F1_H
|
||||||
|
|
|
@ -248,4 +248,6 @@ void HAL_enable_AdcFreerun(void);
|
||||||
#define GET_PIN_MAP_INDEX(pin) pin
|
#define GET_PIN_MAP_INDEX(pin) pin
|
||||||
#define PARSED_PIN_INDEX(code, dval) parser.intval(code, dval)
|
#define PARSED_PIN_INDEX(code, dval) parser.intval(code, dval)
|
||||||
|
|
||||||
|
#define JTAG_DISABLE() afio_cfg_debug_ports(AFIO_DEBUG_NONE)
|
||||||
|
|
||||||
#endif // _HAL_STM32F4_H
|
#endif // _HAL_STM32F4_H
|
||||||
|
|
|
@ -687,9 +687,12 @@ void setup() {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(DISABLE_JTAG)
|
#if ENABLED(DISABLE_JTAG)
|
||||||
// Disable JTAG on AT90USB chips to free up pins for IO
|
// Disable JTAG to free up pins for IO
|
||||||
MCUCR = 0x80;
|
#ifdef JTAG_DISABLE
|
||||||
MCUCR = 0x80;
|
JTAG_DISABLE();
|
||||||
|
#else
|
||||||
|
#error "DISABLE_JTAG is not supported for the selected MCU/Board"
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
|
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
|
||||||
|
|
Reference in a new issue