File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed
Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change 1+ #!/usr/bin/python3
2+
3+ # Adds PlatformIO post-processing to convert hex files to uf2 files
4+
5+ import os
6+
7+ Import ("env" )
8+
9+ firmware_hex = "${BUILD_DIR}/${PROGNAME}.hex"
10+ uf2_file = os .environ .get ("UF2_FILE_PATH" , "${BUILD_DIR}/${PROGNAME}.uf2" )
11+
12+ def create_uf2_action (source , target , env ):
13+ uf2_cmd = " " .join (
14+ [
15+ '"$PYTHONEXE"' ,
16+ '"$PROJECT_DIR/bin/uf2conv/uf2conv.py"' ,
17+ '-f' , '0xADA52840' ,
18+ '-c' , firmware_hex ,
19+ '-o' , uf2_file ,
20+ ]
21+ )
22+ env .Execute (uf2_cmd )
23+
24+ env .AddCustomTarget (
25+ name = "create_uf2" ,
26+ dependencies = firmware_hex ,
27+ actions = create_uf2_action ,
28+ title = "Create UF2 file" ,
29+ description = "Use uf2conv to convert hex binary into uf2" ,
30+ always_build = True ,
31+ )
Original file line number Diff line number Diff line change @@ -76,6 +76,7 @@ platform = https://github.com/pioarduino/platform-espressif32/releases/download/
7676[nrf52_base]
7777extends = arduino_base
7878platform = nordicnrf52
79+ extra_scripts = create-uf2.py
7980build_flags = ${arduino_base.build_flags}
8081 -D NRF52_PLATFORM
8182 -D LFS_NO_ASSERT =1
You can’t perform that action at this time.
0 commit comments