Added scripts to make JLink flashing work

This commit is contained in:
Robin Müller 2021-12-09 10:48:50 +01:00
parent 981a4243c4
commit b47ce37955
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
18 changed files with 91 additions and 785 deletions

View File

@ -30,8 +30,8 @@ rustflags = [
# Pick ONE of these compilation targets
# target = "thumbv6m-none-eabi" # Cortex-M0 and Cortex-M0+
# target = "thumbv7m-none-eabi" # Cortex-M3
target = "thumbv7em-none-eabi" # Cortex-M4 and Cortex-M7 (no FPU)
# target = "thumbv7em-none-eabihf" # Cortex-M4F and Cortex-M7F (with FPU)
# target = "thumbv7em-none-eabi" # Cortex-M4 and Cortex-M7 (no FPU)
target = "thumbv7em-none-eabihf" # Cortex-M4F and Cortex-M7F (with FPU)
# target = "thumbv8m.base-none-eabi" # Cortex-M23
# target = "thumbv8m.main-none-eabi" # Cortex-M33 (no FPU)
# target = "thumbv8m.main-none-eabihf" # Cortex-M33 (with FPU)

11
.vscode/launch.json vendored
View File

@ -8,13 +8,18 @@
"type": "cortex-debug",
"request": "launch",
"name": "Debug LED Blinky",
"servertype": "jlink",
// The user should start the J-Link server themselves for now. This is because the
// ROM protection and the watchdog should be disabled after a reset, which requires
// the execution of a dedicated script. I have not found a way to make this work
// with the jlinkscriptfile in the jlink folder
"servertype": "external",
"gdbTarget": "localhost:2331",
"gdbPath": "/usr/bin/gdb-multiarch",
"cwd": "${workspaceRoot}",
"device": "Cortex-M4",
"svdFile": "./va108xx-rs/svd/va416xx-base.svd",
"svdFile": "${workspaceFolder}/va416xx/svd/va416xx-base.svd",
"preLaunchTask": "rust: cargo build led blinky",
"executable": "${workspaceFolder}/target/thumbv7em-none-eabi/debug/examples/blinky",
"executable": "${workspaceFolder}/target/thumbv7em-none-eabihf/debug/examples/blinky",
"interface": "swd",
"runToMain": true,
},

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,52 +0,0 @@
00000456 T BusFault
00000456 T DebugMonitor
00000456 T DefaultHandler
00000456 T DefaultHandler_
0000046e T DefaultPreInit
1fff8000 B __ebss
1fff8000 R __edata
00000040 R __eexceptions
000006e0 R __erodata
000005a8 T __etext
1fff8000 B __euninit
00000008 R __EXCEPTIONS
0000058e T HardFault
0000058e T HardFault_
0000057a T HardFaultTrampoline
00000040 R __INTERRUPTS
0000063c r .Lanon.5509c55a825e8368bb9ffdf07fc35f35.101
0000063c r .Lanon.5509c55a825e8368bb9ffdf07fc35f35.168
000005a8 r .L__unnamed_1
0000064c r .L__unnamed_1
0000062c r .L__unnamed_2
000006d0 r .L__unnamed_2
00000448 T main
00000456 T MemoryManagement
00000456 T NonMaskableInt
00000456 T PendSV
0000046e T __pre_init
00000400 T Reset
00000008 R __reset_vector
00000004 R __RESET_VECTOR
0000051c T rust_begin_unwind
1fff8000 B __sbss
1fff8000 R __sdata
1fff8000 B __sheap
000006e0 A __sidata
000005a8 R __srodata
20000000 A _stack_start
00000400 T __stext
00000400 R _stext
1fff8000 B __suninit
00000456 T SVCall
00000456 T SysTick
00000456 T UsageFault
000006e0 R __veneer_base
000006e0 R __veneer_limit
000004b4 t _ZN36_$LT$T$u20$as$u20$core..any..Any$GT$7type_id17h198211f69c436fccE
000004b2 t _ZN4core3ptr102drop_in_place$LT$$RF$core..iter..adapters..copied..Copied$LT$core..slice..iter..Iter$LT$u8$GT$$GT$$GT$17h1f0f9c5a387252edE
00000538 t _ZN4core4sync6atomic14compiler_fence17hbe9f8aae3d764e1aE
00000470 t _ZN4core4sync6atomic14compiler_fence17he01f903fe9e84742E
000004c6 T _ZN4core9panicking5panic17h2020c9b880cac8cfE
000004f6 T _ZN4core9panicking9panic_fmt17h17bddc0d8adae05dE
00000452 t _ZN6blinky18__cortex_m_rt_main17hf7ab0fd6111fca8fE

View File

