1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-17 04:52:59 +01:00

cpu/lpc23xx: extend flashpage API

This commit is contained in:
Ollrogge 2021-10-19 09:35:26 +02:00
parent 3a11b1fbd2
commit 4fa25af86c
2 changed files with 25 additions and 0 deletions

View File

@ -204,6 +204,10 @@ SECTIONS
_sram = ORIGIN(ram);
_eram = ORIGIN(ram) + LENGTH(ram);
/* Populate information about rom size */
_srom = ORIGIN(rom);
_erom = ORIGIN(rom) + LENGTH(rom);
.heap1 ALIGN(4) (NOLOAD) :
{
_sheap1 = ORIGIN(ram_ethernet);
@ -243,4 +247,8 @@ SECTIONS
_sheap3 = . ;
_eheap3 = ORIGIN(ram_battery) + LENGTH(ram_battery);
} > ram_battery
.end_fw (NOLOAD) : ALIGN(4) {
_end_fw = . ;
} > rom
}

View File

@ -34,6 +34,13 @@
typedef void (*IAP)(unsigned int[], unsigned int[]);
static const IAP IAP_Entry = (IAP)0x7ffffff1;
/**
* @brief Memory markers, defined in the linker script
* @{
*/
extern uint32_t _end_fw;
extern uint32_t _erom;
static uint32_t iap(uint32_t code, uint32_t p1, uint32_t p2, uint32_t p3, uint32_t p4)
{
/* contains parameters for IAP command */
@ -251,3 +258,13 @@ void flashpage_write(void *target_addr, const void *data, size_t len)
DEBUG("ERROR: COPY_RAM_TO_FLASH: %u\n", err);
}
}
unsigned flashpage_first_free(void)
{
return flashpage_page(&_end_fw) + 1;
}
unsigned flashpage_last_free(void)
{
return flashpage_page(&_erom) - 1;
}