@@ -26,92 +26,92 @@ def get_mcu(name):
26
26
def build_upload (name ):
27
27
mcu = get_mcu (name )
28
28
print ("# Upload" )
29
- print ("%s .bootloader.tool=bootburn" % name )
30
- print ("%s .upload.tool=nrfutil" % name )
31
- print ("%s .upload.protocol=nrfutil" % name )
29
+ print (f" { name } .bootloader.tool=bootburn" )
30
+ print (f" { name } .upload.tool=nrfutil" )
31
+ print (f" { name } .upload.protocol=nrfutil" )
32
32
if mcu == 52832 :
33
- print ("%s .upload.use_1200bps_touch=false" % name )
34
- print ("%s .upload.wait_for_upload_port=false" % name )
35
- print ("%s .upload.native_usb=false" % name )
33
+ print (f" { name } .upload.use_1200bps_touch=false" )
34
+ print (f" { name } .upload.wait_for_upload_port=false" )
35
+ print (f" { name } .upload.native_usb=false" )
36
36
else :
37
- print ("%s .upload.use_1200bps_touch=true" % name )
38
- print ("%s .upload.wait_for_upload_port=true" % name )
39
- print ("%s .upload.maximum_size=%d" % ( name , mcu_dict [mcu ]['flash_size' ]) )
40
- print ("%s .upload.maximum_data_size=%d" % ( name , mcu_dict [mcu ]['data_size' ]) )
37
+ print (f" { name } .upload.use_1200bps_touch=true" )
38
+ print (f" { name } .upload.wait_for_upload_port=true" )
39
+ print (f" { name } .upload.maximum_size={ mcu_dict [mcu ]['flash_size' ]} " )
40
+ print (f" { name } .upload.maximum_data_size={ mcu_dict [mcu ]['data_size' ]} " )
41
41
print ()
42
42
43
43
44
44
def build_header (name , variant , vendor_name , product_name , boarddefine , vid , pid_list ):
45
45
prettyname = vendor_name + " " + product_name
46
46
print ()
47
47
print ("# -----------------------------------" )
48
- print ("# %s" % prettyname )
48
+ print (f "# { prettyname } " )
49
49
print ("# -----------------------------------" )
50
- print ("%s .name=%s" % ( name , prettyname ) )
50
+ print (f" { name } .name={ prettyname } " )
51
51
print ()
52
52
53
53
print ("# VID/PID for Bootloader, Arduino & CircuitPython" )
54
54
for i in range (len (pid_list )):
55
- print ("%s .vid.%d=%s" % ( name , i , vid ) )
56
- print ("%s .pid.%d=%s" % ( name , i , pid_list [i ]) )
55
+ print (f" { name } .vid.{ i } = { vid } " )
56
+ print (f" { name } .pid.{ i } = { pid_list [i ]} " )
57
57
print ()
58
58
59
59
build_upload (name )
60
60
61
61
print ("# Build" )
62
- print ("%s .build.mcu=cortex-m4" % name )
63
- print ("%s .build.f_cpu=64000000" % name )
64
- print ("%s .build.board=%s" % ( name , boarddefine ) )
65
- print ("%s .build.core=nRF5" % name )
66
- print ("%s .build.variant=%s" % ( name , variant ) )
67
- print ('%s .build.usb_manufacturer="%s"' % ( name , vendor_name ) )
68
- print ('%s .build.usb_product="%s"' % ( name , product_name ) )
62
+ print (f" { name } .build.mcu=cortex-m4" )
63
+ print (f" { name } .build.f_cpu=64000000" )
64
+ print (f" { name } .build.board={ boarddefine } " )
65
+ print (f" { name } .build.core=nRF5" )
66
+ print (f" { name } .build.variant={ variant } " )
67
+ print (f' { name } .build.usb_manufacturer="{ vendor_name } "' )
68
+ print (f' { name } .build.usb_product="{ product_name } "' )
69
69
70
70
mcu = get_mcu (name )
71
- print ("%s .build.extra_flags=%s" % ( name , mcu_dict [mcu ]['extra_flags' ]) )
72
- print ("%s .build.ldscript=%s" % ( name , mcu_dict [mcu ]['ldscript' ]) )
71
+ print (f" { name } .build.extra_flags={ mcu_dict [mcu ]['extra_flags' ]} " )
72
+ print (f" { name } .build.ldscript={ mcu_dict [mcu ]['ldscript' ]} " )
73
73
if mcu != 52832 :
74
- print ("%s .build.vid=%s" % ( name , vid ) )
75
- print ("%s .build.pid=%s" % ( name , pid_list [0 ]) )
74
+ print (f" { name } .build.vid={ vid } " )
75
+ print (f" { name } .build.pid={ pid_list [0 ]} " )
76
76
print ()
77
77
78
78
79
79
def build_softdevice (name ):
80
80
print ("# SoftDevice Menu" )
81
81
if get_mcu (name ) == 52832 :
82
- print ("%s .menu.softdevice.s132v6=S132 6.1.1" % name )
83
- print ("%s .menu.softdevice.s132v6.build.sd_name=s132" % name )
84
- print ("%s .menu.softdevice.s132v6.build.sd_version=6.1.1" % name )
85
- print ("%s .menu.softdevice.s132v6.build.sd_fwid=0x00B7" % name )
82
+ print (f" { name } .menu.softdevice.s132v6=S132 6.1.1" )
83
+ print (f" { name } .menu.softdevice.s132v6.build.sd_name=s132" )
84
+ print (f" { name } .menu.softdevice.s132v6.build.sd_version=6.1.1" )
85
+ print (f" { name } .menu.softdevice.s132v6.build.sd_fwid=0x00B7" )
86
86
else :
87
- print ("%s .menu.softdevice.s140v6=S140 6.1.1" % name )
88
- print ("%s .menu.softdevice.s140v6.build.sd_name=s140" % name )
89
- print ("%s .menu.softdevice.s140v6.build.sd_version=6.1.1" % name )
90
- print ("%s .menu.softdevice.s140v6.build.sd_fwid=0x00B6" % name )
87
+ print (f" { name } .menu.softdevice.s140v6=S140 6.1.1" )
88
+ print (f" { name } .menu.softdevice.s140v6.build.sd_name=s140" )
89
+ print (f" { name } .menu.softdevice.s140v6.build.sd_version=6.1.1" )
90
+ print (f" { name } .menu.softdevice.s140v6.build.sd_fwid=0x00B6" )
91
91
print ()
92
92
93
93
94
94
def build_debug (name ):
95
95
print ("# Debug Menu" )
96
- print ("%s .menu.debug.l0=Level 0 (Release)" % name )
97
- print ("%s .menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0" % name )
98
- print ("%s .menu.debug.l1=Level 1 (Error Message)" % name )
99
- print ("%s .menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1" % name )
100
- print ("%s .menu.debug.l2=Level 2 (Full Debug)" % name )
101
- print ("%s .menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2" % name )
102
- print ("%s .menu.debug.l3=Level 3 (Segger SystemView)" % name )
103
- print ("%s .menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3" % name )
104
- print ("%s .menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1" % name )
96
+ print (f" { name } .menu.debug.l0=Level 0 (Release)" )
97
+ print (f" { name } .menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0" )
98
+ print (f" { name } .menu.debug.l1=Level 1 (Error Message)" )
99
+ print (f" { name } .menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1" )
100
+ print (f" { name } .menu.debug.l2=Level 2 (Full Debug)" )
101
+ print (f" { name } .menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2" )
102
+ print (f" { name } .menu.debug.l3=Level 3 (Segger SystemView)" )
103
+ print (f" { name } .menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3" )
104
+ print (f" { name } .menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1" )
105
105
print ()
106
106
107
107
def build_debug_output (name ):
108
108
print ("# Debug Output Menu" )
109
- print ("%s .menu.debug_output.serial=Serial" % name )
110
- print ("%s .menu.debug_output.serial.build.logger_flags=-DCFG_LOGGER=0" % name )
111
- print ("%s .menu.debug_output.serial1=Serial1" % name )
112
- print ("%s .menu.debug_output.serial1.build.logger_flags=-DCFG_LOGGER=1 -DCFG_TUSB_DEBUG=CFG_DEBUG" % name )
113
- print ("%s .menu.debug_output.rtt=Segger RTT" % name )
114
- print ("%s .menu.debug_output.rtt.build.logger_flags=-DCFG_LOGGER=2 -DCFG_TUSB_DEBUG=CFG_DEBUG -DSEGGER_RTT_MODE_DEFAULT=SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL" % name )
109
+ print (f" { name } .menu.debug_output.serial=Serial" )
110
+ print (f" { name } .menu.debug_output.serial.build.logger_flags=-DCFG_LOGGER=0" )
111
+ print (f" { name } .menu.debug_output.serial1=Serial1" )
112
+ print (f" { name } .menu.debug_output.serial1.build.logger_flags=-DCFG_LOGGER=1 -DCFG_TUSB_DEBUG=CFG_DEBUG" )
113
+ print (f" { name } .menu.debug_output.rtt=Segger RTT" )
114
+ print (f" { name } .menu.debug_output.rtt.build.logger_flags=-DCFG_LOGGER=2 -DCFG_TUSB_DEBUG=CFG_DEBUG -DSEGGER_RTT_MODE_DEFAULT=SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL" )
115
115
116
116
def build_global_menu ():
117
117
print ("menu.softdevice=SoftDevice" )
@@ -125,44 +125,65 @@ def make_board(name, variant, vendor_name, product_name, boarddefine, vid, pid_l
125
125
build_debug_output (name )
126
126
127
127
128
+ # ------------------------------
129
+ # main
130
+ # ------------------------------
128
131
build_global_menu ()
129
132
130
- make_board ("feather52832" , "feather_nrf52832" , "Adafruit" , "Feather nRF52832" , "NRF52832_FEATHER" ,
131
- "0x239A" , [])
132
- make_board ("feather52840" , "feather_nrf52840_express" , "Adafruit" , "Feather nRF52840 Express" , "NRF52840_FEATHER" ,
133
- "0x239A" , ["0x8029" , "0x0029" , "0x002A" , "0x802A" ])
133
+ # ------------------------------
134
+ # Adafruit Boards
135
+ # ------------------------------
134
136
135
- make_board ("feather52840sense" , "feather_nrf52840_sense" , "Adafruit" , "Feather nRF52840 Sense" , "NRF52840_FEATHER_SENSE" ,
136
- "0x239A" , ["0x8087" , "0x0087" , "0x0088" , "0x8088" ])
137
+ adafruit_boards_list = [
138
+ ["feather52832" , "feather_nrf52832" , "Adafruit" , "Feather nRF52832" , "NRF52832_FEATHER" ,
139
+ "0x239A" , []],
137
140
138
- make_board ( "itsybitsy52840 " , "itsybitsy_nrf52840_express " , "Adafruit" , "ItsyBitsy nRF52840 Express" , "NRF52840_ITSYBITSY -DARDUINO_NRF52_ITSYBITSY " ,
139
- "0x239A" , ["0x8051 " , "0x0051 " , "0x0052 " , "0x8052" ])
141
+ [ "feather52840 " , "feather_nrf52840_express " , "Adafruit" , "Feather nRF52840 Express" , "NRF52840_FEATHER " ,
142
+ "0x239A" , ["0x8029 " , "0x0029 " , "0x002A " , "0x802A" ]],
140
143
141
- make_board ( "cplaynrf52840 " , "circuitplayground_nrf52840 " , "Adafruit" , "Circuit Playground Bluefruit " , "NRF52840_CIRCUITPLAY " ,
142
- "0x239A" , ["0x8045 " , "0x0045 " , "0x8046" ])
144
+ [ "feather52840sense " , "feather_nrf52840_sense " , "Adafruit" , "Feather nRF52840 Sense " , "NRF52840_FEATHER_SENSE " ,
145
+ "0x239A" , ["0x8087 " , "0x0087 " , "0x0088" , "0x8088" ]],
143
146
144
- make_board ( "cluenrf52840 " , "clue_nrf52840 " , "Adafruit" , "CLUE " , "NRF52840_CLUE " ,
145
- "0x239A" , ["0x8071 " , "0x0071 " , "0x8072" ])
147
+ [ "itsybitsy52840 " , "itsybitsy_nrf52840_express " , "Adafruit" , "ItsyBitsy nRF52840 Express " , "NRF52840_ITSYBITSY -DARDUINO_NRF52_ITSYBITSY " ,
148
+ "0x239A" , ["0x8051 " , "0x0051 " , "0x0052" , "0x8052" ]],
146
149
147
- make_board ( "ledglasses_nrf52840 " , "ledglasses_nrf52840 " , "Adafruit" , "LED Glasses Driver nRF52840 " , "NRF52840_LED_GLASSES " ,
148
- "0x239A" , ["0x810D " , "0x010D " , "0x810E" ])
150
+ [ "cplaynrf52840 " , "circuitplayground_nrf52840 " , "Adafruit" , "Circuit Playground Bluefruit " , "NRF52840_CIRCUITPLAY " ,
151
+ "0x239A" , ["0x8045 " , "0x0045 " , "0x8046" ]],
149
152
150
- make_board ( "mdbt50qrx " , "raytac_mdbt50q_rx " , "Raytac " , "nRF52840 Dongle " , "MDBT50Q_RX " ,
151
- "0x239A" , ["0x810B " , "0x010B " , "0x810C" ])
153
+ [ "cluenrf52840 " , "clue_nrf52840 " , "Adafruit " , "CLUE " , "NRF52840_CLUE " ,
154
+ "0x239A" , ["0x8071 " , "0x0071 " , "0x8072" ]],
152
155
153
- make_board ("metro52840" , "metro_nrf52840_express" , "Adafruit" , "Metro nRF52840 Express" , "NRF52840_METRO" ,
154
- "0x239A" , ["0x803F" , "0x003F" , "0x0040" , "0x8040" ])
156
+ ["ledglasses_nrf52840" , "ledglasses_nrf52840" , "Adafruit" , "LED Glasses Driver nRF52840" , "NRF52840_LED_GLASSES" ,
157
+ "0x239A" , ["0x810D" , "0x010D" , "0x810E" ]],
158
+
159
+ ["mdbt50qrx" , "raytac_mdbt50q_rx" , "Raytac" , "nRF52840 Dongle" , "MDBT50Q_RX" ,
160
+ "0x239A" , ["0x810B" , "0x010B" , "0x810C" ]],
161
+
162
+ ["metro52840" , "metro_nrf52840_express" , "Adafruit" , "Metro nRF52840 Express" , "NRF52840_METRO" ,
163
+ "0x239A" , ["0x803F" , "0x003F" , "0x0040" , "0x8040" ]],
164
+ ]
165
+
166
+ for b in adafruit_boards_list :
167
+ make_board (* b )
168
+
169
+ # ------------------------------
170
+ # 3rd Party Boards
171
+ # ------------------------------
155
172
156
173
print ()
157
174
print ()
158
175
print ("# -------------------------------------------------------" )
159
- print ("#" )
160
176
print ("# Boards that aren't made by Adafruit" )
161
- print ("#" )
177
+ print ("# and are not officially supported " )
162
178
print ("# -------------------------------------------------------" )
163
179
164
- make_board ("pca10056" , "pca10056" , "Nordic" , "nRF52840 DK" , "NRF52840_PCA10056" ,
165
- "0x239A" , ["0x8029" , "0x0029" ])
180
+ thirdparty_boards_list = [
181
+ ["pca10056" , "pca10056" , "Nordic" , "nRF52840 DK" , "NRF52840_PCA10056" ,
182
+ "0x239A" , ["0x8029" , "0x0029" ]],
183
+
184
+ ["particle_xenon" , "particle_xenon" , "Particle" , "Xenon" , "PARTICLE_XENON" ,
185
+ "0x239A" , ["0x8029" , "0x0029" ]],
186
+ ]
166
187
167
- make_board ( "particle_xenon" , "particle_xenon" , "Particle" , "Xenon" , "PARTICLE_XENON" ,
168
- "0x239A" , [ "0x8029" , "0x0029" ] )
188
+ for b in thirdparty_boards_list :
189
+ make_board ( * b )
0 commit comments