Skip to content

Commit

Permalink
Fixed Makefile and kernel.ld
Browse files Browse the repository at this point in the history
Built the kernel.img, kernel.list and kernel.map
Added .gitignore
  • Loading branch information
apinsard committed Oct 16, 2014
1 parent 2bd9c26 commit acb769f
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 9 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
build/
*.sw[po]
17 changes: 10 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
Binary file added kernel.img
Binary file not shown.
2 changes: 1 addition & 1 deletion kernel.ld
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ SECTIONS {
*(.init)
}

/DISCARD/: {
/DISCARD/ : {
*(*)
}
}
Expand Down
17 changes: 17 additions & 0 deletions kernel.list
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

build/output.elf: file format elf32-littlearm

Disassembly of section .init:

00008000 <_start>:
8000: e59f0018 ldr r0, [pc, #24] ; 8020 <loop$+0x4>
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 <loop$>:
801c: eafffffe b 801c <loop$>
8020: 20200000 .word 0x20200000
32 changes: 32 additions & 0 deletions kernel.map
Original file line number Diff line number Diff line change
@@ -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)
2 changes: 1 addition & 1 deletion src/main.s
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Distributed under the terms of the GNU General Public License v2
.section .init
.glob _start
.globl _start

_start:

Expand Down

0 comments on commit acb769f

Please sign in to comment.