mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
cpu/gd32v: add riotboot support
This commit is contained in:
parent
1ad397ff59
commit
f6cb8b99e6
@ -1,8 +1,37 @@
|
||||
RAM_START_ADDR ?= 0x20000000
|
||||
RAM_LEN ?= 32K
|
||||
|
||||
ROM_START_ADDR ?= 0x08000000
|
||||
ROM_LEN ?= 128K
|
||||
|
||||
ifneq (,$(filter gd32vf103%bt6 gd32vf103%bu6,$(CPU_MODEL)))
|
||||
RAM_LEN ?= 32K
|
||||
ROM_LEN ?= 128K
|
||||
else ifneq (,$(filter gd32vf103%8t6 gd32vf103%8u6,$(CPU_MODEL)))
|
||||
RAM_LEN ?= 20K
|
||||
ROM_LEN ?= 64K
|
||||
else ifneq (,$(filter gd32vf103%6t6 gd32vf103%6u6,$(CPU_MODEL)))
|
||||
RAM_LEN ?= 10K
|
||||
ROM_LEN ?= 32K
|
||||
else ifneq (,$(filter gd32vf103%4t6 gd32vf103%4u6,$(CPU_MODEL)))
|
||||
RAM_LEN ?= 6K
|
||||
ROM_LEN ?= 16K
|
||||
else
|
||||
$(error CPU model $(CPU_MODEL) not supported)
|
||||
endif
|
||||
|
||||
FW_ROM_LEN ?= $(shell printf "0x%x" $$(($(ROM_LEN:%K=%*1024))))
|
||||
|
||||
RIOTBOOT_HDR_LEN ?= 0x400
|
||||
ifneq (,$(filter usbus_dfu tinyusb_dfu,$(USEMODULE)))
|
||||
RIOTBOOT_LEN ?= 0x4000
|
||||
else
|
||||
RIOTBOOT_LEN ?= 0x1000
|
||||
endif
|
||||
|
||||
NUM_SLOTS ?= 2
|
||||
|
||||
SLOT0_LEN ?= $(shell printf "0x%x" $$((($(ROM_LEN:%K=%*1024)-$(RIOTBOOT_LEN)) / $(NUM_SLOTS))))
|
||||
SLOT1_LEN ?= $(SLOT0_LEN)
|
||||
SLOT0_LEN := $(SLOT0_LEN)
|
||||
SLOT1_LEN := $(SLOT1_LEN)
|
||||
|
||||
LINKER_SCRIPT ?= riscv.ld
|
||||
|
||||
|
@ -24,6 +24,23 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Returns the address of running application in flash
|
||||
*/
|
||||
static inline uint32_t cpu_get_image_baseaddr(void)
|
||||
{
|
||||
extern uint8_t _start;
|
||||
return (uint32_t)&_start;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Starts another image in flash
|
||||
*/
|
||||
static inline void cpu_jump_to_image(uint32_t addr)
|
||||
{
|
||||
__asm__ volatile ("jr %0" :: "r" (addr));
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user