@ -1,52 +0,0 @@
00000456 T BusFault
00000456 T DebugMonitor
00000456 T DefaultHandler
00000456 T DefaultHandler_
0000046e T DefaultPreInit
1fff8000 B __ebss
1fff8000 R __edata
00000040 R __eexceptions
000006e0 R __erodata
000005a8 T __etext
1fff8000 B __euninit
00000008 R __EXCEPTIONS
0000058e T HardFault
0000058e T HardFault_
0000057a T HardFaultTrampoline
00000040 R __INTERRUPTS
0000063c r .Lanon.5509c55a825e8368bb9ffdf07fc35f35.101
0000063c r .Lanon.5509c55a825e8368bb9ffdf07fc35f35.168
000005a8 r .L__unnamed_1
0000064c r .L__unnamed_1
0000062c r .L__unnamed_2
000006d0 r .L__unnamed_2
00000448 T main
00000456 T MemoryManagement
00000456 T NonMaskableInt
00000456 T PendSV
0000046e T __pre_init
00000400 T Reset
00000008 R __reset_vector
00000004 R __RESET_VECTOR
0000051c T rust_begin_unwind
1fff8000 B __sbss
1fff8000 R __sdata
1fff8000 B __sheap
000006e0 A __sidata
000005a8 R __srodata
20000000 A _stack_start
00000400 T __stext
00000400 R _stext
1fff8000 B __suninit
00000456 T SVCall
00000456 T SysTick
00000456 T UsageFault
000006e0 R __veneer_base
000006e0 R __veneer_limit
000004b4 t _ZN36_$LT$T$u20$as$u20$core..any..Any$GT$7type_id17h198211f69c436fccE
000004b2 t _ZN4core3ptr102drop_in_place$LT$$RF$core..iter..adapters..copied..Copied$LT$core..slice..iter..Iter$LT$u8$GT$$GT$$GT$17h1f0f9c5a387252edE
00000538 t _ZN4core4sync6atomic14compiler_fence17hbe9f8aae3d764e1aE
00000470 t _ZN4core4sync6atomic14compiler_fence17he01f903fe9e84742E
000004c6 T _ZN4core9panicking5panic17h2020c9b880cac8cfE
000004f6 T _ZN4core9panicking9panic_fmt17h17bddc0d8adae05dE
00000452 t _ZN6blinky18__cortex_m_rt_main17hf7ab0fd6111fca8fE

View File

