use r0 to pass in the vector table address, and use a function in program.
> ls -l
total 7
-rw-r--r-- 1 root root 518 Mar 27 14:26 arm.ldscript
-rw-r--r-- 1 root root 767 Mar 27 14:18 init.S
-rw-r--r-- 1 root root 1832 Mar 27 15:08 main.c
-rw-r--r-- 1 root root 1402 Mar 27 15:02 Makefile
-rw-r--r-- 1 root root 84 Mar 27 14:27 README
> nl README
1 HOW TODO?
2 1. make
3 2. load bootload in arm simulate
4 <iyacht#gmail.com>
> nl Makefile
1 #
2 # Makefile: Makefile for bootup logo demonstration program.
3 #
4 # (c) Copyright ABC Ltd. 2007. All rights reserved.
5 #
6
7 CFLAGS = -Wall -g -nostdlib
8 bootload: bmain.o binit.o arm.ldscript
9 arm_v6_vfp_le-ld -g -static -nostdlib -M -Ttext 0x10000000 -T ./arm.ldscript -o bootload binit.o bmain.o
10 rm -f *.o program #program.bin
11 bmain.o: main.c
12 arm_v6_vfp_le-gcc -DBOOTLOADER $(CFLAGS) -c $< -o $@
13 binit.o: init.S program.bin
14 arm_v6_vfp_le-gcc -DBOOTLOADER -g -c -Wall $< -o $@
15 program.bin: program
16 arm_v6_vfp_le-objcopy -O binary -R .note -R .comment -R .bss -S program program.bin
17 program: main.o init.o arm.ldscript
18 arm_v6_vfp_le-ld -g -static -nostdlib -M -Ttext 0x2000000 -T ./arm.ldscript -o program init.o main.o
19 main.o: main.c
20 arm_v6_vfp_le-gcc $(CFLAGS) -c $< -o $@
21 init.o: init.S
22 arm_v6_vfp_le-gcc -g -c -Wall $< -o $@
23 clean:
24 rm -f bootload *.o program.bin program
25 objdump: bootload
26 arm_v6_vfp_le-objdump -t bootload
> nl arm.ldscript
1 OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
2 OUTPUT_ARCH(arm)
3 ENTRY(_start)
4 SECTIONS
5 {
6 # . = 0x20000000;
7 . = ALIGN(4);
8 .text : { *(.text) }
9 . = ALIGN(4);
10 .rodata : { *(.rodata) }
11 . = ALIGN(4);
12 .data : { *(.data) }
13 . = ALIGN(4);
14 .got : { *(.got) }
15 . = ALIGN(4);
16 .bss : {
17 __bss_start = .;
18 *(.bss)
19 . = ALIGN(4);
20 __stack_start = .;
21 *(.stack)
22 __stack_end = .;
23 __bss_end = .;
24 }
25 }
> nl init.S
1 /*
2 * init.S: Assembly language entry point for bootlogo demonstation program.
3 *
4 * (c) Copyright ABC Ltd. 2007. All rights reserved.
5 *
6 */
7 .text
8 .globl _start
9 _start:
10 #ifndef BOOTLOADER
11 //save r0 to array before ua_start
12 ldr r1, =pf
13 str r0, [r1]
14