aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorWojtek Kosior <kwojtus@protonmail.com>2019-12-02 16:37:22 +0100
committerWojtek Kosior <kwojtus@protonmail.com>2019-12-02 16:37:22 +0100
commit401bf03070458cf3a5ee6947bd01a8f397fe2909 (patch)
tree568efb820ccf996118546108e98566584a3a904f /Makefile
parent4b530611e8cd1a342a7e4461ac002cf715da26b3 (diff)
downloadrpi-MMU-example-401bf03070458cf3a5ee6947bd01a8f397fe2909.tar.gz
rpi-MMU-example-401bf03070458cf3a5ee6947bd01a8f397fe2909.zip
create a separate library for kernel code that should run in PL0 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