@ -1,213 +0,0 @@
warning: unused import: `va416xx_hal::pac`
--> va416xx-hal/examples/blinky.rs:7:5
|
7 | use va416xx_hal::pac;
| ^^^^^^^^^^^^^^^^
|
= note: `#[warn(unused_imports)]` on by default
warning: 1 warning emitted
blinky: file format elf32-littlearm
Disassembly of section .text:
00000400 <__stext>:
400: mov.w r4, #4294967295
404: mov lr, r4
406: bl 0x46e <__pre_init> @ imm = #100
40a: mov lr, r4
40c: ldr r0, [pc, #36] <$d>
40e: ldr r1, [pc, #40] <$d+0x6>
410: movs r2, #0
412: cmp r1, r0
414: beq 0x41a <__stext+0x1a> @ imm = #2
416: stm r0!, {r2}
418: b 0x412 <__stext+0x12> @ imm = #-10
41a: ldr r0, [pc, #32] <$d+0xa>
41c: ldr r1, [pc, #32] <$d+0xc>
41e: ldr r2, [pc, #36] <$d+0x12>
420: cmp r1, r0
422: beq 0x42a <__stext+0x2a> @ imm = #4
424: ldm r2!, {r3}
426: stm r0!, {r3}
428: b 0x420 <__stext+0x20> @ imm = #-12
42a: push {lr}
42c: bl 0x448 <main> @ imm = #24
430: udf #0
00000432 <$d>:
432: 00 00 .short 0x0000
00000434 <$d>:
434: 00 80 ff 1f .word 0x1fff8000
438: 00 80 ff 1f .word 0x1fff8000
43c: 00 80 ff 1f .word 0x1fff8000
440: 00 80 ff 1f .word 0x1fff8000
444: e0 06 00 00 .word 0x000006e0
00000448 <main>:
448: push {r7, lr}
44a: mov r7, sp
44c: bl 0x452 <blinky::__cortex_m_rt_main::hf7ab0fd6111fca8f> @ imm = #2
450: trap
00000452 <blinky::__cortex_m_rt_main::hf7ab0fd6111fca8f>:
452: b 0x454 <blinky::__cortex_m_rt_main::hf7ab0fd6111fca8f+0x2> @ imm = #-2
454: b 0x454 <blinky::__cortex_m_rt_main::hf7ab0fd6111fca8f+0x2> @ imm = #-4
00000456 <UsageFault>:
456: push {r7, lr}
458: mov r7, sp
45a: sub sp, #8
45c: b 0x45e <UsageFault+0x8> @ imm = #-2
45e: movs r0, #4
460: strb r0, [r7, #-1]
464: ldrb r0, [r7, #-1]
468: bl 0x470 <core::sync::atomic::compiler_fence::he01f903fe9e84742> @ imm = #4
46c: b 0x45e <UsageFault+0x8> @ imm = #-18
0000046e <__pre_init>:
46e: bx lr
00000470 <core::sync::atomic::compiler_fence::he01f903fe9e84742>:
470: push {r7, lr}
472: mov r7, sp
474: sub sp, #8
476: strb r0, [r7, #-1]
47a: ldrb r0, [r7, #-1]
47e: str r0, [sp]
480: ldr r1, [sp]
482: tbb [pc, r1]
00000486 <$d.1>:
486: 04 10 11 12 .word 0x12111004
48a: 13 00 .short 0x0013
0000048c <$t.2>:
48c: trap
48e: movw r0, #1448
492: movt r0, #0
496: movw r2, #1580
49a: movt r2, #0
49e: movs r1, #50
4a0: bl 0x4c6 <core::panicking::panic::h2020c9b880cac8cf> @ imm = #34
4a4: trap
4a6: b 0x4ae <$t.2+0x22> @ imm = #4
4a8: b 0x4ae <$t.2+0x22> @ imm = #2
4aa: b 0x4ae <$t.2+0x22> @ imm = #0
4ac: b 0x4ae <$t.2+0x22> @ imm = #-2
4ae: add sp, #8
4b0: pop {r7, pc}
000004b2 <core::ptr::drop_in_place<&core::iter::adapters::copied::Copied<core::slice::iter::Iter<u8>>>::h1f0f9c5a387252ed>:
4b2: bx lr
000004b4 <<T as core::any::Any>::type_id::h198211f69c436fcc>:
4b4: movw r0, #57056
4b8: movw r1, #60693
4bc: movt r0, #5815
4c0: movt r1, #64019
4c4: bx lr
000004c6 <core::panicking::panic::h2020c9b880cac8cf>:
4c6: push {r7, lr}
4c8: mov r7, sp
4ca: sub sp, #32
4cc: mov r12, r2
4ce: movw r2, #1596
4d2: movt r2, #0
4d6: movs r3, #0
4d8: strd r0, r1, [sp, #24]
4dc: mov r0, sp
4de: str r2, [sp, #16]
4e0: movs r2, #1
4e2: mov r1, r12
4e4: str r2, [sp, #4]
4e6: add r2, sp, #24
4e8: str r3, [sp, #20]
4ea: strd r3, r3, [sp, #8]
4ee: str r2, [sp]
4f0: bl 0x4f6 <core::panicking::panic_fmt::h17bddc0d8adae05d> @ imm = #2
4f4: trap
000004f6 <core::panicking::panic_fmt::h17bddc0d8adae05d>:
4f6: push {r7, lr}
4f8: mov r7, sp
4fa: sub sp, #16
4fc: strd r0, r1, [sp, #8]
500: movw r0, #1596
504: movt r0, #0
508: str r0, [sp, #4]
50a: movw r0, #1596
50e: movt r0, #0
512: str r0, [sp]
514: mov r0, sp
516: bl 0x51c <rust_begin_unwind> @ imm = #2
51a: trap
0000051c <rust_begin_unwind>:
51c: push {r7, lr}
51e: mov r7, sp
520: sub sp, #8
522: str r0, [sp, #4]
524: b 0x526 <rust_begin_unwind+0xa> @ imm = #-2
526: movs r0, #4
528: strb r0, [r7, #-5]
52c: ldrb r0, [r7, #-5]
530: bl 0x538 <core::sync::atomic::compiler_fence::hbe9f8aae3d764e1a> @ imm = #4
534: b 0x526 <rust_begin_unwind+0xa> @ imm = #-18
536: bmi 0x4e2 <core::panicking::panic::h2020c9b880cac8cf+0x1c> @ imm = #-88
00000538 <core::sync::atomic::compiler_fence::hbe9f8aae3d764e1a>:
538: push {r7, lr}
53a: mov r7, sp
53c: sub sp, #8
53e: strb r0, [r7, #-1]
542: ldrb r0, [r7, #-1]
546: str r0, [sp]
548: ldr r1, [sp]
54a: tbb [pc, r1]
0000054e <$d.1>:
54e: 04 10 11 12 .word 0x12111004
552: 13 00 .short 0x0013
00000554 <$t.2>:
554: trap
556: movw r0, #1612
55a: movt r0, #0
55e: movw r2, #1744
562: movt r2, #0
566: movs r1, #50
568: bl 0x4c6 <core::panicking::panic::h2020c9b880cac8cf> @ imm = #-166
56c: trap
56e: b 0x576 <$t.2+0x22> @ imm = #4
570: b 0x576 <$t.2+0x22> @ imm = #2
572: b 0x576 <$t.2+0x22> @ imm = #0
574: b 0x576 <$t.2+0x22> @ imm = #-2
576: add sp, #8
578: pop {r7, pc}
0000057a <HardFaultTrampoline>:
57a: mov r0, lr
57c: movs r1, #4
57e: tst r0, r1
580: bne 0x588 <HardFaultTrampoline+0xe> @ imm = #4
582: mrs r0, msp
586: b 0x58e <HardFault_> @ imm = #4
588: mrs r0, psp
58c: b 0x58e <HardFault_> @ imm = #-2
0000058e <HardFault_>:
58e: push {r7, lr}
590: mov r7, sp
592: sub sp, #8
594: str r0, [sp, #4]
596: b 0x598 <HardFault_+0xa> @ imm = #-2
598: movs r0, #4
59a: strb r0, [r7, #-5]
59e: ldrb r0, [r7, #-5]
5a2: bl 0x470 <core::sync::atomic::compiler_fence::he01f903fe9e84742> @ imm = #-310
5a6: b 0x598 <HardFault_+0xa> @ imm = #-18

View File

@ -1,221 +0,0 @@
warning: unused import: `va416xx_hal::pac`
--> va416xx-hal/examples/blinky.rs:7:5
|
7 | use va416xx_hal::pac;
| ^^^^^^^^^^^^^^^^
|
= note: `#[warn(unused_imports)]` on by default
warning: 1 warning emitted
blinky: file format elf32-littlearm
Disassembly of section .text:
00000400 <__stext>:
400: mov.w r4, #4294967295
404: mov lr, r4
406: bl 0x486 <__pre_init> @ imm = #124
40a: mov lr, r4
40c: ldr r0, [pc, #56] <$d>
40e: ldr r1, [pc, #60] <$d+0x6>
410: movs r2, #0
412: cmp r1, r0
414: beq 0x41a <__stext+0x1a> @ imm = #2
416: stm r0!, {r2}
418: b 0x412 <__stext+0x12> @ imm = #-10
41a: ldr r0, [pc, #52] <$d+0xa>
41c: ldr r1, [pc, #52] <$d+0xc>
41e: ldr r2, [pc, #56] <$d+0x12>
420: cmp r1, r0
422: beq 0x42a <__stext+0x2a> @ imm = #4
424: ldm r2!, {r3}
426: stm r0!, {r3}
428: b 0x420 <__stext+0x20> @ imm = #-12
42a: ldr r0, [pc, #48] <$d+0x16>
42c: mov.w r1, #15728640
430: ldr r2, [r0]
432: orrs r2, r1
434: str r2, [r0]
436: dsb sy
43a: isb sy
43e: push {lr}
440: bl 0x460 <main> @ imm = #28
444: udf #0
00000446 <$d>:
446: 00 00 .short 0x0000
00000448 <$d>:
448: 00 80 ff 1f .word 0x1fff8000
44c: 00 80 ff 1f .word 0x1fff8000
450: 00 80 ff 1f .word 0x1fff8000
454: 00 80 ff 1f .word 0x1fff8000
458: f8 06 00 00 .word 0x000006f8
45c: 88 ed 00 e0 .word 0xe000ed88
00000460 <main>:
460: push {r7, lr}
462: mov r7, sp
464: bl 0x46a <blinky::__cortex_m_rt_main::h60a0f30b8bbf2630> @ imm = #2
468: trap
0000046a <blinky::__cortex_m_rt_main::h60a0f30b8bbf2630>:
46a: b 0x46c <blinky::__cortex_m_rt_main::h60a0f30b8bbf2630+0x2> @ imm = #-2
46c: b 0x46c <blinky::__cortex_m_rt_main::h60a0f30b8bbf2630+0x2> @ imm = #-4
0000046e <UsageFault>:
46e: push {r7, lr}
470: mov r7, sp
472: sub sp, #8
474: b 0x476 <UsageFault+0x8> @ imm = #-2
476: movs r0, #4
478: strb r0, [r7, #-1]
47c: ldrb r0, [r7, #-1]
480: bl 0x488 <core::sync::atomic::compiler_fence::h8583214d70adb371> @ imm = #4
484: b 0x476 <UsageFault+0x8> @ imm = #-18
00000486 <__pre_init>:
486: bx lr
00000488 <core::sync::atomic::compiler_fence::h8583214d70adb371>:
488: push {r7, lr}
48a: mov r7, sp
48c: sub sp, #8
48e: strb r0, [r7, #-1]
492: ldrb r0, [r7, #-1]
496: str r0, [sp]
498: ldr r1, [sp]
49a: tbb [pc, r1]
0000049e <$d.1>:
49e: 04 10 11 12 .word 0x12111004
4a2: 13 00 .short 0x0013
000004a4 <$t.2>:
4a4: trap
4a6: movw r0, #1472
4aa: movt r0, #0
4ae: movw r2, #1604
4b2: movt r2, #0
4b6: movs r1, #50
4b8: bl 0x4de <core::panicking::panic::hd499c3017018cd48> @ imm = #34
4bc: trap
4be: b 0x4c6 <$t.2+0x22> @ imm = #4
4c0: b 0x4c6 <$t.2+0x22> @ imm = #2
4c2: b 0x4c6 <$t.2+0x22> @ imm = #0
4c4: b 0x4c6 <$t.2+0x22> @ imm = #-2
4c6: add sp, #8
4c8: pop {r7, pc}
000004ca <core::ptr::drop_in_place<&core::iter::adapters::copied::Copied<core::slice::iter::Iter<u8>>>::hda90baf15865d9c4>:
4ca: bx lr
000004cc <<T as core::any::Any>::type_id::h73579ccd4cb5b209>:
4cc: movw r0, #8335
4d0: movw r1, #28887
4d4: movt r0, #37463
4d8: movt r1, #61352
4dc: bx lr
000004de <core::panicking::panic::hd499c3017018cd48>:
4de: push {r7, lr}
4e0: mov r7, sp
4e2: sub sp, #32
4e4: mov r12, r2
4e6: movw r2, #1620
4ea: movt r2, #0
4ee: movs r3, #0
4f0: strd r0, r1, [sp, #24]
4f4: mov r0, sp
4f6: str r2, [sp, #16]
4f8: movs r2, #1
4fa: mov r1, r12
4fc: str r2, [sp, #4]
4fe: add r2, sp, #24
500: str r3, [sp, #20]
502: strd r3, r3, [sp, #8]
506: str r2, [sp]
508: bl 0x50e <core::panicking::panic_fmt::h46301c7d62ff248a> @ imm = #2
50c: trap
0000050e <core::panicking::panic_fmt::h46301c7d62ff248a>:
50e: push {r7, lr}
510: mov r7, sp
512: sub sp, #16
514: strd r0, r1, [sp, #8]
518: movw r0, #1620
51c: movt r0, #0
520: str r0, [sp, #4]
522: movw r0, #1620
526: movt r0, #0
52a: str r0, [sp]
52c: mov r0, sp
52e: bl 0x534 <rust_begin_unwind> @ imm = #2
532: trap
00000534 <rust_begin_unwind>:
534: push {r7, lr}
536: mov r7, sp
538: sub sp, #8
53a: str r0, [sp, #4]
53c: b 0x53e <rust_begin_unwind+0xa> @ imm = #-2
53e: movs r0, #4
540: strb r0, [r7, #-5]
544: ldrb r0, [r7, #-5]
548: bl 0x550 <core::sync::atomic::compiler_fence::h2d8c0970839de2dc> @ imm = #4
54c: b 0x53e <rust_begin_unwind+0xa> @ imm = #-18
54e: bmi 0x4fa <core::panicking::panic::hd499c3017018cd48+0x1c> @ imm = #-88
00000550 <core::sync::atomic::compiler_fence::h2d8c0970839de2dc>:
550: push {r7, lr}
552: mov r7, sp
554: sub sp, #8
556: strb r0, [r7, #-1]
55a: ldrb r0, [r7, #-1]
55e: str r0, [sp]
560: ldr r1, [sp]
562: tbb [pc, r1]
00000566 <$d.1>:
566: 04 10 11 12 .word 0x12111004
56a: 13 00 .short 0x0013
0000056c <$t.2>:
56c: trap
56e: movw r0, #1636
572: movt r0, #0
576: movw r2, #1768
57a: movt r2, #0
57e: movs r1, #50
580: bl 0x4de <core::panicking::panic::hd499c3017018cd48> @ imm = #-166
584: trap
586: b 0x58e <$t.2+0x22> @ imm = #4
588: b 0x58e <$t.2+0x22> @ imm = #2
58a: b 0x58e <$t.2+0x22> @ imm = #0
58c: b 0x58e <$t.2+0x22> @ imm = #-2
58e: add sp, #8
590: pop {r7, pc}
00000592 <HardFaultTrampoline>:
592: mov r0, lr
594: movs r1, #4
596: tst r0, r1
598: bne 0x5a0 <HardFaultTrampoline+0xe> @ imm = #4
59a: mrs r0, msp
59e: b 0x5a6 <HardFault_> @ imm = #4
5a0: mrs r0, psp
5a4: b 0x5a6 <HardFault_> @ imm = #-2
000005a6 <HardFault_>:
5a6: push {r7, lr}
5a8: mov r7, sp
5aa: sub sp, #8
5ac: str r0, [sp, #4]
5ae: b 0x5b0 <HardFault_+0xa> @ imm = #-2
5b0: movs r0, #4
5b2: strb r0, [r7, #-5]
5b6: ldrb r0, [r7, #-5]
5ba: bl 0x488 <core::sync::atomic::compiler_fence::h8583214d70adb371> @ imm = #-310
5be: b 0x5b0 <HardFault_+0xa> @ imm = #-18

3
jlink-gdb.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash
JLinkGDBServer -select USB -device Cortex-M4 -endian little -if SWD -speed 2000 \
-LocalhostOnly -vd

View File

@ -1,6 +1,8 @@
target remote localhost:2331
monitor reset
# Resetting enabled the code memory write protection. Therefore, do not
# reset for now.
# monitor reset
# *try* to stop at the user entry point (it might be gone due to inlining)
break main

View File

@ -0,0 +1,63 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* Solutions for real time microcontroller applications *
**********************************************************************
* *
* (c) 1995 - 2018 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
----------------------------------------------------------------------
File : JLinkSettings.JLinkScript
Purpose : J-Link target setup file for VORAGO VA416xx
---------------------------END-OF-HEADER------------------------------
*/
/*********************************************************************
*
* AfterResetTarget
*/
int AfterResetTarget (void) {
JLINK_SYS_Report("AfterResetTarget()");
// disable watchdog and unlock code RAM for write
JLINK_MEM_WriteU32(0x400210C0, 0x1ACCE551); // WDOGLOCK = 0x1ACCE551
JLINK_MEM_WriteU32(0x40021008, 0x0); // WDOGCONTROL = 0x0 (diable)
return JLINK_MEM_WriteU32(0x40010010, 0x1); // ROM_PROT = 0x1
}
/*********************************************************************
*
* BeforeTargetDownload
*/
int BeforeTargetDownload (void) {
JLINK_SYS_Report("BeforeTargetDownload()");
return JLINK_MEM_WriteU32(0x40010010, 0x1); // ROM_PROT = 0x1
}
/*********************************************************************
*
* AfterTargetDownload
*/
int AfterTargetDownload (void) {
JLINK_SYS_Report("AfterTargetDownload()");
return JLINK_MEM_WriteU32(0x40010010, 0x0); // ROM_PROT = 0x0
}
/*********************************************************************
*
* HandleBeforeFlashProg
*/
int HandleBeforeFlashProg(void) {
JLINK_SYS_Report("HandleBeforeFlashProg()");
return JLINK_MEM_WriteU32(0x40010010, 0x1); // ROM_PROT = 0x1
}
/*********************************************************************
*
* HandleAfterFlashProg
*/
int HandleAfterFlashProg(void) {
JLINK_SYS_Report("HandleAfterFlashProg()");
return JLINK_MEM_WriteU32(0x40010010, 0x0); // ROM_PROT = 0x0
}

8
prep-flash.gdb Normal file
View File

@ -0,0 +1,8 @@
target remote localhost:2331
echo Disabling watchdog\n
set *0x400210C0 = 0x1ACCE551
set *0x40021008 = 0x0
echo Disabling Instruction Memory protection\n
set *0x40010010 = 0x1

2
prep-flash.sh Executable file
View File

@ -0,0 +1,2 @@
#!/bin/bash
gdb-multiarch -q --batch -ex 'source prep-flash.gdb'

View File

@ -1,221 +0,0 @@
warning: unused import: `va416xx_hal::pac`
--> va416xx-hal/examples/blinky.rs:7:5
|
7 | use va416xx_hal::pac;
| ^^^^^^^^^^^^^^^^
|
= note: `#[warn(unused_imports)]` on by default
warning: 1 warning emitted
blinky: file format elf32-littlearm
Disassembly of section .text:
00000400 <__stext>:
400: mov.w r4, #0xffffffff
404: mov lr, r4
406: bl 0x486 <__pre_init> @ imm = #0x7c
40a: mov lr, r4
40c: ldr r0, [pc, #0x38] <$d>
40e: ldr r1, [pc, #0x3c] <$d+0x6>
410: movs r2, #0x0
412: cmp r1, r0
414: beq 0x41a <__stext+0x1a> @ imm = #0x2
416: stm r0!, {r2}
418: b 0x412 <__stext+0x12> @ imm = #-0xa
41a: ldr r0, [pc, #0x34] <$d+0xa>
41c: ldr r1, [pc, #0x34] <$d+0xc>
41e: ldr r2, [pc, #0x38] <$d+0x12>
420: cmp r1, r0
422: beq 0x42a <__stext+0x2a> @ imm = #0x4
424: ldm r2!, {r3}
426: stm r0!, {r3}
428: b 0x420 <__stext+0x20> @ imm = #-0xc
42a: ldr r0, [pc, #0x30] <$d+0x16>
42c: mov.w r1, #0xf00000
430: ldr r2, [r0]
432: orrs r2, r1
434: str r2, [r0]
436: dsb sy
43a: isb sy
43e: push {lr}
440: bl 0x460 <main> @ imm = #0x1c
444: udf #0x0
00000446 <$d>:
446: 00 00 .short 0x0000
00000448 <$d>:
448: 00 80 ff 1f .word 0x1fff8000
44c: 00 80 ff 1f .word 0x1fff8000
450: 00 80 ff 1f .word 0x1fff8000
454: 00 80 ff 1f .word 0x1fff8000
458: f8 06 00 00 .word 0x000006f8
45c: 88 ed 00 e0 .word 0xe000ed88
00000460 <main>:
460: push {r7, lr}
462: mov r7, sp
464: bl 0x46a <blinky::__cortex_m_rt_main::h60a0f30b8bbf2630> @ imm = #0x2
468: trap
0000046a <blinky::__cortex_m_rt_main::h60a0f30b8bbf2630>:
46a: b 0x46c <blinky::__cortex_m_rt_main::h60a0f30b8bbf2630+0x2> @ imm = #-0x2
46c: b 0x46c <blinky::__cortex_m_rt_main::h60a0f30b8bbf2630+0x2> @ imm = #-0x4
0000046e <UsageFault>:
46e: push {r7, lr}
470: mov r7, sp
472: sub sp, #0x8
474: b 0x476 <UsageFault+0x8> @ imm = #-0x2
476: movs r0, #0x4
478: strb r0, [r7, #-1]
47c: ldrb r0, [r7, #-1]
480: bl 0x488 <core::sync::atomic::compiler_fence::h8583214d70adb371> @ imm = #0x4
484: b 0x476 <UsageFault+0x8> @ imm = #-0x12
00000486 <__pre_init>:
486: bx lr
00000488 <core::sync::atomic::compiler_fence::h8583214d70adb371>:
488: push {r7, lr}
48a: mov r7, sp
48c: sub sp, #0x8
48e: strb r0, [r7, #-1]
492: ldrb r0, [r7, #-1]
496: str r0, [sp]
498: ldr r1, [sp]
49a: tbb [pc, r1]
0000049e <$d.1>:
49e: 04 10 11 12 .word 0x12111004
4a2: 13 00 .short 0x0013
000004a4 <$t.2>:
4a4: trap
4a6: movw r0, #0x5c0
4aa: movt r0, #0x0
4ae: movw r2, #0x644
4b2: movt r2, #0x0
4b6: movs r1, #0x32
4b8: bl 0x4de <core::panicking::panic::hd499c3017018cd48> @ imm = #0x22
4bc: trap
4be: b 0x4c6 <$t.2+0x22> @ imm = #0x4
4c0: b 0x4c6 <$t.2+0x22> @ imm = #0x2
4c2: b 0x4c6 <$t.2+0x22> @ imm = #0x0
4c4: b 0x4c6 <$t.2+0x22> @ imm = #-0x2
4c6: add sp, #0x8
4c8: pop {r7, pc}
000004ca <core::ptr::drop_in_place<&core::iter::adapters::copied::Copied<core::slice::iter::Iter<u8>>>::hda90baf15865d9c4>:
4ca: bx lr
000004cc <<T as core::any::Any>::type_id::h73579ccd4cb5b209>:
4cc: movw r0, #0x208f
4d0: movw r1, #0x70d7
4d4: movt r0, #0x9257
4d8: movt r1, #0xefa8
4dc: bx lr
000004de <core::panicking::panic::hd499c3017018cd48>:
4de: push {r7, lr}
4e0: mov r7, sp
4e2: sub sp, #0x20
4e4: mov r12, r2
4e6: movw r2, #0x654
4ea: movt r2, #0x0
4ee: movs r3, #0x0
4f0: strd r0, r1, [sp, #24]
4f4: mov r0, sp
4f6: str r2, [sp, #0x10]
4f8: movs r2, #0x1
4fa: mov r1, r12
4fc: str r2, [sp, #0x4]
4fe: add r2, sp, #0x18
500: str r3, [sp, #0x14]
502: strd r3, r3, [sp, #8]
506: str r2, [sp]
508: bl 0x50e <core::panicking::panic_fmt::h46301c7d62ff248a> @ imm = #0x2
50c: trap
0000050e <core::panicking::panic_fmt::h46301c7d62ff248a>:
50e: push {r7, lr}
510: mov r7, sp
512: sub sp, #0x10
514: strd r0, r1, [sp, #8]
518: movw r0, #0x654
51c: movt r0, #0x0
520: str r0, [sp, #0x4]
522: movw r0, #0x654
526: movt r0, #0x0
52a: str r0, [sp]
52c: mov r0, sp
52e: bl 0x534 <rust_begin_unwind> @ imm = #0x2
532: trap
00000534 <rust_begin_unwind>:
534: push {r7, lr}
536: mov r7, sp
538: sub sp, #0x8
53a: str r0, [sp, #0x4]
53c: b 0x53e <rust_begin_unwind+0xa> @ imm = #-0x2
53e: movs r0, #0x4
540: strb r0, [r7, #-5]
544: ldrb r0, [r7, #-5]
548: bl 0x550 <core::sync::atomic::compiler_fence::h2d8c0970839de2dc> @ imm = #0x4
54c: b 0x53e <rust_begin_unwind+0xa> @ imm = #-0x12
54e: bmi 0x4fa <core::panicking::panic::hd499c3017018cd48+0x1c> @ imm = #-0x58
00000550 <core::sync::atomic::compiler_fence::h2d8c0970839de2dc>:
550: push {r7, lr}
552: mov r7, sp
554: sub sp, #0x8
556: strb r0, [r7, #-1]
55a: ldrb r0, [r7, #-1]
55e: str r0, [sp]
560: ldr r1, [sp]
562: tbb [pc, r1]
00000566 <$d.1>:
566: 04 10 11 12 .word 0x12111004
56a: 13 00 .short 0x0013
0000056c <$t.2>:
56c: trap
56e: movw r0, #0x664
572: movt r0, #0x0
576: movw r2, #0x6e8
57a: movt r2, #0x0
57e: movs r1, #0x32
580: bl 0x4de <core::panicking::panic::hd499c3017018cd48> @ imm = #-0xa6
584: trap
586: b 0x58e <$t.2+0x22> @ imm = #0x4
588: b 0x58e <$t.2+0x22> @ imm = #0x2
58a: b 0x58e <$t.2+0x22> @ imm = #0x0
58c: b 0x58e <$t.2+0x22> @ imm = #-0x2
58e: add sp, #0x8
590: pop {r7, pc}
00000592 <HardFaultTrampoline>:
592: mov r0, lr
594: movs r1, #0x4
596: tst r0, r1
598: bne 0x5a0 <HardFaultTrampoline+0xe> @ imm = #0x4
59a: mrs r0, msp
59e: b 0x5a6 <HardFault_> @ imm = #0x4
5a0: mrs r0, psp
5a4: b 0x5a6 <HardFault_> @ imm = #-0x2
000005a6 <HardFault_>:
5a6: push {r7, lr}
5a8: mov r7, sp
5aa: sub sp, #0x8
5ac: str r0, [sp, #0x4]
5ae: b 0x5b0 <HardFault_+0xa> @ imm = #-0x2
5b0: movs r0, #0x4
5b2: strb r0, [r7, #-5]
5b6: ldrb r0, [r7, #-5]
5ba: bl 0x488 <core::sync::atomic::compiler_fence::h8583214d70adb371> @ imm = #-0x136
5be: b 0x5b0 <HardFault_+0xa> @ imm = #-0x12

@ -1 +1 @@
Subproject commit a545b4028ef25923f3477441194c556dea8ae57e
Subproject commit cfde64ef8d2abb8e08b19826d5290890acce868c

@ -1 +1 @@
Subproject commit 4718a08e246ff770aeb81bf0b7cf635f0c27213f
Subproject commit 03cefd26725fc15fe0f1dc0670eaa2addcd5ea9d

View File

@ -1,18 +0,0 @@
(gdb) file blinky
A program is being debugged already.
Are you sure you want to change the file? (y or n) y
Reading symbols from blinky...
(gdb) load
Loading section .vector_table, size 0xc0 lma 0x0
Loading section .text, size 0x289c lma 0xc0
Loading section .rodata, size 0x334 lma 0x2960
Start address 0x000000c0, load size 11408
Transfer rate: 139 KB/sec, 3802 bytes/write.
(gdb) break main
Breakpoint 1 at 0x1fd8: file va108xx-hal/examples/blinky.rs, line 14.
(gdb) c
Continuing.
Breakpoint 1, blinky::__cortex_m_rt_main_trampoline () at va108xx-hal/examples/blinky.rs:14
14 #[entry]
(gdb)