Skip to content

Commit 8e4d05d

Browse files
committed
modify assert and code style
1 parent 8f5e1c5 commit 8e4d05d

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

bsp/stm32/libraries/HAL_Drivers/drv_flash/drv_flash_f7.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,8 @@ static rt_uint32_t GetSector(rt_uint32_t Address)
105105
}
106106
else //0:dual bank mode
107107
{
108-
RT_ASSERT("rtthread doesn't support duel bank mode yet!");
108+
LOG_E("rtthread doesn't support duel bank mode yet!");
109+
RT_ASSERT(0);
109110
}
110111
#else //no dual bank ability
111112
if ((Address < ADDR_FLASH_SECTOR_1) && (Address >= ADDR_FLASH_SECTOR_0))
@@ -306,13 +307,13 @@ int stm32_flash_erase(rt_uint32_t addr, size_t size)
306307
}
307308

308309
#if defined(PKG_USING_FAL)
309-
#define FLASH_SIZE_GRANULARITY_32K 4 * 32 * 1024
310-
#define FLASH_SIZE_GRANULARITY_128K 128 * 1024
311-
#define FLASH_SIZE_GRANULARITY_256K 7 * 256 *1024
310+
#define FLASH_SIZE_GRANULARITY_32K (4 * 32 * 1024)
311+
#define FLASH_SIZE_GRANULARITY_128K (128 * 1024)
312+
#define FLASH_SIZE_GRANULARITY_256K (7 * 256 *1024)
312313

313-
#define STM32_FLASH_START_ADRESS_32K STM32_FLASH_START_ADRESS
314-
#define STM32_FLASH_START_ADRESS_128K STM32_FLASH_START_ADRESS_32K + FLASH_SIZE_GRANULARITY_32K
315-
#define STM32_FLASH_START_ADRESS_256K STM32_FLASH_START_ADRESS_128K + FLASH_SIZE_GRANULARITY_128K
314+
#define STM32_FLASH_START_ADRESS_32K (STM32_FLASH_START_ADRESS)
315+
#define STM32_FLASH_START_ADRESS_128K (STM32_FLASH_START_ADRESS_32K + FLASH_SIZE_GRANULARITY_32K)
316+
#define STM32_FLASH_START_ADRESS_256K (STM32_FLASH_START_ADRESS_128K + FLASH_SIZE_GRANULARITY_128K)
316317

317318
static int fal_flash_read_32k(long offset, rt_uint8_t *buf, size_t size);
318319
static int fal_flash_read_128k(long offset, rt_uint8_t *buf, size_t size);

0 commit comments

Comments
 (0)