diff options
| author | Mark Olsson <post@markolsson.se> | 2020-06-17 20:48:04 +0200 |
|---|---|---|
| committer | Mark Olsson <post@markolsson.se> | 2020-06-18 00:51:04 +0200 |
| commit | 23da0fa99cce43941c0736b1bd24ed80ca89a991 (patch) | |
| tree | 35d6a73c8db029c25a6549e9eaff31b99e0f7bcd | |
| parent | 25d5f2cfc6097d4f49d955a69b964a7dc9fc5c52 (diff) | |
Fixes issue with memory alignment in STM32
When compiling with optimizations on, an issue occurs where the claimed_pins/never_reset_pins memory location is shared with another variable. This causes some bad memory read, so the USB pins ended up being reset. Setting these to have an alignment of 4 bytes resolves this.
Tested on nucleo_f746zg
| -rw-r--r-- | ports/stm/common-hal/microcontroller/Pin.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/ports/stm/common-hal/microcontroller/Pin.c b/ports/stm/common-hal/microcontroller/Pin.c index e966f709f..f474414b3 100644 --- a/ports/stm/common-hal/microcontroller/Pin.c +++ b/ports/stm/common-hal/microcontroller/Pin.c @@ -55,7 +55,7 @@ bool neopixel_in_use; STATIC uint16_t claimed_pins[GPIO_PORT_COUNT]; -STATIC uint16_t never_reset_pins[GPIO_PORT_COUNT]; +STATIC uint16_t __ALIGNED(4) never_reset_pins[GPIO_PORT_COUNT]; void reset_all_pins(void) { // Reset claimed pins |
