commit abcaf464d3b173bd226284a8c9b9776d9e744540
parent 2bf2a91ce6744f0384a41f57d3183927f4b160f1
Author: oblique <psyberbits@gmail.com>
Date: Wed, 11 Jul 2012 06:07:05 +0300
fix some bugs in linker scripts
Diffstat:
5 files changed, 19 insertions(+), 9 deletions(-)
diff --git a/Makefile b/Makefile
@@ -35,7 +35,8 @@ uImage: kernel.bin
usbbootImage: usbboot/usbboot.o usbboot/usbboot.ld usbboot/kernel_image.o
@echo "Creating $@"
- @echo -e "Entry Point: 0x82000000"
+ @echo "Entry Point: 0x82000000"
+ @echo "Load Image: 0x80008000"
@$(CC) -T usbboot/usbboot.ld -nostdlib -nostdinc -nodefaultlibs -nostartfiles \
-fno-builtin -o __$@ $<
@$(OBJCOPY) __$@ -O binary $@
diff --git a/kernel/kmain.c b/kernel/kmain.c
@@ -3,4 +3,7 @@
void kmain(void) {
kprintf("voron initial stage\n");
+
+ while (1)
+ asm volatile("wfi");
}
diff --git a/kernel/linker.ld b/kernel/linker.ld
@@ -26,7 +26,11 @@ SECTIONS
*(.bss)
}
- _svc_stack_top = . + 0x2000;
- _fiq_stack_top = . + 0x2000;
- _irq_stack_top = . + 0x2000;
+ . = ALIGN(4096);
+ . = . + 0x2000;
+ _svc_stack_top = .;
+ . = . + 0x2000;
+ _fiq_stack_top = .;
+ . = . + 0x2000;
+ _irq_stack_top = .;
}
diff --git a/usbboot/usbboot.S b/usbboot/usbboot.S
@@ -4,10 +4,10 @@ _start:
ldr sp, =_usbboot_stack_top
stmfd sp!, { r0 - r12 }
- /* copy kernel image at 0x80008000 */
+ /* copy kernel image at _image_load_addr */
ldr r0, =_image_start
ldr r1, =_image_end
- ldr r2, =0x80008000
+ ldr r2, =_image_load_addr
.L1:
ldmia r0!, { r3 - r12 }
@@ -16,4 +16,4 @@ _start:
blo .L1
ldmfd sp!, { r0 - r12 }
- ldr pc, =0x80008000 @ jump to 0x80008000
+ ldr pc, =_image_load_addr @ jump to _image_load_addr
diff --git a/usbboot/usbboot.ld b/usbboot/usbboot.ld
@@ -3,6 +3,8 @@ OUTPUT_ARCH(arm)
ENTRY(_start)
SECTIONS
{
+ _image_load_addr = 0x80008000;
+
.text 0x82000000 :
{
usbboot/usbboot.o (.text)
@@ -11,10 +13,10 @@ SECTIONS
.image : ALIGN(4)
{
_image_start = .;
- usbboot/usbboot.o (.data)
+ usbboot/kernel_image.o (.data)
}
+ . = ALIGN(4);
_image_end = .;
- . = ALIGN(4);
_usbboot_stack_top = . + 0x1000;
}