mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #11619 from JanneKiiskila/FlashIAP_DISCO_H747
Add FLASHIAP component to DISCO_H747pull/11777/head
commit
cbf9f0650b
|
@ -20,6 +20,9 @@
|
|||
"NUCLEO_F429ZI": {
|
||||
"storage_type": "TDB_INTERNAL"
|
||||
},
|
||||
"DISCO_H747I": {
|
||||
"storage_type": "TDB_INTERNAL"
|
||||
},
|
||||
"UBLOX_EVK_ODIN_W2": {
|
||||
"storage_type": "TDB_INTERNAL"
|
||||
},
|
||||
|
|
|
@ -15,6 +15,10 @@
|
|||
"internal_size": "0x8000",
|
||||
"internal_base_address": "0x00028000"
|
||||
},
|
||||
"DISCO_H747I": {
|
||||
"internal_size": "256*1024",
|
||||
"internal_base_address": "0x080C0000"
|
||||
},
|
||||
"ARM_MUSCA_A1_S": {
|
||||
"internal_size": "0x8000",
|
||||
"internal_base_address": "0x00420000"
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
static uint32_t GetSector(uint32_t Address);
|
||||
static uint32_t GetSectorSize(uint32_t Sector);
|
||||
static uint32_t GetSectorBase(uint32_t SectorId);
|
||||
|
||||
int32_t flash_init(flash_t *obj)
|
||||
{
|
||||
|
@ -91,6 +92,9 @@ int32_t flash_erase_sector(flash_t *obj, uint32_t address)
|
|||
}
|
||||
}
|
||||
|
||||
SCB_CleanInvalidateDCache_by_Addr((uint32_t *)GetSectorBase(SectorId), GetSectorSize(SectorId));
|
||||
SCB_InvalidateICache();
|
||||
|
||||
HAL_FLASH_Lock();
|
||||
#if defined(DUAL_CORE)
|
||||
LL_HSEM_ReleaseLock(HSEM, CFG_HW_FLASH_SEMID, HSEM_CR_COREID_CURRENT);
|
||||
|
@ -103,6 +107,7 @@ int32_t flash_program_page(flash_t *obj, uint32_t address, const uint8_t *data,
|
|||
{
|
||||
uint32_t StartAddress = 0;
|
||||
int32_t status = 0;
|
||||
uint32_t FullSize = size;
|
||||
|
||||
if ((address >= (FLASH_BASE + FLASH_SIZE)) || (address < FLASH_BASE)) {
|
||||
return -1;
|
||||
|
@ -135,6 +140,9 @@ int32_t flash_program_page(flash_t *obj, uint32_t address, const uint8_t *data,
|
|||
}
|
||||
}
|
||||
|
||||
SCB_CleanInvalidateDCache_by_Addr((uint32_t *)StartAddress, FullSize);
|
||||
SCB_InvalidateICache();
|
||||
|
||||
HAL_FLASH_Lock();
|
||||
#if defined(DUAL_CORE)
|
||||
LL_HSEM_ReleaseLock(HSEM, CFG_HW_FLASH_SEMID, HSEM_CR_COREID_CURRENT);
|
||||
|
@ -213,6 +221,22 @@ static uint32_t GetSectorSize(uint32_t Sector)
|
|||
return (uint32_t)(128 * 1024); // 128 KB
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Gets sector base address
|
||||
* @param SectorId
|
||||
* @retval base address of a given sector
|
||||
*/
|
||||
static uint32_t GetSectorBase(uint32_t SectorId)
|
||||
{
|
||||
uint32_t i = 0;
|
||||
uint32_t address_sector = FLASH_BASE;
|
||||
|
||||
for (i = 0; i < SectorId; i++) {
|
||||
address_sector += GetSectorSize(i);
|
||||
}
|
||||
return address_sector;
|
||||
}
|
||||
|
||||
uint8_t flash_get_erase_value(const flash_t *obj)
|
||||
{
|
||||
(void)obj;
|
||||
|
|
|
@ -3315,6 +3315,7 @@
|
|||
"DISCO_H747I": {
|
||||
"inherits": ["FAMILY_STM32"],
|
||||
"core": "Cortex-M7FD",
|
||||
"components_add": ["FLASHIAP"],
|
||||
"extra_labels_add": [
|
||||
"STM32H7",
|
||||
"STM32H747xI",
|
||||
|
|
Loading…
Reference in New Issue