voron

experimental ARM OS
git clone git://git.2f30.org/voron
Log | Files | Refs | README | LICENSE

commit 2bf2a91ce6744f0384a41f57d3183927f4b160f1
parent 069f381c4c6cb4ffb994f2afaa53a5268c195372
Author: oblique <psyberbits@gmail.com>
Date:   Tue, 10 Jul 2012 18:05:37 +0300

better way to link kernel.bin in usbbootImage

Diffstat:
M.gitignore | 1-
MMakefile | 11++++++-----
Mkernel/interrupts.S | 5+++++
Musbboot/usbboot.ld | 7+++++--
4 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -9,4 +9,3 @@ /kernel.syms /uImage /usbbootImage -/usbboot/kernel_image.ld diff --git a/Makefile b/Makefile @@ -10,6 +10,7 @@ ASFLAGS = -march=armv7-r -ggdb -nostdlib -nostdinc -nodefaultlibs \ -nostartfiles -fno-builtin $(INC) LIBGCC = -L $(shell dirname $(shell $(CC) $(CFLAGS) -print-libgcc-file-name)) -lgcc CC = $(CROSS_COMPILE)gcc +LD = $(CROSS_COMPILE)ld OBJCOPY = $(CROSS_COMPILE)objcopy NM = $(CROSS_COMPILE)nm @@ -17,7 +18,7 @@ objs = kernel/start.o kernel/kmain.o kernel/rs232.o kernel/print.o \ kernel/debug.o kernel/interrupts.o kernel/syscall_table.o \ kernel/syscalls.o -all: kernel.elf kernel.bin kernel.syms uImage usbbootImage +all: uImage usbbootImage kernel.syms kernel.elf: $(objs) kernel/linker.ld @echo -e " LD\t$@" @@ -32,7 +33,7 @@ kernel.syms: kernel.elf uImage: kernel.bin @mkimage -A arm -T kernel -C none -a 0x80008000 -e 0x80008000 -n Voron -d $< $@ -usbbootImage: usbboot/usbboot.o usbboot/usbboot.ld usbboot/kernel_image.ld +usbbootImage: usbboot/usbboot.o usbboot/usbboot.ld usbboot/kernel_image.o @echo "Creating $@" @echo -e "Entry Point: 0x82000000" @$(CC) -T usbboot/usbboot.ld -nostdlib -nostdinc -nodefaultlibs -nostartfiles \ @@ -41,8 +42,8 @@ usbbootImage: usbboot/usbboot.o usbboot/usbboot.ld usbboot/kernel_image.ld @rm -f __$@ @echo "Done" -usbboot/kernel_image.ld: kernel.bin - @hexdump -v -e '"BYTE(0x" 1/1 "%02X" ")\n"' $< > $@ +usbboot/kernel_image.o: kernel.bin + @$(LD) -r -b binary -o $@ $< %.o: %.c @echo -e " CC\t$<" @@ -54,4 +55,4 @@ usbboot/kernel_image.ld: kernel.bin clean: @rm -f $(objs) kernel.elf kernel.bin kernel.syms uImage usbbootImage \ - usbboot/kernel_image.ld usbboot/usbboot.o + usbboot/kernel_image.o usbboot/usbboot.o diff --git a/kernel/interrupts.S b/kernel/interrupts.S @@ -10,6 +10,7 @@ init_vector_table: bx lr + .balign 32 @ the 5 least-significant bits of VBAR are reserved (i.e. 32 bytes alignment) vector_table: ldr pc, =reset @@ -26,6 +27,7 @@ vector_table: reset: b . + undefined_insn: movs pc, lr @@ -59,9 +61,11 @@ swi_ex: prefetch_abort: subs pc, lr, #4 + data_abort: subs pc, lr, #8 + irq_ex: sub lr, lr, #4 stmfd sp!, { lr } @@ -69,6 +73,7 @@ irq_ex: bl set_led_d1 ldmfd sp!, { pc }^ + fiq_ex: sub lr, lr, #4 stmfd sp!, { lr } diff --git a/usbboot/usbboot.ld b/usbboot/usbboot.ld @@ -6,11 +6,14 @@ SECTIONS .text 0x82000000 : { usbboot/usbboot.o (.text) + } + .image : ALIGN(4) + { _image_start = .; - INCLUDE "usbboot/kernel_image.ld"; - _image_end = .; + usbboot/usbboot.o (.data) } + _image_end = .; . = ALIGN(4); _usbboot_stack_top = . + 0x1000;