Compare commits

...

2 Commits

2 changed files with 25 additions and 3 deletions
+1 -1
View File
@@ -23,7 +23,7 @@ lab1_v2.bin: lab1_v2.S lab1_v2.ld
qemu: build qemu: build
qemu-system-gnuarmeclipse --verbose --verbose --board STM32F4-Discovery \ qemu-system-gnuarmeclipse --verbose --verbose --board STM32F4-Discovery \
--mcu STM32F407VG -d unimp,guest_errors --nographic \ --mcu STM32F407VG -d unimp,guest_errors \
--semihosting-config enable=on,target=native -s -S \ --semihosting-config enable=on,target=native -s -S \
--image start.bin --image start.bin
+24 -2
View File
@@ -3,17 +3,22 @@
.thumb .thumb
.equ SYSTICK_OFFSET, 0xE000E010 .equ SYSTICK_OFFSET, 0xE000E010
.equ RCC_OFFSET, 0x40023800
.equ GPIOD_OFFSET, 0x40020C00
.section .text .section .text
vtable: vtable:
.word __stack_start .word __stack_start
.word __hard_reset__+1 .word __hard_reset__+1
.align 2
v2_img_start: v2_img_start:
.incbin "lab1_v2.bin" .incbin "lab1_v2.bin"
.align 2
v2_img_end: @ ==__hard_reset__ v2_img_end: @ ==__hard_reset__
__hard_reset__: __hard_reset__:
bl setup_leds
bl load_systick_timer bl load_systick_timer
bl lab1_v1 bl lab1_v1
@@ -46,8 +51,8 @@ bootload_v2:
ldr.n r3, =__ram_start ldr.n r3, =__ram_start
copy_loop: copy_loop:
ldrh r2, [r0], #2 ldr r2, [r0], #4
strh r2, [r3], #2 str r2, [r3], #4
cmp.n r0, r1 cmp.n r0, r1
bne.n copy_loop bne.n copy_loop
@@ -75,3 +80,20 @@ bootload_v2:
blx r3 blx r3
pop {pc} pop {pc}
setup_leds:
@ RCC reset & enable GPIOD
ldr r0, =RCC_OFFSET
mov r1, #0x8
str r1, [r0, #0x30] @ ENABLE
@ GPIOD config
ldr r0, =GPIOD_OFFSET
ldr r1, =0x55000000
str r1, [r0] @ Mode Register
mov r1, #0xF000
str r1, [r0, #0x14] @ Output Data Register
mov pc, lr