From 5e7c2cbce97f66c0054333fb909bd79f4fe51b09 Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Sat, 13 Jan 2024 23:24:39 +0100 Subject: [PATCH] add default linker file for flash --- env/common-gcc.mk | 6 ++---- env/ehrenberg/{link.lds => flash.lds} | 7 +++++-- 2 files changed, 7 insertions(+), 6 deletions(-) rename env/ehrenberg/{link.lds => flash.lds} (94%) diff --git a/env/common-gcc.mk b/env/common-gcc.mk index a74fb24..92ebf02 100644 --- a/env/common-gcc.mk +++ b/env/common-gcc.mk @@ -24,10 +24,8 @@ INCLUDES += -I$(ENV_DIR) INCLUDES += -I$(PLATFORM_DIR) LDFLAGS += -march=$(RISCV_ARCH) -mabi=$(RISCV_ABI) -ifndef NO_DEFAULT_LINK -LDFLAGS += -T $(LINKER_SCRIPT) -Wl,--no-warn-rwx-segments -Wl,-Map=$(TARGET).map -nostartfiles -endif LDFLAGS += -L$(ENV_DIR) +LD_SCRIPT += -T $(LINKER_SCRIPT) -Wl,--no-warn-rwx-segments -Wl,-Map=$(TARGET).map -nostartfiles # --specs=nano.specs ASM_OBJS := $(ASM_SRCS:.S=.o) @@ -59,7 +57,7 @@ OBJCOPY := $(TOOL_DIR)$(TRIPLET)-objcopy ifndef NO_DEFAULT_LINK $(TARGET).elf: $(LINK_OBJS) $(LINK_DEPS) - $(LD) $(LINK_OBJS) $(LDFLAGS) $(LIBWRAP) -o $@ + $(LD) $(LINK_OBJS) $(LDFLAGS) $(LIBWRAP) $(LD_SCRIPT) -o $@ $(OBJDUMP) -d -S $@ > $(TARGET).dis endif diff --git a/env/ehrenberg/link.lds b/env/ehrenberg/flash.lds similarity index 94% rename from env/ehrenberg/link.lds rename to env/ehrenberg/flash.lds index 171d847..22941d7 100644 --- a/env/ehrenberg/link.lds +++ b/env/ehrenberg/flash.lds @@ -4,8 +4,10 @@ ENTRY( _start ) MEMORY { - flash (rxai!w) : ORIGIN = 0x20000000, LENGTH = 512M - ram (wxa!ri) : ORIGIN = 0x80000000, LENGTH = 128K + rom (rxai!w) : ORIGIN = 0xFFFFE000, LENGTH = 4k + flash (rxai!w) : ORIGIN = 0xE0000000, LENGTH = 4M + ram (wxa!ri) : ORIGIN = 0x80000000, LENGTH = 32K + dram (wxa!ri) : ORIGIN = 0x00000000, LENGTH = 256M } PHDRS @@ -13,6 +15,7 @@ PHDRS flash PT_LOAD; ram_init PT_LOAD; ram PT_NULL; + dram PT_NULL; } SECTIONS