1
0
mirror of https://github.com/antonblanchard/microwatt.git synced 2026-04-29 13:32:48 +00:00

sw: Add full memory map to .h and use it for litedram .lds

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
This commit is contained in:
Benjamin Herrenschmidt
2020-05-15 17:43:51 +10:00
parent bdb428a40b
commit 8d64090a68
4 changed files with 27 additions and 13 deletions

View File

@@ -26,7 +26,7 @@ CPPFLAGS += -I$(SRC_DIR)/libc/include -I$(LXSRC_DIR) -I$(LXINC_DIR) -I$(GENINC_D
CPPFLAGS += -isystem $(shell $(CC) -print-file-name=include)
CFLAGS = -Os -g -Wall -std=c99 -m64 -mabi=elfv2 -msoft-float -mno-string -mno-multiple -mno-vsx -mno-altivec -mlittle-endian -fno-stack-protector -mstrict-align -ffreestanding -fdata-sections -ffunction-sections -fno-delete-null-pointer-checks
ASFLAGS = $(CPPFLAGS) $(CFLAGS)
LDFLAGS = -static -nostdlib -Ttext-segment=0xffff0000 -T $(SRC_DIR)/$(PROGRAM).lds --gc-sections
LDFLAGS = -static -nostdlib -T $(OBJ)/$(PROGRAM).lds --gc-sections
#### Pretty print
@@ -58,13 +58,15 @@ $(OBJ)/%.o : $(SRC_DIR)/%.S
$(call Q,AS, $(CC) $(ASFLAGS) -c $< -o $@, $@)
$(OBJ)/%.o : $(SRC_DIR)/libc/src/%.c
$(call Q,CC, $(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@, $@)
$(OBJ)/%.lds : $(SRC_DIR)/%.lds.S
$(call Q,CC, $(CC) $(CPPFLAGS) -P -E $< -o $@, $@)
LIBC_SRC := $(wildcard $(SRC_DIR)/libc/src/*.c)
LIBC_OBJ := $(patsubst $(SRC_DIR)/libc/src/%.c, $(OBJ)/%.o,$(LIBC_SRC))
$(OBJ)/libc.o: $(LIBC_OBJ)
$(call Q,LD, $(LD) -r -o $@ $^, $@)
$(OBJ)/$(PROGRAM).elf: $(OBJECTS) $(OBJ)/libc.o
$(OBJ)/$(PROGRAM).elf: $(OBJECTS) $(OBJ)/libc.o $(OBJ)/$(PROGRAM).lds
$(call Q,LD, $(LD) $(LDFLAGS) -o $@ $^, $@)
$(OBJ)/$(PROGRAM).bin: $(OBJ)/$(PROGRAM).elf

View File

@@ -1,11 +1,13 @@
#include "microwatt_soc.h"
SECTIONS
{
. = 0xffff0000;
. = DRAM_INIT_BASE;
start = .;
.head : {
KEEP(*(.head))
}
. = 0xffff1000;
}
. = DRAM_INIT_BASE | 0x1000;
.text : { *(.text*) *(.sfpr) *(.rodata*) }
.data : { *(.data*) }
.bss : { *(.bss*) }