Skip to content

Commit 581328f

Browse files
committed
Have proper (relocated) Nano33BLE board
1 parent a2f5817 commit 581328f

File tree

33 files changed

+298
-1098
lines changed

33 files changed

+298
-1098
lines changed

boards.txt

+28-68
Original file line numberDiff line numberDiff line change
@@ -66,72 +66,32 @@ envie_m4.upload.native_usb=false
6666

6767
##############################################################
6868

69-
nrf52840.name=Arduino Nano33BLE
70-
nrf52840.build.core=arduino
71-
nrf52840.build.crossprefix=arm-none-eabi-
72-
nrf52840.build.compiler_path={runtime.tools.arm-none-eabi-gcc.path}/bin/
73-
74-
nrf52840.build.variant=NRF52840_DK
75-
nrf52840.build.mcu=cortex-m4
76-
nrf52840.build.extra_flags=
77-
nrf52840.build.architecture=cortex-m4
78-
nrf52840.build.board=NRF52840_DK
79-
nrf52840.build.ldscript=linker_script.ld
80-
nrf52840.build.zip.pattern="{tools.nrfutil.cmd}" dfu genpkg --dev-type 0x0052 --sd-req {build.sd_fwid} --application "{build.path}/{build.project_name}.hex" "{build.path}/{build.project_name}.zip"
81-
nrf52840.compiler.mbed.defines={build.variant.path}/defines.txt
82-
nrf52840.compiler.mbed.ldflags={build.variant.path}/ldflags.txt
83-
nrf52840.compiler.mbed.cflags={build.variant.path}/cflags.txt
84-
nrf52840.compiler.mbed.cxxflags={build.variant.path}/cxxflags.txt
85-
nrf52840.compiler.mbed.includes={build.variant.path}/includes.txt
86-
nrf52840.compiler.mbed.extra_ldflags=-lstdc++ -lsupc++ -lm -lc -lgcc -lnosys
87-
nrf52840.compiler.mbed="{build.variant.path}/libs/libmbed.a" "{build.variant.path}/libs/libcc_310_core.a" "{build.variant.path}/libs/libcc_310_ext.a" "{build.variant.path}/libs/libcc_310_trng.a"
88-
nrf52840.vid.0=0x2341
89-
nrf52840.pid.0=0x005a
90-
91-
nrf52840.build.sd_name=s132
92-
nrf52840.build.sd_version=6.1.1
93-
nrf52840.build.sd_fwid=0xFFFE
94-
95-
nrf52840.upload.tool=nrfutil
96-
nrf52840.upload.protocol=nrfutil
97-
nrf52840.upload.use_1200bps_touch=true
98-
nrf52840.upload.wait_for_upload_port=true
99-
nrf52840.upload.native_usb=true
100-
nrf52840.upload.maximum_size=917504
101-
nrf52840.upload.maximum_data_size=262144
102-
103-
##############################################################
104-
105-
nrf52840_nosd.name=Arduino Nano33BLE (Cordio)
106-
nrf52840_nosd.build.core=arduino
107-
nrf52840_nosd.build.crossprefix=arm-none-eabi-
108-
nrf52840_nosd.build.compiler_path={runtime.tools.arm-none-eabi-gcc.path}/bin/
109-
110-
nrf52840_nosd.build.variant=NRF52840_DK_NOSD
111-
nrf52840_nosd.build.mcu=cortex-m4
112-
nrf52840_nosd.build.extra_flags=
113-
nrf52840_nosd.build.architecture=cortex-m4
114-
nrf52840_nosd.build.board=NRF52840_DK_NOSD
115-
nrf52840_nosd.build.ldscript=linker_script.ld
116-
nrf52840_nosd.compiler.mbed.defines={build.variant.path}/defines.txt
117-
nrf52840_nosd.compiler.mbed.ldflags={build.variant.path}/ldflags.txt
118-
nrf52840_nosd.compiler.mbed.cflags={build.variant.path}/cflags.txt
119-
nrf52840_nosd.compiler.mbed.cxxflags={build.variant.path}/cxxflags.txt
120-
nrf52840_nosd.compiler.mbed.includes={build.variant.path}/includes.txt
121-
nrf52840_nosd.compiler.mbed.extra_ldflags=-lstdc++ -lsupc++ -lm -lc -lgcc -lnosys
122-
nrf52840_nosd.compiler.mbed="{build.variant.path}/libs/libmbed.a" "{build.variant.path}/libs/libcc_310_core.a" "{build.variant.path}/libs/libcc_310_ext.a" "{build.variant.path}/libs/libcc_310_trng.a"
123-
nrf52840_nosd.vid.0=0x2341
124-
nrf52840_nosd.pid.0=0x005a
125-
126-
nrf52840_nosd.build.sd_name=s132
127-
nrf52840_nosd.build.sd_version=6.1.1
128-
nrf52840_nosd.build.sd_fwid=0xFFFE
129-
130-
nrf52840_nosd.upload.tool=dfu-util
131-
nrf52840_nosd.upload.protocol=
132-
nrf52840_nosd.upload.use_1200bps_touch=true
133-
nrf52840_nosd.upload.wait_for_upload_port=true
134-
nrf52840_nosd.upload.native_usb=true
135-
nrf52840_nosd.upload.maximum_size=983040
136-
nrf52840_nosd.upload.maximum_data_size=262144
69+
nano33ble.name=Arduino Nano33BLE
70+
nano33ble.build.core=arduino
71+
nano33ble.build.crossprefix=arm-none-eabi-
72+
nano33ble.build.compiler_path={runtime.tools.arm-none-eabi-gcc.path}/bin/
73+
74+
nano33ble.build.variant=ARDUINO_NANO33BLE
75+
nano33ble.build.mcu=cortex-m4
76+
nano33ble.build.extra_flags=
77+
nano33ble.build.architecture=cortex-m4
78+
nano33ble.build.board=ARDUINO_NANO33BLE
79+
nano33ble.build.ldscript=linker_script.ld
80+
nano33ble.compiler.mbed.defines={build.variant.path}/defines.txt
81+
nano33ble.compiler.mbed.ldflags={build.variant.path}/ldflags.txt
82+
nano33ble.compiler.mbed.cflags={build.variant.path}/cflags.txt
83+
nano33ble.compiler.mbed.cxxflags={build.variant.path}/cxxflags.txt
84+
nano33ble.compiler.mbed.includes={build.variant.path}/includes.txt
85+
nano33ble.compiler.mbed.extra_ldflags=-lstdc++ -lsupc++ -lm -lc -lgcc -lnosys
86+
nano33ble.compiler.mbed="{build.variant.path}/libs/libmbed.a" "{build.variant.path}/libs/libcc_310_core.a" "{build.variant.path}/libs/libcc_310_ext.a" "{build.variant.path}/libs/libcc_310_trng.a"
87+
nano33ble.vid.0=0x2341
88+
nano33ble.pid.0=0x005a
89+
90+
nano33ble.upload.tool=dfu-util
91+
nano33ble.upload.protocol=
92+
nano33ble.upload.use_1200bps_touch=true
93+
nano33ble.upload.wait_for_upload_port=true
94+
nano33ble.upload.native_usb=true
95+
nano33ble.upload.maximum_size=983040
96+
nano33ble.upload.maximum_data_size=262144
13797

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,203 @@
1+
/*
2+
* Copyright (c) 2016 Nordic Semiconductor ASA
3+
* All rights reserved.
4+
*
5+
* Redistribution and use in source and binary forms, with or without modification,
6+
* are permitted provided that the following conditions are met:
7+
*
8+
* 1. Redistributions of source code must retain the above copyright notice, this list
9+
* of conditions and the following disclaimer.
10+
*
11+
* 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA
12+
* integrated circuit in a product or a software update for such product, must reproduce
13+
* the above copyright notice, this list of conditions and the following disclaimer in
14+
* the documentation and/or other materials provided with the distribution.
15+
*
16+
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be
17+
* used to endorse or promote products derived from this software without specific prior
18+
* written permission.
19+
*
20+
* 4. This software, with or without modification, must only be used with a
21+
* Nordic Semiconductor ASA integrated circuit.
22+
*
23+
* 5. Any software provided in binary or object form under this license must not be reverse
24+
* engineered, decompiled, modified and/or disassembled.
25+
*
26+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
27+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
28+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
29+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
30+
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
31+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
32+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
33+
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36+
*
37+
*/
38+
39+
#ifndef MBED_PINNAMES_H
40+
#define MBED_PINNAMES_H
41+
42+
#include "cmsis.h"
43+
#include "nrf_gpio.h"
44+
45+
#ifdef __cplusplus
46+
extern "C" {
47+
#endif
48+
49+
typedef enum {
50+
PIN_INPUT,
51+
PIN_OUTPUT
52+
} PinDirection;
53+
54+
///> define macro producing for example Px_y = NRF_GPIO_PIN_MAP(x, y)
55+
#define PinDef(port_num, pin_num) P##port_num##_##pin_num = NRF_GPIO_PIN_MAP(port_num, pin_num)
56+
57+
58+
typedef enum {
59+
PinDef(0 , 0), // P0_0 = 0...
60+
PinDef(0 , 1),
61+
PinDef(0 , 2),
62+
PinDef(0 , 3),
63+
PinDef(0 , 4),
64+
PinDef(0 , 5),
65+
PinDef(0 , 6),
66+
PinDef(0 , 7),
67+
PinDef(0 , 8),
68+
PinDef(0 , 9),
69+
PinDef(0 , 10),
70+
PinDef(0 , 11),
71+
PinDef(0 , 12),
72+
PinDef(0 , 13),
73+
PinDef(0 , 14),
74+
PinDef(0 , 15),
75+
PinDef(0 , 16),
76+
PinDef(0 , 17),
77+
PinDef(0 , 18),
78+
PinDef(0 , 19),
79+
PinDef(0 , 20),
80+
PinDef(0 , 21),
81+
PinDef(0 , 22),
82+
PinDef(0 , 23),
83+
PinDef(0 , 24),
84+
PinDef(0 , 25),
85+
PinDef(0 , 26),
86+
PinDef(0 , 27),
87+
PinDef(0 , 28),
88+
PinDef(0 , 29),
89+
PinDef(0 , 30),
90+
PinDef(0 , 31),
91+
92+
PinDef(1 , 0), //P1_1 = 32...
93+
PinDef(1 , 1),
94+
PinDef(1 , 2),
95+
PinDef(1 , 3),
96+
PinDef(1 , 4),
97+
PinDef(1 , 5),
98+
PinDef(1 , 6),
99+
PinDef(1 , 7),
100+
PinDef(1 , 8),
101+
PinDef(1 , 9),
102+
PinDef(1 , 10),
103+
PinDef(1 , 11),
104+
PinDef(1 , 12),
105+
PinDef(1 , 13),
106+
PinDef(1 , 14),
107+
PinDef(1 , 15),
108+
109+
// Port0
110+
p0 = P0_0,
111+
p1 = P0_1,
112+
p2 = P0_2,
113+
p3 = P0_3,
114+
p4 = P0_4,
115+
p5 = P0_5,
116+
p6 = P0_6,
117+
p7 = P0_7,
118+
p8 = P0_8,
119+
p9 = P0_9,
120+
p10 = P0_10,
121+
p11 = P0_11,
122+
p12 = P0_12,
123+
p13 = P0_13,
124+
p14 = P0_14,
125+
p15 = P0_15,
126+
p16 = P0_16,
127+
p17 = P0_17,
128+
p18 = P0_18,
129+
p19 = P0_19,
130+
p20 = P0_20,
131+
p21 = P0_21,
132+
p22 = P0_22,
133+
p23 = P0_23,
134+
p24 = P0_24,
135+
p25 = P0_25,
136+
p26 = P0_26,
137+
p27 = P0_27,
138+
p28 = P0_28,
139+
p29 = P0_29,
140+
p30 = P0_30,
141+
p31 = P0_31,
142+
143+
// Port1
144+
p32 = P1_0,
145+
p33 = P1_1,
146+
p34 = P1_2,
147+
p35 = P1_3,
148+
p36 = P1_4,
149+
p37 = P1_5,
150+
p38 = P1_6,
151+
p39 = P1_7,
152+
p40 = P1_8,
153+
p41 = P1_9,
154+
p42 = P1_10,
155+
p43 = P1_11,
156+
p44 = P1_12,
157+
p45 = P1_13,
158+
p46 = P1_14,
159+
p47 = P1_15,
160+
161+
RX_PIN_NUMBER = p42,
162+
TX_PIN_NUMBER = p35,
163+
164+
LED1 = p13,
165+
166+
// mBed interface Pins
167+
USBTX = TX_PIN_NUMBER,
168+
USBRX = RX_PIN_NUMBER,
169+
STDIO_UART_TX = TX_PIN_NUMBER,
170+
STDIO_UART_RX = RX_PIN_NUMBER,
171+
172+
SPI_PSELMOSI0 = P1_1,
173+
SPI_PSELMISO0 = P1_8,
174+
SPI_PSELSCK0 = P0_13,
175+
176+
SPIS_PSELMOSI = P1_1,
177+
SPIS_PSELMISO = P1_8,
178+
SPIS_PSELSCK = P0_13,
179+
180+
I2C_SDA0 = p26,
181+
I2C_SCL0 = p27,
182+
183+
// Not connected
184+
NC = (int)0xFFFFFFFF,
185+
186+
STDIO_UART_RTS = NC,
187+
STDIO_UART_CTS = NC,
188+
SPI_PSELSS0 = NC,
189+
SPIS_PSELSS = NC
190+
} PinName;
191+
192+
typedef enum {
193+
PullNone = 0,
194+
PullDown = 1,
195+
PullUp = 3,
196+
PullDefault = PullUp
197+
} PinMode;
198+
199+
#ifdef __cplusplus
200+
}
201+
#endif
202+
203+
#endif
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// The 'features' section in 'target.json' is now used to create the device's hardware preprocessor switches.
2+
// Check the 'features' section of the target description in 'targets.json' for more details.
3+
/* mbed Microcontroller Library
4+
* Copyright (c) 2006-2013 ARM Limited
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
#ifndef MBED_DEVICE_H
19+
#define MBED_DEVICE_H
20+
21+
22+
23+
24+
25+
26+
27+
28+
29+
30+
31+
32+
33+
34+
35+
36+
#include "objects.h"
37+
38+
#endif

cores/arduino/mbed/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/TARGET_MCU_NRF52840/TARGET_NRF52840_DK/PinNames.h

+7
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,13 @@ typedef enum {
218218
D14 = p26,
219219
D15 = p27,
220220

221+
A0 = p3,
222+
A1 = p4,
223+
A2 = p28,
224+
A3 = p29,
225+
A4 = p30,
226+
A5 = p31,
227+
221228
/**** QSPI pins ****/
222229
QSPI1_IO0 = P0_20,
223230
QSPI1_IO1 = P0_21,

