diff --git a/src/platforms/stm32/serialno.c b/src/platforms/stm32/serialno.c index 574fce0..67776cf 100644 --- a/src/platforms/stm32/serialno.c +++ b/src/platforms/stm32/serialno.c @@ -23,7 +23,7 @@ char *serial_no_read(char *s) { #if DFU_SERIAL_LENGTH == 9 - const volatile uint32_t *const unique_id_p = (volatile uint32_t *)DESIG_UNIQUE_ID_BASE; + const volatile uint32_t *const unique_id_p = (uint32_t *)DESIG_UNIQUE_ID_BASE; const uint32_t unique_id = unique_id_p[0] + unique_id_p[1] + unique_id_p[2]; /* Fetch serial number from chip's unique ID */ for(size_t i = 0; i < 8U; ++i) { @@ -34,7 +34,7 @@ char *serial_no_read(char *s) } #elif DFU_SERIAL_LENGTH == 13 /* Use the same serial number as the ST DFU Bootloader.*/ - const uint16_t *const uid = (uint16_t *)DESIG_UNIQUE_ID_BASE; + const volatile uint16_t *const uid = (uint16_t *)DESIG_UNIQUE_ID_BASE; # if defined(STM32F4) || defined(STM32F7) int offset = 3; # elif defined(STM32L0) || defined(STM32F0) || defined(STM32F3) @@ -42,7 +42,7 @@ char *serial_no_read(char *s) # endif sprintf(s, "%04X%04X%04X", uid[1] + uid[5], uid[0] + uid[4], uid[offset]); #elif DFU_SERIAL_LENGTH == 25 - volatile uint32_t *unique_id_p = (uint32_t *)DESIG_UNIQUE_ID_BASE; + const volatile uint32_t *const unique_id_p = (uint32_t *)DESIG_UNIQUE_ID_BASE; uint32_t unique_id = 0; for (size_t i = 0; i < 24U; ++i) { const size_t chunk = i >> 3U;