From 7e8be3fcb9aa3faa856cff8122b5f88d104e0b1b Mon Sep 17 00:00:00 2001 From: flespark <0860734llx@gmail.com> Date: Fri, 19 Jul 2024 11:07:05 +0800 Subject: [PATCH] fix: hal flash api unaligned access --- .../1_thread_x_on_stm32_u5/smtc_hal_u5/smtc_hal_flash.c | 2 +- .../2_porting_nrf_52840/smtc_hal_nrf52840/smtc_hal_flash.c | 2 +- .../3_geolocation_on_lora_edge/smtc_hal_l4/smtc_hal_flash.c | 2 +- lbm_examples/smtc_hal_l4/smtc_hal_flash.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lbm_applications/1_thread_x_on_stm32_u5/smtc_hal_u5/smtc_hal_flash.c b/lbm_applications/1_thread_x_on_stm32_u5/smtc_hal_u5/smtc_hal_flash.c index b58b14e..ecd3c63 100644 --- a/lbm_applications/1_thread_x_on_stm32_u5/smtc_hal_u5/smtc_hal_flash.c +++ b/lbm_applications/1_thread_x_on_stm32_u5/smtc_hal_u5/smtc_hal_flash.c @@ -246,7 +246,7 @@ void hal_flash_read_buffer( uint32_t addr, uint8_t* buffer, uint32_t size ) while( FlashIndex < size ) { - data8 = *( __IO uint32_t* ) ( addr + FlashIndex ); + data8 = *( __IO uint8_t* ) ( addr + FlashIndex ); buffer[FlashIndex] = data8; diff --git a/lbm_applications/2_porting_nrf_52840/smtc_hal_nrf52840/smtc_hal_flash.c b/lbm_applications/2_porting_nrf_52840/smtc_hal_nrf52840/smtc_hal_flash.c index 9ed42df..cdd32d7 100644 --- a/lbm_applications/2_porting_nrf_52840/smtc_hal_nrf52840/smtc_hal_flash.c +++ b/lbm_applications/2_porting_nrf_52840/smtc_hal_nrf52840/smtc_hal_flash.c @@ -141,7 +141,7 @@ void hal_flash_read_buffer( uint32_t addr, uint8_t* buffer, uint32_t size ) while( FlashIndex < size ) { - data8 = *( __IO uint32_t* ) ( addr + FlashIndex ); + data8 = *( __IO uint8_t* ) ( addr + FlashIndex ); buffer[FlashIndex] = data8; diff --git a/lbm_applications/3_geolocation_on_lora_edge/smtc_hal_l4/smtc_hal_flash.c b/lbm_applications/3_geolocation_on_lora_edge/smtc_hal_l4/smtc_hal_flash.c index 24b0a2f..a2326f7 100644 --- a/lbm_applications/3_geolocation_on_lora_edge/smtc_hal_l4/smtc_hal_flash.c +++ b/lbm_applications/3_geolocation_on_lora_edge/smtc_hal_l4/smtc_hal_flash.c @@ -259,7 +259,7 @@ void hal_flash_read_buffer( uint32_t addr, uint8_t* buffer, uint32_t size ) while( FlashIndex < size ) { - data8 = *( __IO uint32_t* ) ( addr + FlashIndex ); + data8 = *( __IO uint8_t* ) ( addr + FlashIndex ); buffer[FlashIndex] = data8; diff --git a/lbm_examples/smtc_hal_l4/smtc_hal_flash.c b/lbm_examples/smtc_hal_l4/smtc_hal_flash.c index f7aba32..f6bf5b7 100644 --- a/lbm_examples/smtc_hal_l4/smtc_hal_flash.c +++ b/lbm_examples/smtc_hal_l4/smtc_hal_flash.c @@ -259,7 +259,7 @@ void hal_flash_read_buffer( uint32_t addr, uint8_t* buffer, uint32_t size ) while( FlashIndex < size ) { - data8 = *( __IO uint32_t* ) ( addr + FlashIndex ); + data8 = *( __IO uint8_t* ) ( addr + FlashIndex ); buffer[FlashIndex] = data8;