Skip to content

Commit 1363c24

Browse files
committed
[HAL][FMC] Add a volatile qualifier when retrieving data to avoid compiler optimization and ensure data reads correctly
1 parent 0122f3b commit 1363c24

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Src/stm32h7xx_hal_nand.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -637,7 +637,7 @@ HAL_StatusTypeDef HAL_NAND_Read_Page_8b(NAND_HandleTypeDef *hnand, const NAND_Ad
637637
/* Get Data into Buffer */
638638
for (index = 0U; index < hnand->Config.PageSize; index++)
639639
{
640-
*buff = *(uint8_t *)deviceaddress;
640+
*buff = *(__IO uint8_t *)deviceaddress;
641641
buff++;
642642
}
643643

@@ -805,7 +805,7 @@ HAL_StatusTypeDef HAL_NAND_Read_Page_16b(NAND_HandleTypeDef *hnand, const NAND_A
805805
/* Get Data into Buffer */
806806
for (index = 0U; index < hnand->Config.PageSize; index++)
807807
{
808-
*buff = *(uint16_t *)deviceaddress;
808+
*buff = *(__IO uint16_t *)deviceaddress;
809809
buff++;
810810
}
811811

@@ -1287,7 +1287,7 @@ HAL_StatusTypeDef HAL_NAND_Read_SpareArea_8b(NAND_HandleTypeDef *hnand, const NA
12871287
/* Get Data into Buffer */
12881288
for (index = 0U; index < hnand->Config.SpareAreaSize; index++)
12891289
{
1290-
*buff = *(uint8_t *)deviceaddress;
1290+
*buff = *(__IO uint8_t *)deviceaddress;
12911291
buff++;
12921292
}
12931293

@@ -1452,7 +1452,7 @@ HAL_StatusTypeDef HAL_NAND_Read_SpareArea_16b(NAND_HandleTypeDef *hnand, const N
14521452
/* Get Data into Buffer */
14531453
for (index = 0U; index < hnand->Config.SpareAreaSize; index++)
14541454
{
1455-
*buff = *(uint16_t *)deviceaddress;
1455+
*buff = *(__IO uint16_t *)deviceaddress;
14561456
buff++;
14571457
}
14581458

0 commit comments

Comments
 (0)