From 1ad397ff59b0860a7aa2372f79ff757b4e22f08b Mon Sep 17 00:00:00 2001 From: Gunar Schorcht Date: Sun, 19 Mar 2023 16:37:56 +0100 Subject: [PATCH] cpu/riscv_common: add riotboot linker support --- cpu/riscv_common/Makefile.include | 4 ++++ cpu/riscv_common/ldscripts/riscv.ld | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/cpu/riscv_common/Makefile.include b/cpu/riscv_common/Makefile.include index d21f1baef6..632fd46125 100644 --- a/cpu/riscv_common/Makefile.include +++ b/cpu/riscv_common/Makefile.include @@ -14,6 +14,10 @@ ifneq (,$(ROM_START_ADDR)$(RAM_START_ADDR)$(ROM_LEN)$(RAM_LEN)) LINKFLAGS += $(LINKFLAGPREFIX)--defsym=_ram_start_addr=$(RAM_START_ADDR) LINKFLAGS += $(LINKFLAGPREFIX)--defsym=_rom_length=$(ROM_LEN) LINKFLAGS += $(LINKFLAGPREFIX)--defsym=_ram_length=$(RAM_LEN) + LINKFLAGS += $(if $(ROM_OFFSET),$(LINKFLAGPREFIX)--defsym=_rom_offset=$(ROM_OFFSET) \ + ,$(LINKFLAGPREFIX)--defsym=_rom_offset=0x0) + LINKFLAGS += $(if $(FW_ROM_LEN),$(LINKFLAGPREFIX)--defsym=_fw_rom_length=$(FW_ROM_LEN) \ + ,$(LINKFLAGPREFIX)--defsym=_fw_rom_length=$(ROM_LEN)) endif ifneq (,$(ITIM_START_ADDR)) diff --git a/cpu/riscv_common/ldscripts/riscv.ld b/cpu/riscv_common/ldscripts/riscv.ld index 72f9731c7e..8c9d78a9c4 100644 --- a/cpu/riscv_common/ldscripts/riscv.ld +++ b/cpu/riscv_common/ldscripts/riscv.ld @@ -22,7 +22,7 @@ INCLUDE riscv_vars.ld MEMORY { - flash (rxai!w) : ORIGIN = _rom_start_addr, LENGTH = _rom_length + flash (rxai!w) : ORIGIN = _rom_start_addr + _rom_offset, LENGTH = _fw_rom_length ram (wxa!ri) : ORIGIN = _ram_start_addr, LENGTH = _ram_length itim (wxa!ri) : ORIGIN = _itim_start_addr, LENGTH = _itim_length }