add default linker file for flash

This commit is contained in:
Eyck Jentzsch 2024-01-13 23:24:39 +01:00
parent 13cd5cc76d
commit 5e7c2cbce9
2 changed files with 7 additions and 6 deletions

6
env/common-gcc.mk vendored
View File

@ -24,10 +24,8 @@ INCLUDES += -I$(ENV_DIR)
INCLUDES += -I$(PLATFORM_DIR) INCLUDES += -I$(PLATFORM_DIR)
LDFLAGS += -march=$(RISCV_ARCH) -mabi=$(RISCV_ABI) 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) LDFLAGS += -L$(ENV_DIR)
LD_SCRIPT += -T $(LINKER_SCRIPT) -Wl,--no-warn-rwx-segments -Wl,-Map=$(TARGET).map -nostartfiles
# --specs=nano.specs # --specs=nano.specs
ASM_OBJS := $(ASM_SRCS:.S=.o) ASM_OBJS := $(ASM_SRCS:.S=.o)
@ -59,7 +57,7 @@ OBJCOPY := $(TOOL_DIR)$(TRIPLET)-objcopy
ifndef NO_DEFAULT_LINK ifndef NO_DEFAULT_LINK
$(TARGET).elf: $(LINK_OBJS) $(LINK_DEPS) $(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 $(OBJDUMP) -d -S $@ > $(TARGET).dis
endif endif

View File

@ -4,8 +4,10 @@ ENTRY( _start )
MEMORY MEMORY
{ {
flash (rxai!w) : ORIGIN = 0x20000000, LENGTH = 512M rom (rxai!w) : ORIGIN = 0xFFFFE000, LENGTH = 4k
ram (wxa!ri) : ORIGIN = 0x80000000, LENGTH = 128K flash (rxai!w) : ORIGIN = 0xE0000000, LENGTH = 4M
ram (wxa!ri) : ORIGIN = 0x80000000, LENGTH = 32K
dram (wxa!ri) : ORIGIN = 0x00000000, LENGTH = 256M
} }
PHDRS PHDRS
@ -13,6 +15,7 @@ PHDRS
flash PT_LOAD; flash PT_LOAD;
ram_init PT_LOAD; ram_init PT_LOAD;
ram PT_NULL; ram PT_NULL;
dram PT_NULL;
} }
SECTIONS SECTIONS