Skip to content

Commit 9017b2f

Browse files
0xc0170c1728p9
authored andcommitted
flash: add get flash size function
1 parent 38f55eb commit 9017b2f

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

hal/TARGET_FLASH_CMSIS_ALGO/flash_common_algo.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,3 +183,7 @@ uint32_t flash_get_page_size(flash_t *obj)
183183
return obj->target_config->page_size;
184184
}
185185

186+
uint32_t flash_get_size(flash_t *obj)
187+
{
188+
return obj->target_config->flash_size;
189+
}

hal/flash_api.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,13 @@ uint32_t flash_get_sector_size(flash_t *obj, uint32_t address);
8989
*/
9090
uint32_t flash_get_page_size(flash_t *obj);
9191

92+
/** Get flash size
93+
*
94+
* @param obj The flash objects
95+
* @return The size of the flash available
96+
*/
97+
uint32_t flash_get_size(flash_t *obj);
98+
9299
/**@}*/
93100

94101
#ifdef __cplusplus

0 commit comments

Comments
 (0)