From acb769f1865a57d2e527d36d946d404e2be7bf67 Mon Sep 17 00:00:00 2001 From: Antoine Pinsard Date: Thu, 16 Oct 2014 18:54:15 +0200 Subject: [PATCH] Fixed Makefile and kernel.ld Built the kernel.img, kernel.list and kernel.map Added .gitignore --- .gitignore | 2 ++ Makefile | 17 ++++++++++------- kernel.img | Bin 0 -> 36 bytes kernel.ld | 2 +- kernel.list | 17 +++++++++++++++++ kernel.map | 32 ++++++++++++++++++++++++++++++++ src/main.s | 2 +- 7 files changed, 63 insertions(+), 9 deletions(-) create mode 100644 .gitignore create mode 100755 kernel.img create mode 100644 kernel.list create mode 100644 kernel.map diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6ff0c00 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +build/ +*.sw[po] diff --git a/Makefile b/Makefile index f3f8abe..f134851 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,8 @@ # Distributed under the terms of the GNU General Public License v2 -CC ?= arm-none-eabi -LD ?= $(CC)-ld -AS ?= $(CC)-as +ARMGNU ?= arm-none-eabi +ARMLD ?= $(ARMGNU)-ld +ARMAS ?= $(ARMGNU)-as BUILD = build SOURCE = src @@ -15,17 +15,20 @@ OBJECTS := $(patsubst $(SOURCE)/%.s,$(BUILD)/%.o,$(wildcard $(SOURCE)/*.s)) all: $(TARGET) $(LIST) +test: + echo $(ARMGNU) + $(LIST): $(BUILD)/output.elf - $(CC)-objdump -d $< > $@ + $(ARMGNU)-objdump -d $< > $@ $(TARGET): $(BUILD)/output.elf - $(CC)-objcopy $< -O binary $@ + $(ARMGNU)-objcopy $< -O binary $@ $(BUILD)/output.elf: $(OBJECTS) $(LINKER) - $(LD) --no-undefined $< -Map $(MAP) -o $@ -T $(LINKER) + $(ARMLD) --no-undefined $< -Map $(MAP) -o $@ -T $(LINKER) $(BUILD)/%.o: $(SOURCE)/%.s - $(AS) -I $(SOURCE) $< -o $@ + $(ARMAS) -I $(SOURCE) $< -o $@ clean: rm -f $(BUILD)/*.o diff --git a/kernel.img b/kernel.img new file mode 100755 index 0000000000000000000000000000000000000000..83ca2f42315f5882660cfb4d19fd16f288251a48 GIT binary patch literal 36 ncmb1OnE#YfV8LTX$psHt1R5Z0i3JZefb4(&|G#2jP*4B>2mB8< literal 0 HcmV?d00001 diff --git a/kernel.ld b/kernel.ld index fa59282..841a082 100644 --- a/kernel.ld +++ b/kernel.ld @@ -6,7 +6,7 @@ SECTIONS { *(.init) } - /DISCARD/: { + /DISCARD/ : { *(*) } } diff --git a/kernel.list b/kernel.list new file mode 100644 index 0000000..25e942a --- /dev/null +++ b/kernel.list @@ -0,0 +1,17 @@ + +build/output.elf: file format elf32-littlearm + +Disassembly of section .init: + +00008000 <_start>: + 8000: e59f0018 ldr r0, [pc, #24] ; 8020 + 8004: e3a01001 mov r1, #1 ; 0x1 + 8008: e1a01901 lsl r1, r1, #18 + 800c: e5801004 str r1, [r0, #4] + 8010: e3a01001 mov r1, #1 ; 0x1 + 8014: e1a01801 lsl r1, r1, #16 + 8018: e5801028 str r1, [r0, #40] + +0000801c : + 801c: eafffffe b 801c + 8020: 20200000 .word 0x20200000 diff --git a/kernel.map b/kernel.map new file mode 100644 index 0000000..81d2d8d --- /dev/null +++ b/kernel.map @@ -0,0 +1,32 @@ + +Discarded input sections + + .text 0x00000000 0x0 build/main.o + .data 0x00000000 0x0 build/main.o + .bss 0x00000000 0x0 build/main.o + .ARM.attributes + 0x00000000 0x0 build/main.o + .glue_7 0x00000000 0x0 build/main.o + .glue_7t 0x00000000 0x0 build/main.o + .vfp11_veneer 0x00000000 0x0 build/main.o + .janus_2cc_veneer + 0x00000000 0x0 build/main.o + .v4_bx 0x00000000 0x0 build/main.o + +Memory Configuration + +Name Origin Length Attributes +*default* 0x00000000 0xffffffff + +Linker script and memory map + +LOAD build/main.o + +.init 0x00008000 0x24 + *(.init) + .init 0x00008000 0x24 build/main.o + 0x00008000 _start + +/DISCARD/ + *(*) +OUTPUT(build/output.elf elf32-littlearm) diff --git a/src/main.s b/src/main.s index 6857371..e2192b8 100644 --- a/src/main.s +++ b/src/main.s @@ -1,6 +1,6 @@ # Distributed under the terms of the GNU General Public License v2 .section .init -.glob _start +.globl _start _start: