Skip to content

Commit da110d0

Browse files
committed
Added Windows scripts
1 parent c73e6ee commit da110d0

23 files changed

+122
-895
lines changed

.vscode/tasks.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,21 +41,21 @@
4141
"command": "cmd",
4242
"args": [
4343
"/c",
44-
" scripts\\stm32l4\\build-boot.cmd && echo ✅ ◾ ️Done! "
44+
" scripts\\nrf52\\build-boot.cmd && echo ✅ ◾ ️Done! "
4545
]
4646
},
4747
"osx": {
4848
"command": "bash",
4949
"args": [
5050
"-c", "-l",
51-
" scripts/stm32l4/build-boot.sh && echo ✅ ◾ ️Done! "
51+
" scripts/nrf52/build-boot.sh && echo ✅ ◾ ️Done! "
5252
],
5353
},
5454
"linux": {
5555
"command": "bash",
5656
"args": [
5757
"-c", "-l",
58-
" scripts/stm32l4/build-boot.sh && echo ✅ ◾ ️Done! "
58+
" scripts/nrf52/build-boot.sh && echo ✅ ◾ ️Done! "
5959
],
6060
},
6161
"problemMatcher": [ "$gcc" ],
@@ -119,21 +119,21 @@
119119
"command": "cmd",
120120
"args": [
121121
"/c",
122-
" scripts\\stm32l4\\image-app.cmd && echo ✅ ◾ ️Done! "
122+
" scripts\\nrf52\\image-app.cmd && echo ✅ ◾ ️Done! "
123123
]
124124
},
125125
"osx": {
126126
"command": "bash",
127127
"args": [
128128
"-c", "-l",
129-
" scripts/stm32l4/image-app.sh && echo ✅ ◾ ️Done! "
129+
" scripts/nrf52/image-app.sh && echo ✅ ◾ ️Done! "
130130
],
131131
},
132132
"linux": {
133133
"command": "bash",
134134
"args": [
135135
"-c", "-l",
136-
" scripts/stm32l4/image-app.sh && echo ✅ ◾ ️Done! "
136+
" scripts/nrf52/image-app.sh && echo ✅ ◾ ️Done! "
137137
],
138138
},
139139
"problemMatcher": [],
@@ -149,23 +149,23 @@
149149
"command": "cmd",
150150
"args": [
151151
"/c",
152-
" scripts\\stm32l4\\flash-boot.cmd && echo ✅ ◾ ️Done! "
152+
" scripts\\nrf52\\flash-boot.cmd && echo ✅ ◾ ️Done! "
153153
]
154154
},
155155
"osx": {
156156
// Previously: " newt load -v bluepill_boot && echo '**** Done!' "
157157
"command": "bash",
158158
"args": [
159159
"-c", "-l",
160-
" scripts/stm32l4/flash-boot.sh && echo ✅ ◾ ️Done! "
160+
" scripts/nrf52/flash-boot.sh && echo ✅ ◾ ️Done! "
161161
],
162162
},
163163
"linux": {
164164
// Previously: " newt load -v bluepill_boot && echo '**** Done!' "
165165
"command": "bash",
166166
"args": [
167167
"-c", "-l",
168-
" scripts/stm32l4/flash-boot.sh && echo ✅ ◾ ️Done! "
168+
" scripts/nrf52/flash-boot.sh && echo ✅ ◾ ️Done! "
169169
],
170170
},
171171
"problemMatcher": [],
@@ -181,23 +181,23 @@
181181
"command": "cmd",
182182
"args": [
183183
"/c",
184-
" scripts\\stm32l4\\flash-app.cmd && echo ✅ ◾ ️Done! "
184+
" scripts\\nrf52\\flash-app.cmd && echo ✅ ◾ ️Done! "
185185
]
186186
},
187187
"osx": {
188188
// Previously: " newt load -v bluepill_my_sensor && echo '**** Done!' "
189189
"command": "bash",
190190
"args": [
191191
"-c", "-l",
192-
" scripts/stm32l4/flash-app.sh && echo ✅ ◾ ️Done! "
192+
" scripts/nrf52/flash-app.sh && echo ✅ ◾ ️Done! "
193193
],
194194
},
195195
"linux": {
196196
// Previously: " newt load -v bluepill_my_sensor && echo '**** Done!' "
197197
"command": "bash",
198198
"args": [
199199
"-c", "-l",
200-
" scripts/stm32l4/flash-app.sh && echo ✅ ◾ ️Done! "
200+
" scripts/nrf52/flash-app.sh && echo ✅ ◾ ️Done! "
201201
],
202202
},
203203
"problemMatcher": [],

