File tree 2 files changed +56
-0
lines changed
2 files changed +56
-0
lines changed Original file line number Diff line number Diff line change @@ -60,6 +60,12 @@ arduino-cli upload --port {SERIAL_PORT} --fqbn STMicroelectronics:stm32:Nucleo_6
60
60
61
61
_ Make sure to replace {SERIAL_PORT} with your serial port, which should begin with ` /dev/ ` ._
62
62
63
+ ## Scripts
64
+
65
+ A few scripts are available, eg. to automate repeated manual actions:
66
+
67
+ 1 . ** Compile & Flash** : ` ./scripts/compile_and_flash.sh ` (compiles firmware and flashes it over the plugged STM32 programmer);
68
+
63
69
## Configuration
64
70
65
71
The configuration options can be found in the following files:
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ ABSPATH=$( cd " $( dirname " $0 " ) " ; pwd)
4
+ BASE_DIR=" $ABSPATH /../"
5
+
6
+ pushd " $BASE_DIR " > /dev/null
7
+ # Acquire serial port first
8
+ SERIAL_PORT=$( arduino-cli board list | grep " Serial Port (USB)" | cut -d ' ' -f 1 | head -n 1)
9
+
10
+ if [ ! -z " $SERIAL_PORT " ]; then
11
+ echo " Detected STM32 programmer on serial port: $SERIAL_PORT "
12
+ echo " Will proceed."
13
+
14
+ # Hold on a bit (give the user a chance to cancel)
15
+ sleep 1
16
+
17
+ # Clear out built code
18
+ echo " >> [1] Clearing old builds..."
19
+
20
+ sleep 0.5
21
+
22
+ rm -f ./output/* || exit 1
23
+
24
+ echo " Old builds cleared."
25
+
26
+ # Compile new firmware
27
+ echo " >> [2] Compiling new firmware..."
28
+
29
+ sleep 0.5
30
+
31
+ arduino-cli compile --fqbn STMicroelectronics:stm32:Nucleo_64:opt=o3std,pnum=NUCLEO_F411RE --verbose srcs/respirator.cpp --output output/respirator-production || exit 1
32
+
33
+ # Flash new firmware
34
+ echo " >> [3] Flashing new firmware..."
35
+
36
+ sleep 0.5
37
+
38
+ arduino-cli upload --port " $SERIAL_PORT " --fqbn STMicroelectronics:stm32:Nucleo_64:pnum=NUCLEO_F411RE,upload_method=swdMethod --input output/respirator-production || exit 1
39
+
40
+ sleep 0.5
41
+
42
+ echo " Success: All done. The ventilator will boot using the new firmware now."
43
+ else
44
+ echo " Error: STM32 programmer device not detected!"
45
+
46
+ exit 1
47
+ fi
48
+ popd > /dev/null
49
+
50
+ exit 0
You can’t perform that action at this time.
0 commit comments