mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
Koen Zandberg
32399901f0
Similar to the cortex-m common linker scripts, the RISC-V linker scripts can be unified easily, requiring only the memory addresses and lengths. This simplifies adding new RISC-V CPU's later
35 lines
1.2 KiB
Makefile
35 lines
1.2 KiB
Makefile
CFLAGS += -Wno-pedantic
|
|
|
|
RAM_START_ADDR ?= 0x80000000
|
|
RAM_LEN ?= 16K
|
|
|
|
ifeq ($(CPU_MODEL), fe310_g000)
|
|
ROM_START_ADDR ?= 0x20400000
|
|
ROM_LEN ?= 0x1fc00000
|
|
else ifeq ($(CPU_MODEL), fe310_g002)
|
|
ROM_START_ADDR ?= 0x20010000
|
|
ROM_LEN ?= 0x0006a120
|
|
endif
|
|
|
|
# All variables must be defined in the CPU configuration when using the common
|
|
# `ldscripts/fe310.ld`
|
|
ifneq (,$(ROM_START_ADDR)$(RAM_START_ADDR)$(ROM_LEN)$(RAM_LEN))
|
|
$(if $(ROM_START_ADDR),,$(error ROM_START_ADDR is not defined))
|
|
$(if $(RAM_START_ADDR),,$(error RAM_START_ADDR is not defined))
|
|
$(if $(ROM_LEN),,$(error ROM_LEN is not defined))
|
|
$(if $(RAM_LEN),,$(error RAM_LEN is not defined))
|
|
LINKFLAGS += $(LINKFLAGPREFIX)--defsym=_rom_start_addr=$(ROM_START_ADDR)
|
|
LINKFLAGS += $(LINKFLAGPREFIX)--defsym=_ram_start_addr=$(RAM_START_ADDR)
|
|
LINKFLAGS += $(LINKFLAGPREFIX)--defsym=_rom_length=$(ROM_LEN)
|
|
LINKFLAGS += $(LINKFLAGPREFIX)--defsym=_ram_length=$(RAM_LEN)
|
|
endif
|
|
|
|
ifneq (,$(ITIM_START_ADDR))
|
|
LINKFLAGS += $(LINKFLAGPREFIX)--defsym=_itim_start_addr=$(ITIM_START_ADDR)
|
|
LINKFLAGS += $(LINKFLAGPREFIX)--defsym=_itim_length=$(ITIM_LEN)
|
|
endif
|
|
|
|
LINKER_SCRIPT ?= fe310.ld
|
|
|
|
include $(RIOTMAKE)/arch/riscv.inc.mk
|