adapt flash size to libopencm3 update
This commit is contained in:
parent
3577f1a0f4
commit
f7b99dd76c
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -234,7 +234,7 @@ static enum usbd_request_return_codes usb_dfu_control_request(usbd_device *usbd_
|
|||
// application data is exceeding enforced flash size for application
|
||||
usb_dfu_status = DFU_STATUS_ERR_ADDRESS;
|
||||
usb_dfu_state = STATE_DFU_ERROR;
|
||||
} else if ((uint32_t)&__application_end < FLASH_BASE && (uint32_t)&__application_beginning + download_offset + download_length >= (uint32_t)(FLASH_BASE + DESIG_FLASH_SIZE * 1024)) {
|
||||
} else if ((uint32_t)&__application_end < FLASH_BASE && (uint32_t)&__application_beginning + download_offset + download_length >= (uint32_t)(FLASH_BASE + desig_get_flash_size() * 1024)) {
|
||||
// application data is exceeding advertised flash size
|
||||
usb_dfu_status = DFU_STATUS_ERR_ADDRESS;
|
||||
usb_dfu_state = STATE_DFU_ERROR;
|
||||
|
|
Loading…
Reference in New Issue