scripts/nrf52/README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# nrf52: Build and Flash Scripts for nRF52
2+
3+
[`build-boot.cmd`](build-boot.cmd)[`.sh`](build-boot.sh): Build the bootloader by running `newt build nrf52_boot`
4+
5+
[`build-app.cmd`](../build-app.cmd)[`.sh`](../build-app.sh): Build the application by running `newt build nrf52_my_sensor`. Also builds the Rust application and injects the compiled Rust code into the build.
6+
7+
[`image-app.cmd`](image-app.cmd)[`.sh`](image-app.sh): Create the application firmware image: `newt create-image -v nrf52_my_sensor 1.0.0`
8+
9+
[`flash-boot.cmd`](flash-boot.cmd)[`.sh`](flash-boot.sh): Flash the bootloader with OpenOCD
10+
11+
[`flash-boot.ocd`](flash-boot.ocd): OpenOCD script for flashing the bootloader
12+
13+
[`flash-app.cmd`](flash-app.cmd)[`.sh`](flash-app.sh): Flash the application with OpenOCD
14+
15+
[`flash-app.ocd`](flash-app.ocd): OpenOCD script for flashing the application
16+
17+
[`flash-init.ocd`](flash-init.ocd): OpenOCD initialisation script called by `flash-boot.ocd` and `flash-app.ocd`
18+
19+
[`debug.ocd`](debug.ocd): OpenOCD script for debugging the application. Called by `.vscode/launch-nrf52.json`

scripts/nrf52/flash-app.cmd

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
:: Flash Mynewt Application to nRF52 with ST-Link on Windows
2+
3+
:: Added "set WORKAREASIZE 0" to remove the warning: "using fast async flash loader. This is currently supported only with ST-Link and CMSIS-DAP"
4+
5+
openocd\bin\openocd.exe
6+
-f scripts/nrf52/flash-init.ocd ^
7+
-f interface/stlink.cfg ^
8+
-c "transport select hla_swd" ^
9+
-c "set WORKAREASIZE 0" ^
10+
-f target/nrf52.cfg ^
11+
-f scripts/nrf52/flash-app.ocd

scripts/nrf52/flash-app.ocd

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# This is an OpenOCD script that connects to the STM32 Blue Pill and flashes the Application ROM.
2+
# Used by tasks.json for "Load bluepill_my_sensor" command.
3+
# Equivalent to "newt load -v bluepill_my_sensor".
4+
# openocd -f scripts/flash-init.ocd -f interface/stlink-v2.cfg -f target/stm32l4x.cfg -f scripts/flash-app.ocd
5+
6+
# Connect to the device.
7+
init
8+
9+
# Enable ARM semihosting to show debug console output in OpenOCD console.
10+
arm semihosting enable
11+
12+
echo "Stopping Blue Pill..."
13+
reset halt
14+
echo ""
15+
16+
echo "Current flash info..."
17+
flash banks; flash list; flash probe 0
18+
# flash info 0 sectors # Show details of each sector.
19+
echo ""
20+
21+
# Unlock will fail if Blue Pill is locked, need to mass erase first. See flash-boot.ocd.
22+
echo "Unlocking Blue Pill..."
23+
stm32l4x unlock 0 # Unlock will allow flash to be read after flashing.
24+
echo ""
25+
26+
# Application address must sync with hw/bsp/stm32l4/bsp.yml
27+
echo "Flashing Application to Blue Pill..."
28+
flash write_image erase unlock bin/targets/stm32l4_my_sensor/app/apps/my_sensor_app/my_sensor_app.img 0x08004000
29+
flash verify_bank 0 bin/targets/stm32l4_my_sensor/app/apps/my_sensor_app/my_sensor_app.img 0x00004000
30+
echo ""
31+
32+
# Restart the device.
33+
echo "Restarting Blue Pill..."
34+
reset halt
35+
echo ""
36+
37+
echo "**** Done!"
38+
exit

scripts/nrf52/flash-app.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/env bash
2+
# Flash Mynewt Application to nRF52 with ST-Link on macOS and Linux
3+
4+
set -e # Exit when any command fails.
5+
set -x # Echo all commands.
6+
7+
# Added "set WORKAREASIZE 0" to remove the warning: "using fast async flash loader. This is currently supported only with ST-Link and CMSIS-DAP"
8+
9+
openocd/bin/openocd \
10+
-f scripts/nrf52/flash-init.ocd \
11+
-f interface/stlink.cfg \
12+
-c "transport select hla_swd" \
13+
-c "set WORKAREASIZE 0" \
14+
-f target/nrf52.cfg \
15+
-f scripts/nrf52/flash-app.ocd

scripts/nrf52/flash-boot.cmd

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
:: Flash Mynewt bootloader to nRF52 with ST-Link on Windows
2+
3+
:: Added "set WORKAREASIZE 0" to remove the warning: "using fast async flash loader. This is currently supported only with ST-Link and CMSIS-DAP"
4+
5+
openocd\bin\openocd.exe
6+
-f scripts/nrf52/flash-init.ocd ^
7+
-f interface/stlink.cfg ^
8+
-c "transport select hla_swd" ^
9+
-c "set WORKAREASIZE 0" ^
10+
-f target/nrf52.cfg ^
11+
-f scripts/nrf52/flash-boot.ocd

scripts/nrf52/flash-boot.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env bash
2-
# Flash Mynewt Bootloader to nRF52 with ST-Link
2+
# Flash Mynewt Bootloader to nRF52 with ST-Link on macOS and Linux
33

44
set -e # Exit when any command fails.
55
set -x # Echo all commands.

scripts/nrf52/flash-init.ocd

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# This is an OpenOCD script that prepares the microcontroller before any flashing.
22

33
# Disable all openocd messages.
4-
#### debug_level 0
5-
debug_level 2
4+
debug_level 0

scripts/nrf52/flash-swd.ocd

Lines changed: 0 additions & 26 deletions
This file was deleted.

scripts/nrf52/flash-swd.sh

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)