aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile12
1 files changed, 11 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index ce29a19..f07bced 100644
--- a/Makefile
+++ b/Makefile
@@ -3,6 +3,10 @@ ELFFLAGS=-ffreestanding -O2 -nostdlib -lgcc -I.
ARM_OBJECTS=kernel.o paging.o demo_functionality.o PL0_test.o uart.o loader_stage1.o loader_stage2.o
+EMBEDDABLE_OBJECTS=PL_0_test_embeddable.o loader_stage2_embeddable.o
+
+RENAME_FLAGS=--rename-section .data=.renamed_data --rename-section .rodata=.renamed_rodata --rename-section .text=.renamed_text --rename-section .bss=.renamed_bss
+
all : kernel7.img
%.o : %.c
@@ -17,10 +21,16 @@ all : kernel7.img
%_embeddable.o : %.img
arm-none-eabi-objcopy -I binary -O elf32-littlearm -B arm --rename-section .data=.rodata $^ $@
+libkernel.o : libkernel.c
+ arm-none-eabi-gcc $(CFLAGS) -fPIC -c $^ -o $@
+
+libkernel_renamed.o : libkernel.o
+ arm-none-eabi-objcopy $(RENAME_FLAGS) $^ $@
+
PL_0_test.elf : PL0_test.o uart.o
arm-none-eabi-gcc -T PL0_test.ld -o $@ $(ELFFLAGS) $^
-kernel.elf : boot.o kernel.o uart.o PL_0_test_embeddable.o demo_functionality.o paging.o
+kernel.elf : boot.o kernel.o uart.o PL_0_test_embeddable.o demo_functionality.o paging.o libkernel_renamed.o
arm-none-eabi-gcc -T linker.ld -o $@ $(ELFFLAGS) $^
loader_stage2.elf : loader_stage2.o uart.o