Merge pull request #11619 from JanneKiiskila/FlashIAP_DISCO_H747

Add FLASHIAP component to DISCO_H747
pull/11777/head
Martin Kojtal 2019-10-30 15:58:49 +01:00 committed by GitHub
commit cbf9f0650b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 32 additions and 0 deletions

View File

@ -20,6 +20,9 @@
"NUCLEO_F429ZI": {
"storage_type": "TDB_INTERNAL"
},
"DISCO_H747I": {
"storage_type": "TDB_INTERNAL"
},
"UBLOX_EVK_ODIN_W2": {
"storage_type": "TDB_INTERNAL"
},

View File

@ -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"

View File

@ -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;

View File

@ -3315,6 +3315,7 @@
"DISCO_H747I": {
"inherits": ["FAMILY_STM32"],
"core": "Cortex-M7FD",
"components_add": ["FLASHIAP"],
"extra_labels_add": [
"STM32H7",
"STM32H747xI",