diff options
author | Damien George <damien.p.george@gmail.com> | 2019-07-09 11:33:57 +1000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2019-07-09 11:33:57 +1000 |
commit | c8f19f13715ca201815a8594e32121ae06f504c5 (patch) | |
tree | 2a4e79a132c1e3f4c4c3eff39d12c7ff427c8e93 | |
parent | d43dd886a5d072f49d5c27779199f3e233d6afb5 (diff) |
stm32/mboot: Make _estack an array to avoid compiler warnings.
The compiler can warn about out-of-bounds array access if _estack is just a
single uint8_t.
-rw-r--r-- | ports/stm32/mboot/mboot.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/ports/stm32/mboot/mboot.h b/ports/stm32/mboot/mboot.h index 54b3dc729..7dc1ada0c 100644 --- a/ports/stm32/mboot/mboot.h +++ b/ports/stm32/mboot/mboot.h @@ -30,8 +30,9 @@ // Use this to tag global static data in RAM that doesn't need to be zeroed on startup #define SECTION_NOZERO_BSS __attribute__((section(".nozero_bss"))) -#define ELEM_DATA_START (&_estack) -#define ELEM_DATA_MAX (ELEM_DATA_START + 1024) +#define ELEM_DATA_SIZE (1024) +#define ELEM_DATA_START (&_estack[0]) +#define ELEM_DATA_MAX (&_estack[ELEM_DATA_SIZE]) enum { ELEM_TYPE_END = 1, @@ -48,7 +49,7 @@ typedef struct _fsload_bdev_t { uint32_t byte_len; } fsload_bdev_t; -extern uint8_t _estack; +extern uint8_t _estack[ELEM_DATA_SIZE]; uint32_t get_le32(const uint8_t *b); void led_state_all(unsigned int mask); |