mbed-os-to-arduino

+6-11
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash -ex
22

33
MBED_CORE_LOCATION=$1
4-
BOARDNAMES=(ENVIE_M4 MBED_CONNECT_ODIN NRF52840_DK NRF52840_DK)
4+
BOARDNAMES=(ENVIE_M4 MBED_CONNECT_ODIN ARDUINO_NANO33BLE)
55

66
#always work in /tmp
77
cd /tmp/
@@ -28,17 +28,12 @@ mbed toolchain GCC_ARM
2828
echo -e "#include \"mbed.h\"\nint main() {Thread thd;}" > main.cpp
2929
echo -e "{\n\"macros\": [\n\"MBED_HEAP_STATS_ENABLED=1\",\n\"MBED_STACK_STATS_ENABLED=1\",\n\"MBED_MEM_TRACING_ENABLED=1\"\n],\n\"target_overrides\": {\n \"*\": {\n\"platform.stdio-buffered-serial\": true,\n\"platform.stdio-baud-rate\": 115200,\n\"platform.default-serial-baud-rate\": 115200\n}\n}\n}\n" > mbed_app.json
3030

31-
rm -rf BUILD
32-
33-
if [ $BOARDNAME == NRF52840_DK ]; then
34-
if [ x$NO_SD_TARGET == x"" ]; then
35-
echo -e "{\n\"macros\": [\n\"MBED_HEAP_STATS_ENABLED=1\",\n\"MBED_STACK_STATS_ENABLED=1\",\n\"MBED_MEM_TRACING_ENABLED=1\"\n],\n\"target_overrides\": {\n \"*\": {\n\"platform.stdio-buffered-serial\": true,\n\"platform.stdio-baud-rate\": 115200,\n\"platform.default-serial-baud-rate\": 115200,\n\"target.features_add\": [\"BLE\"],\"target.extra_labels_remove\": [\"CORDIO\", \"CORDIO_LL\", \"SOFTDEVICE_NONE\", \"NORDIC_CORDIO\"],\"target.extra_labels_add\": [\"SOFTDEVICE_COMMON\", \"SOFTDEVICE_S140_FULL\", \"NORDIC_SOFTDEVICE\"]}\n}\n}\n" > mbed_app.json
36-
NO_SD_TARGET=true
37-
else
38-
ARDUINOCORE=$MBED_CORE_LOCATION/variants/NRF52840_DK_NOSD
39-
fi
31+
if [ $BOARDNAME == "ARDUINO_NANO33BLE" ]; then
32+
echo -e "{\n\"macros\": [\n\"MBED_HEAP_STATS_ENABLED=1\",\n\"MBED_STACK_STATS_ENABLED=1\",\n\"MBED_MEM_TRACING_ENABLED=1\"\n],\n\"target_overrides\": {\n \"*\": {\n\"platform.stdio-buffered-serial\": true,\n\"platform.stdio-baud-rate\": 115200,\n\"platform.default-serial-baud-rate\": 115200,\n\"target.mbed_app_start\": \"0x10200\"}\n}\n}\n" > mbed_app.json
4033
fi
4134

35+
rm -rf BUILD
36+
4237
mbed compile -v | grep "Macros:" > $BOARDNAME.macros.txt
4338
cat $BOARDNAME.macros.txt | cut -f2 -d":" | sed 's# #\n#g' | sed 's#\"#\\"#g' | sort > $ARDUINOCORE/defines.txt
4439
echo "-DMBED_NO_GLOBAL_USING_DIRECTIVE=1" >> $ARDUINOCORE/defines.txt
@@ -60,7 +55,7 @@ cd mbed-os && find . | grep "\.h" | xargs -I % cp --parents % $ARDUINOCORE/../..
6055

6156
#TODO: add #include "mbed_config.h" in "mbed.h"
6257
#TODO: rename drivers/SPI.h in drivers/SPIMaster.h and modify include in mbed.h
63-
mv cores/arduino/mbed/drivers/SPI.h cores/arduino/mbed/drivers/SPIMaster.h
58+
mv $ARDUINOCORE/../../cores/arduino/mbed/drivers/SPI.h $ARDUINOCORE/../../cores/arduino/mbed/drivers/SPIMaster.h
6459

6560
exit 0
6661

0 commit comments

Comments
 (0)