mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
cpu/msp430_common: extend flashpage API
This commit is contained in:
parent
d38f6c68b5
commit
741943f021
18
cpu/msp430_common/ldscripts/msp430_common.ld
Normal file
18
cpu/msp430_common/ldscripts/msp430_common.ld
Normal file
@ -0,0 +1,18 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Freie Universität Berlin
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU Lesser
|
||||
* General Public License v2.1. See the file LICENSE in the top level
|
||||
* directory for more details.
|
||||
*/
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
/* Populate information about rom size */
|
||||
_srom = ORIGIN(ROM);
|
||||
_erom = ORIGIN(ROM) + LENGTH(ROM);
|
||||
|
||||
.end_fw (NOLOAD) : ALIGN(4) {
|
||||
_end_fw = . ;
|
||||
} > ROM
|
||||
}
|
@ -26,6 +26,13 @@
|
||||
#include "irq.h"
|
||||
#include "periph/flashpage.h"
|
||||
|
||||
/**
|
||||
* @brief Memory markers, defined in the linker script
|
||||
* @{
|
||||
*/
|
||||
extern uint32_t _end_fw;
|
||||
extern uint32_t _erom;
|
||||
|
||||
static inline int _unlock(void)
|
||||
{
|
||||
int state;
|
||||
@ -97,3 +104,15 @@ void flashpage_write(void *target_addr, const void *data, size_t len)
|
||||
/* lock flash and re-enable interrupts */
|
||||
_lock(state);
|
||||
}
|
||||
|
||||
unsigned flashpage_first_free(void)
|
||||
{
|
||||
return flashpage_page(&_end_fw) + 1;
|
||||
}
|
||||
|
||||
/* MSP430 cpu's last page holds the interrupt vector, so flashpage_last_free
|
||||
is the one before last */
|
||||
unsigned flashpage_last_free(void)
|
||||
{
|
||||
return flashpage_page(&_erom) - 1;
|
||||
}
|
||||
|
@ -16,6 +16,7 @@ ASFLAGS += $(CFLAGS_CPU) --defsym $(CPU_MODEL)=1 $(CFLAGS_DBG)
|
||||
LINKFLAGS += $(CFLAGS_CPU) $(CFLAGS_DBG) $(CFLAGS_OPT)
|
||||
LINKFLAGS += -Wl,--gc-sections -Wl,-L$(MSP430_SUPPORT_FILES)/include
|
||||
LINKFLAGS += -T $(MSP430_SUPPORT_FILES)/include/$(CPU_MODEL).ld
|
||||
LINKFLAGS += -T $(RIOTCPU)/msp430_common/ldscripts/msp430_common.ld
|
||||
LINKFLAGS += $(RIOTCPU)/msp430_common/ldscripts/xfa.ld
|
||||
|
||||
OPTIONAL_CFLAGS_BLACKLIST += -fdiagnostics-color
|
||||
|
Loading…
Reference in New Issue
Block a user