|
|
|
@ -37,7 +37,7 @@ static void flash_internal_init(void) |
|
|
|
|
if ((uint32_t)&__flash_end >= FLASH_BASE) { |
|
|
|
|
flash_internal_end = (uint32_t)&__flash_end; |
|
|
|
|
} else { |
|
|
|
|
flash_internal_end = FLASH_BASE + DESIG_FLASH_SIZE * 1024; |
|
|
|
|
flash_internal_end = FLASH_BASE + desig_get_flash_size() * 1024; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -70,7 +70,7 @@ static bool flash_internal_range(uint32_t address, size_t size) |
|
|
|
|
uint16_t flash_internal_page_size(void) |
|
|
|
|
{ |
|
|
|
|
if (0 == flash_internal_page) { // we don't know the page size yet
|
|
|
|
|
if (DESIG_FLASH_SIZE < 256) { |
|
|
|
|
if (desig_get_flash_size() < 256) { |
|
|
|
|
if ((*(uint32_t*)0x1FFFF000 & 0xFFFE0000) == 0x20000000) { // non-connectivity system memory start detected (MSP address pointing to SRAM
|
|
|
|
|
flash_internal_page = 1024; |
|
|
|
|
} else { // connectivity system memory start is at 0x1FFFB000
|
|
|
|
@ -224,7 +224,7 @@ void flash_internal_eeprom_setup(uint16_t pages) |
|
|
|
|
|
|
|
|
|
flash_internal_eeprom_start = 0; // reset start address
|
|
|
|
|
flash_internal_eeprom_address = 0; // reset EEPROM address
|
|
|
|
|
if (pages > DESIG_FLASH_SIZE * 1024 / flash_internal_page) { // not enough pages are available
|
|
|
|
|
if (pages > desig_get_flash_size() * 1024 / flash_internal_page) { // not enough pages are available
|
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
flash_internal_eeprom_start = flash_internal_end - flash_internal_page * pages; // set EEPROM start (page aligned)
|
|
|
|
@ -313,7 +313,7 @@ uint32_t flash_internal_probe_read_size(void) |
|
|
|
|
|
|
|
|
|
uint32_t flash_internal_probe_write_size(void) |
|
|
|
|
{ |
|
|
|
|
if (0 == DESIG_FLASH_SIZE) { // no flash size advertised
|
|
|
|
|
if (0 == desig_get_flash_size()) { // no flash size advertised
|
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -324,7 +324,7 @@ uint32_t flash_internal_probe_write_size(void) |
|
|
|
|
// prepare for writing the flash
|
|
|
|
|
flash_unlock(); // unlock flash to be able to write it
|
|
|
|
|
// try reading and writing the flash, page per page
|
|
|
|
|
uint32_t start = FLASH_BASE + DESIG_FLASH_SIZE * 1024; // start with the end of the advertised flash
|
|
|
|
|
uint32_t start = FLASH_BASE + desig_get_flash_size() * 1024; // start with the end of the advertised flash
|
|
|
|
|
if ((uint32_t)&__flash_end >= FLASH_BASE) { // use linker flash size if provided
|
|
|
|
|
start = (uint32_t)&__flash_end; |
|
|
|
|
} |
|
|
|
|