Add linkerscript (experimental)

This commit is contained in:
Suguru Saito
2021-12-14 01:01:31 +09:00
parent 82afb1d9cc
commit 2323505be7
4 changed files with 127 additions and 0 deletions

31
x1/linkerscript/Makefile Normal file
View File

@@ -0,0 +1,31 @@
CROSS_COMPILE := arm-linux-gnueabihf-
AS := $(CROSS_COMPILE)as
CC := $(CROSS_COMPILE)gcc
LD := $(CROSS_COMPILE)ld
OBJCOPY := $(CROSS_COMPILE)objcopy
TARGET := AppMain
OBJS := crt0.o main.o
ASFLAGS := -W
CFLAGS := -Wall -ffreestanding -fomit-frame-pointer -Os
LDFLAGS := -T x1.ld
.PHONY:
all: $(TARGET).bin
.PHONY:
clean:
-rm -f $(TARGET).bin $(TARGET).elf $(OBJS)
%.o: %.s
$(AS) $(ASFLAGS) $< -o $@
%.o: %.c
$(CC) -c $(CFLAGS) $<
$(TARGET).elf: $(OBJS)
$(LD) $(LDFLAGS) $^ -o $@
$(TARGET).bin: $(TARGET).elf
$(OBJCOPY) -O binary $< $@