Skip to content

Commit e6e87fd

Browse files
Added to possibility to have extra compiler directives for a board. (#713)
* Adds support for Challenger RP2040 WiFi boards * Added Challenger board to makeboards build script * Adds new challenger board with LTE modem. * Updated after getting approved PID from Raspberry Pi * Add support for reverse numbering of analog pins. * Added minimal HW support for onboard WiFi modem. * Added challenger-nb-rp2040-wifi and RPICO32 module. * Updated PID for RPICO32 * Added a simple support class for challenger LTE boards * Update ChallengerLTE.cpp Fixed spelling error * Adds option for setting USB max power in makeboards.py * Added new board Challenger RP2040 LoRa * Added new lora board to readme. * Added missing SERIAL2 and LoRa module GIO pins. * Added support for enabling UART CTS and RTS pins. * Updated boards.txt after merge conflict of makeboards.py * Fixed incorrect indention * Fixed PR comments * Add new Challenger RP2040 WiFi/BLE board (https://ilabs.se/challenger-rp2040-wifi-ble-datasheet) * * Updated PID for WiFi/BLE board * Added abstraction pins for both versions of wifi modules * Added support for replacing support class serial port. * Added support for retrieving support class serial port. * Fixed spelling errors. * Updated helper class for Challenger NB board. * Added Challenger sdrtc and subghz boards. * Updated readme. * Re ran makeboards to generate new index. * Added to possibility to have extra compiler directives for a board. * Added extra compiler options to JSON generation. * Allows having a list of extra macros to define * Fixed incorrect USB PID for Challenger NB board. * Added board initialization for all wifi boards. Co-authored-by: Earle F. Philhower, III <[email protected]>
1 parent 1f5139d commit e6e87fd

File tree

9 files changed

+2307
-2199
lines changed

9 files changed

+2307
-2199
lines changed

boards.txt

Lines changed: 2189 additions & 2180 deletions
Large diffs are not rendered by default.

package/package_pico_index.template.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@
5959
{
6060
"name": "DFRobot Beetle RP2040"
6161
},
62+
{
63+
"name": "iLabs Challenger 2040 LTE"
64+
},
6265
{
6366
"name": "iLabs Challenger 2040 LoRa"
6467
},
@@ -68,9 +71,6 @@
6871
{
6972
"name": "iLabs Challenger 2040 WiFi"
7073
},
71-
{
72-
"name": "iLabs Challenger 2040 LTE"
73-
},
7474
{
7575
"name": "iLabs Challenger 2040 WiFi/BLE"
7676
},

tools/json/challenger_2040_wifi.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
},
1010
"core": "earlephilhower",
1111
"cpu": "cortex-m0plus",
12-
"extra_flags": "-D ARDUINO_CHALLENGER_2040_WIFI_RP2040 -DARDUINO_ARCH_RP2040 -DUSBD_MAX_POWER_MA=250",
12+
"extra_flags": "-D ARDUINO_CHALLENGER_2040_WIFI_RP2040 -DARDUINO_ARCH_RP2040 -DUSBD_MAX_POWER_MA=250 -DWIFIESPAT2",
1313
"f_cpu": "133000000L",
1414
"hwids": [
1515
[

tools/json/challenger_2040_wifi_ble.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
},
1010
"core": "earlephilhower",
1111
"cpu": "cortex-m0plus",
12-
"extra_flags": "-D ARDUINO_CHALLENGER_2040_WIFI_BLE_RP2040 -DARDUINO_ARCH_RP2040 -DUSBD_MAX_POWER_MA=500",
12+
"extra_flags": "-D ARDUINO_CHALLENGER_2040_WIFI_BLE_RP2040 -DARDUINO_ARCH_RP2040 -DUSBD_MAX_POWER_MA=500 -DWIFIESPAT2",
1313
"f_cpu": "133000000L",
1414
"hwids": [
1515
[

tools/json/challenger_nb_2040_wifi.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
"earlephilhower": {
55
"boot2_source": "boot2_w25q080_2_padded_checksum.S",
66
"usb_vid": "0x2E8A",
7-
"usb_pid": "0x100B"
7+
"usb_pid": "0x100D"
88
}
99
},
1010
"core": "earlephilhower",
1111
"cpu": "cortex-m0plus",
12-
"extra_flags": "-D ARDUINO_CHALLENGER_NB_2040_WIFI_RP2040 -DARDUINO_ARCH_RP2040 -DUSBD_MAX_POWER_MA=500",
12+
"extra_flags": "-D ARDUINO_CHALLENGER_NB_2040_WIFI_RP2040 -DARDUINO_ARCH_RP2040 -DUSBD_MAX_POWER_MA=500 -DWIFIESPAT2",
1313
"f_cpu": "133000000L",
1414
"hwids": [
1515
[
@@ -18,7 +18,7 @@
1818
],
1919
[
2020
"0x2E8A",
21-
"0x100B"
21+
"0x100D"
2222
]
2323
],
2424
"mcu": "rp2040",

tools/makeboards.py

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def BuildIPStack(name):
9191
print('%s.menu.ipstack.ipv4ipv6.build.libpico=libpico-ipv6.a' % (name))
9292
print('%s.menu.ipstack.ipv4ipv6.build.lwipdefs=-DLWIP_IPV6=1 -DLWIP_IPV4=1' % (name))
9393

94-
def BuildHeader(name, vendor_name, product_name, vidtouse, pidtouse, vid, pid, pwr, boarddefine, variant, uploadtool, flashsize, ramsize, boot2):
94+
def BuildHeader(name, vendor_name, product_name, vidtouse, pidtouse, vid, pid, pwr, boarddefine, variant, uploadtool, flashsize, ramsize, boot2, extra):
9595
prettyname = vendor_name + " " + product_name
9696
print()
9797
print("# -----------------------------------")
@@ -122,6 +122,11 @@ def BuildHeader(name, vendor_name, product_name, vidtouse, pidtouse, vid, pid, p
122122
print("%s.build.pid=%s" % (name, pid))
123123
print('%s.build.usb_manufacturer="%s"' % (name, vendor_name))
124124
print('%s.build.usb_product="%s"' % (name, product_name))
125+
if extra != None:
126+
m_extra = ''
127+
for m_item in extra:
128+
m_extra += '-D' + m_item + ' '
129+
print('%s.build.extra_flags=%s' % (name, m_extra.rstrip()))
125130

126131
def WriteWarning():
127132
print("# WARNING - DO NOT EDIT THIS FILE, IT IS MACHINE GENERATED")
@@ -143,7 +148,7 @@ def BuildGlobalMenuList():
143148
print("menu.usbstack=USB Stack")
144149
print("menu.ipstack=IP Stack")
145150

146-
def MakeBoard(name, vendor_name, product_name, vid, pid, pwr, boarddefine, flashsizemb, boot2):
151+
def MakeBoard(name, vendor_name, product_name, vid, pid, pwr, boarddefine, flashsizemb, boot2, extra = None):
147152
for a, b, c in [ ["", "", "uf2conv"], ["picoprobe", " (Picoprobe)", "picoprobe"], ["picodebug", " (pico-debug)", "picodebug"]]:
148153
n = name + a
149154
p = product_name + b
@@ -160,7 +165,7 @@ def MakeBoard(name, vendor_name, product_name, vid, pid, pwr, boarddefine, flash
160165
ramsizekb = 240;
161166
else:
162167
pidtouse = pid
163-
BuildHeader(n, vendor_name, p, vidtouse, pidtouse, vid, pid, pwr, boarddefine, name, c, flashsizemb * 1024 * 1024, ramsizekb * 1024, boot2)
168+
BuildHeader(n, vendor_name, p, vidtouse, pidtouse, vid, pid, pwr, boarddefine, name, c, flashsizemb * 1024 * 1024, ramsizekb * 1024, boot2, extra)
164169
if name == "generic":
165170
BuildFlashMenu(n, 2*1024*1024, [0, 1*1024*1024])
166171
BuildFlashMenu(n, 4*1024*1024, [0, 2*1024*1024])
@@ -182,13 +187,19 @@ def MakeBoard(name, vendor_name, product_name, vid, pid, pwr, boarddefine, flash
182187
BuildIPStack(n)
183188
if name == "generic":
184189
BuildBoot(n)
185-
MakeBoardJSON(name, vendor_name, product_name, vid, pid, pwr, boarddefine, flashsizemb, boot2)
190+
MakeBoardJSON(name, vendor_name, product_name, vid, pid, pwr, boarddefine, flashsizemb, boot2, extra)
186191
global pkgjson
187192
thisbrd = {}
188193
thisbrd['name'] = "%s %s" % (vendor_name, product_name)
189194
pkgjson['packages'][0]['platforms'][0]['boards'].append(thisbrd)
190195

191-
def MakeBoardJSON(name, vendor_name, product_name, vid, pid, pwr, boarddefine, flashsizemb, boot2):
196+
def MakeBoardJSON(name, vendor_name, product_name, vid, pid, pwr, boarddefine, flashsizemb, boot2, extra):
197+
if extra != None:
198+
m_extra = ' '
199+
for m_item in extra:
200+
m_extra += '-D' + m_item + ' '
201+
else:
202+
m_extra = ''
192203
json = """{
193204
"build": {
194205
"arduino": {
@@ -200,7 +211,7 @@ def MakeBoardJSON(name, vendor_name, product_name, vid, pid, pwr, boarddefine, f
200211
},
201212
"core": "earlephilhower",
202213
"cpu": "cortex-m0plus",
203-
"extra_flags": "-D ARDUINO_BOARDDEFINE -DARDUINO_ARCH_RP2040 -DUSBD_MAX_POWER_MA=USBPWR",
214+
"extra_flags": "-D ARDUINO_BOARDDEFINE -DARDUINO_ARCH_RP2040 -DUSBD_MAX_POWER_MA=USBPWR EXTRA_INFO",
204215
"f_cpu": "133000000L",
205216
"hwids": [
206217
[
@@ -251,7 +262,8 @@ def MakeBoardJSON(name, vendor_name, product_name, vid, pid, pwr, boarddefine, f
251262
.replace('VENDORNAME', vendor_name)\
252263
.replace('PRODUCTNAME', product_name)\
253264
.replace('FLASHSIZE', str(1024*1024*flashsizemb))\
254-
.replace('USBPWR', str(pwr))
265+
.replace('USBPWR', str(pwr))\
266+
.replace(' EXTRA_INFO', m_extra.rstrip())
255267
jsondir = os.path.abspath(os.path.dirname(__file__)) + "/json"
256268
f = open(jsondir + "/" + name + ".json", "w")
257269
f.write(json)
@@ -295,12 +307,12 @@ def MakeBoardJSON(name, vendor_name, product_name, vid, pid, pwr, boarddefine, f
295307
MakeBoard("dfrobot_beetle_rp2040", "DFRobot", "Beetle RP2040", "0x3343", "0x4253", 250, "DFROBOT_BEETLE_RP2040", 2, "boot2_w25q080_2_padded_checksum")
296308

297309
# iLabs
310+
MakeBoard("challenger_2040_lte", "iLabs", "Challenger 2040 LTE", "0x2e8a", "0x100b", 500, "CHALLENGER_2040_LTE_RP2040", 8, "boot2_w25q080_2_padded_checksum")
298311
MakeBoard("challenger_2040_lora", "iLabs", "Challenger 2040 LoRa", "0x2e8a", "0x1023", 250, "CHALLENGER_2040_LORA_RP2040", 8, "boot2_w25q080_2_padded_checksum")
299312
MakeBoard("challenger_2040_subghz", "iLabs", "Challenger 2040 SubGHz", "0x2e8a", "0x1032", 250, "CHALLENGER_2040_SUBGHZ_RP2040", 8, "boot2_w25q080_2_padded_checksum")
300-
MakeBoard("challenger_2040_wifi", "iLabs", "Challenger 2040 WiFi", "0x2e8a", "0x1006", 250, "CHALLENGER_2040_WIFI_RP2040", 8, "boot2_w25q080_2_padded_checksum")
301-
MakeBoard("challenger_2040_lte", "iLabs", "Challenger 2040 LTE", "0x2e8a", "0x100b", 500, "CHALLENGER_2040_LTE_RP2040", 8, "boot2_w25q080_2_padded_checksum")
302-
MakeBoard("challenger_2040_wifi_ble", "iLabs", "Challenger 2040 WiFi/BLE", "0x2e8a", "0x102C", 500, "CHALLENGER_2040_WIFI_BLE_RP2040", 8, "boot2_w25q080_2_padded_checksum")
303-
MakeBoard("challenger_nb_2040_wifi", "iLabs", "Challenger NB 2040 WiFi", "0x2e8a", "0x100b", 500, "CHALLENGER_NB_2040_WIFI_RP2040", 8, "boot2_w25q080_2_padded_checksum")
313+
MakeBoard("challenger_2040_wifi", "iLabs", "Challenger 2040 WiFi", "0x2e8a", "0x1006", 250, "CHALLENGER_2040_WIFI_RP2040", 8, "boot2_w25q080_2_padded_checksum", ["WIFIESPAT2"])
314+
MakeBoard("challenger_2040_wifi_ble", "iLabs", "Challenger 2040 WiFi/BLE", "0x2e8a", "0x102C", 500, "CHALLENGER_2040_WIFI_BLE_RP2040", 8, "boot2_w25q080_2_padded_checksum", ["WIFIESPAT2"])
315+
MakeBoard("challenger_nb_2040_wifi", "iLabs", "Challenger NB 2040 WiFi", "0x2e8a", "0x100d", 500, "CHALLENGER_NB_2040_WIFI_RP2040", 8, "boot2_w25q080_2_padded_checksum", ["WIFIESPAT2"])
304316
MakeBoard("challenger_2040_sdrtc", "iLabs", "Challenger 2040 SD/RTC", "0x2e8a", "0x102d", 250, "CHALLENGER_NB_2040_SDRTC_RP2040", 8, "boot2_w25q080_2_padded_checksum")
305317
MakeBoard("ilabs_rpico32", "iLabs", "RPICO32", "0x2e8a", "0x1010", 250, "ILABS_2040_RPICO32_RP2040", 8, "boot2_w25q080_2_padded_checksum")
306318

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
ESP8285/ESP32C3 helper class for the Challenger RP2040 WiFi enabled boards
3+
4+
Copyright (c) 2021,2022 P. Oldberg <[email protected]>
5+
6+
This library is free software; you can redistribute it and/or
7+
modify it under the terms of the GNU Lesser General Public
8+
License as published by the Free Software Foundation; either
9+
version 2.1 of the License, or (at your option) any later version.
10+
11+
This library is distributed in the hope that it will be useful,
12+
but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14+
Lesser General Public License for more details.
15+
16+
You should have received a copy of the GNU Lesser General Public
17+
License along with this library; if not, write to the Free Software
18+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19+
*/
20+
#include <Arduino.h>
21+
#include <ChallengerWiFi.h>
22+
23+
/**
24+
* Just make sure we try to reset the ESP device before the user starts
25+
* using the device.
26+
*/
27+
void initVariant() {
28+
Challenger2040WiFi.reset();
29+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
ESP8285/ESP32C3 helper class for the Challenger RP2040 WiFi enabled boards
3+
4+
Copyright (c) 2021,2022 P. Oldberg <[email protected]>
5+
6+
This library is free software; you can redistribute it and/or
7+
modify it under the terms of the GNU Lesser General Public
8+
License as published by the Free Software Foundation; either
9+
version 2.1 of the License, or (at your option) any later version.
10+
11+
This library is distributed in the hope that it will be useful,
12+
but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14+
Lesser General Public License for more details.
15+
16+
You should have received a copy of the GNU Lesser General Public
17+
License along with this library; if not, write to the Free Software
18+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19+
*/
20+
#include <Arduino.h>
21+
#include <ChallengerWiFi.h>
22+
23+
/**
24+
* Just make sure we try to reset the ESP device before the user starts
25+
* using the device.
26+
*/
27+
void initVariant() {
28+
Challenger2040WiFi.reset();
29+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
ESP8285/ESP32C3 helper class for the Challenger RP2040 WiFi enabled boards
3+
4+
Copyright (c) 2021,2022 P. Oldberg <[email protected]>
5+
6+
This library is free software; you can redistribute it and/or
7+
modify it under the terms of the GNU Lesser General Public
8+
License as published by the Free Software Foundation; either
9+
version 2.1 of the License, or (at your option) any later version.
10+
11+
This library is distributed in the hope that it will be useful,
12+
but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14+
Lesser General Public License for more details.
15+
16+
You should have received a copy of the GNU Lesser General Public
17+
License along with this library; if not, write to the Free Software
18+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19+
*/
20+
#include <Arduino.h>
21+
#include <ChallengerWiFi.h>
22+
23+
/**
24+
* Just make sure we try to reset the ESP device before the user starts
25+
* using the device.
26+
*/
27+
void initVariant() {
28+
Challenger2040WiFi.reset();
29+
}

0 commit comments

Comments
 (0)