implement suggested changes
- update FLASH_FIRMWARE length - use linker script define value
This commit is contained in:
parent
205837c47b
commit
527b11f99e
|
@ -31,6 +31,8 @@
|
|||
#include "py/runtime.h"
|
||||
#include "src/rp2_common/hardware_flash/include/hardware/flash.h"
|
||||
|
||||
extern uint32_t __flash_binary_start;
|
||||
|
||||
uint32_t common_hal_nvm_bytearray_get_length(nvm_bytearray_obj_t* self) {
|
||||
return self->len;
|
||||
}
|
||||
|
@ -39,12 +41,12 @@ static void write_page(uint32_t page_addr, uint32_t offset, uint32_t len, uint8_
|
|||
// Write a whole page to flash, buffering it first and then erasing and rewriting
|
||||
// it since we can only clear a whole page at a time.
|
||||
if (offset == 0 && len == FLASH_PAGE_SIZE) {
|
||||
flash_range_program(page_addr - 0x10000000, bytes, FLASH_PAGE_SIZE);
|
||||
flash_range_program(page_addr - (uint32_t) &__flash_binary_start, bytes, FLASH_PAGE_SIZE);
|
||||
} else {
|
||||
uint8_t buffer[FLASH_PAGE_SIZE];
|
||||
memcpy(buffer, (uint8_t*) page_addr, FLASH_PAGE_SIZE);
|
||||
memcpy(buffer + offset, bytes, len);
|
||||
flash_range_program(page_addr - 0x10000000, buffer, FLASH_PAGE_SIZE);
|
||||
flash_range_program(page_addr - (uint32_t) &__flash_binary_start, buffer, FLASH_PAGE_SIZE);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
MEMORY
|
||||
{
|
||||
FLASH_FIRMWARE (rx) : ORIGIN = 0x10000000, LENGTH = 1024k
|
||||
FLASH_FIRMWARE (rx) : ORIGIN = 0x10000000, LENGTH = 1020k
|
||||
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 256k
|
||||
SCRATCH_X (rwx) : ORIGIN = 0x20040000, LENGTH = 4k
|
||||
SCRATCH_Y (rwx) : ORIGIN = 0x20041000, LENGTH = 4k
|
||||
|
|
Loading…
Reference in New Issue