Skip to content
This repository was archived by the owner on Apr 24, 2019. It is now read-only.

Commit 6a931cc

Browse files
author
Janne Kiiskilä
committed
configs/*.json based configurations
Per Marcelo Salazar's proposal add configuration examples to a configs-folder. By default the repo does not anymore have an mbed_app.json at all, but one should copy one of the example configs, potentially modify it and use it. Jenkinsfile was modified to do the copy operation at the beginning. Add the emac for UBLOX to Wifi configs. Reference: #137
1 parent f254781 commit 6a931cc

File tree

11 files changed

+264
-2
lines changed

11 files changed

+264
-2
lines changed

Jenkinsfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ timestamps {
6666
}
6767

6868
def buildStep(target, compilerLabel, toolchain, configName, connectiontype) {
69+
// Make us "backwards compatible" the easy way...
70+
execute ("cp configs/example.json mbed_app.json")
71+
6972
return {
7073
stage ("${target}_${compilerLabel}_${configName}_${connectiontype}") {
7174
node ("${compilerLabel}") {

README.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,19 @@ For example, NUCLEO_F401RE requires a different serial connection:
232232

233233
### IP address setup
234234

235-
This example uses IPv4 to communicate with the [mbed Device Connector Server](https://api.connector.mbed.com) except for 6LoWPAN ND and Thread. The example program should automatically get an IPv4 address from the router when connected over Ethernet.
235+
This example uses IPv4 to communicate with the [mbed Device Connector Server](https://api.connector.mbed.com) except for 6LoWPAN ND and Thread. However, you can easily change it to IPv6
236+
by changing the mbed_app.json you make:
237+
``` "target_overrides": {
238+
"*": {
239+
"target.features_add": ["LWIP", "NANOSTACK", "COMMON_PAL"],
240+
"lwip.ipv4-enabled": false,
241+
"lwip.ipv6-enabled": true,
242+
"mbed-trace.enable": 0
243+
}
244+
```
245+
by modifying the ipv4-enable or ipv6-enable to true/false. Only one should be true.
246+
247+
The example program should automatically get an IP address from the router when connected over Ethernet or WiFi.
236248

237249
If your network does not have DHCP enabled, you have to manually assign a static IP address to the board. We recommend having DHCP enabled to make everything run smoothly.
238250

@@ -260,7 +272,8 @@ To build the example using mbed CLI:
260272
mbed import mbed-os-example-client
261273
```
262274
263-
3. [Configure](#application-setup) the client application.
275+
3. Copy the relevant example configuration file from configs/xxx.json to mbed_app.json and
276+
[Configure](#application-setup) the client application.
264277
265278
4. To build the application, select the hardware board and build the toolchain using the command:
266279

build_all.sh

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
set -e
2+
3+
cp configs/eth_v4.json ./mbed_app.json
4+
mbed compile -m K64F -t GCC_ARM -c
5+
cp BUILD/K64F/GCC_ARM/mbed-os-example-client.bin k64f_eth_v4.bin
6+
7+
cp configs/eth_v6.json ./mbed_app.json
8+
mbed compile -m K64F -t GCC_ARM -c
9+
cp BUILD/K64F/GCC_ARM/mbed-os-example-client.bin k64f_eth_v6.bin
10+
11+
cp configs/wifi_v4.json ./mbed_app.json
12+
mbed compile -m K64F -t GCC_ARM -c
13+
cp BUILD/K64F/GCC_ARM/mbed-os-example-client.bin k64f_wifi_v4.bin
14+
mbed compile -m UBLOX_EVK_ODIN_W2 -t GCC_ARM -c
15+
cp ./BUILD/UBLOX_EVK_ODIN_W2/GCC_ARM/mbed-os-example-client.bin ublox_odin_wifi_v4.bin
16+
17+
cp configs/wifi_v6.json ./mbed_app.json
18+
mbed compile -m K64F -t GCC_ARM -c
19+
cp BUILD/K64F/GCC_ARM/mbed-os-example-client.bin k64f_wifi_v6.bin
20+
mbed compile -m UBLOX_EVK_ODIN_W2 -t GCC_ARM -c
21+
cp ./BUILD/UBLOX_EVK_ODIN_W2/GCC_ARM/mbed-os-example-client.bin ublox_odin_wifi_v6.bin
22+
23+
cp configs/mesh_6lowpan.json ./mbed_app.json
24+
mbed compile -m K64F -t GCC_ARM -c
25+
cp BUILD/K64F/GCC_ARM/mbed-os-example-client.bin k64f_6lowpan.bin
26+
27+
cp configs/mesh_thread.json ./mbed_app.json
28+
mbed compile -m K64F -t GCC_ARM -c
29+
cp BUILD/K64F/GCC_ARM/mbed-os-example-client.bin k64f_thread.bin
30+
31+
32+
33+

configs/eth_v4.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"config": {
3+
"network-interface":{
4+
"help": "options are ETHERNET,WIFI,MESH_LOWPAN_ND,MESH_THREAD",
5+
"value": "ETHERNET"
6+
}
7+
},
8+
"macros": ["MBEDTLS_USER_CONFIG_FILE=\"mbedtls_mbed_client_config.h\""],
9+
"target_overrides": {
10+
"*": {
11+
"target.features_add": ["LWIP", "NANOSTACK", "COMMON_PAL"],
12+
"lwip.ipv4-enabled": true,
13+
"lwip.ipv6-enabled": false,
14+
"mbed-trace.enable": 0
15+
}
16+
}
17+
}

configs/eth_v6.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"config": {
3+
"network-interface":{
4+
"help": "options are ETHERNET,WIFI,MESH_LOWPAN_ND,MESH_THREAD",
5+
"value": "ETHERNET"
6+
}
7+
},
8+
"macros": ["MBEDTLS_USER_CONFIG_FILE=\"mbedtls_mbed_client_config.h\""],
9+
"target_overrides": {
10+
"*": {
11+
"target.features_add": ["LWIP", "NANOSTACK", "COMMON_PAL"],
12+
"lwip.ipv4-enabled": false,
13+
"lwip.ipv6-enabled": true,
14+
"mbed-trace.enable": 0
15+
}
16+
}
17+
}
File renamed without changes.

configs/mbed_app.json

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
"config": {
3+
"network-interface":{
4+
"help": "options are ETHERNET,WIFI,MESH_LOWPAN_ND,MESH_THREAD",
5+
"value": "ETHERNET"
6+
},
7+
"mesh_radio_type": {
8+
"help": "options are ATMEL, MCR20",
9+
"value": "ATMEL"
10+
},
11+
"wifi-ssid": {
12+
"help": "WiFi SSID",
13+
"value": "\"SSID\""
14+
},
15+
"wifi-password": {
16+
"help": "WiFi Password",
17+
"value": "\"Password\""
18+
},
19+
"wifi-tx": {
20+
"help": "TX pin for serial connection to external device",
21+
"value": "D1"
22+
},
23+
"wifi-rx": {
24+
"help": "RX pin for serial connection to external device",
25+
"value": "D0"
26+
}
27+
},
28+
"macros": ["MBEDTLS_USER_CONFIG_FILE=\"mbedtls_mbed_client_config.h\""],
29+
"target_overrides": {
30+
"*": {
31+
"target.features_add": ["NANOSTACK", "LOWPAN_ROUTER", "COMMON_PAL"],
32+
"mbed-mesh-api.6lowpan-nd-channel-page": 0,
33+
"mbed-mesh-api.6lowpan-nd-channel": 12,
34+
"mbed-trace.enable": 0
35+
},
36+
"NUCLEO_F401RE": {
37+
"wifi-tx": "PA_11",
38+
"wifi-rx": "PA_12"
39+
},
40+
"NUCLEO_F411RE": {
41+
"wifi-tx": "PA_11",
42+
"wifi-rx": "PA_12"
43+
}
44+
}
45+
}

configs/mesh_6lowpan.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"config": {
3+
"network-interface":{
4+
"help": "options are ETHERNET,WIFI,MESH_LOWPAN_ND,MESH_THREAD",
5+
"value": "MESH_LOWPAN_ND"
6+
},
7+
"mesh_radio_type": {
8+
"help": "options are ATMEL, MCR20",
9+
"value": "ATMEL"
10+
}
11+
},
12+
"macros": ["MBEDTLS_USER_CONFIG_FILE=\"mbedtls_mbed_client_config.h\""],
13+
"target_overrides": {
14+
"*": {
15+
"target.features_add": ["LWIP", "NANOSTACK", "LOWPAN_ROUTER", "COMMON_PAL"],
16+
"mbed-mesh-api.6lowpan-nd-channel-page": 0,
17+
"mbed-mesh-api.6lowpan-nd-channel": 18,
18+
"lwip.ipv4-enabled": false,
19+
"lwip.ipv6-enabled": true,
20+
"mbed-trace.enable": 0
21+
}
22+
}
23+
}

configs/mesh_thread.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"config": {
3+
"network-interface":{
4+
"help": "options are ETHERNET,WIFI,MESH_LOWPAN_ND,MESH_THREAD",
5+
"value": "MESH_THREAD"
6+
},
7+
"mesh_radio_type": {
8+
"help": "options are ATMEL, MCR20",
9+
"value": "ATMEL"
10+
}
11+
},
12+
"macros": ["MBEDTLS_USER_CONFIG_FILE=\"mbedtls_mbed_client_config.h\""],
13+
"target_overrides": {
14+
"*": {
15+
"target.features_add": ["LWIP", "NANOSTACK", "THREAD_ROUTER", "COMMON_PAL"],
16+
"mbed-mesh-api.thread-config-channel": 18,
17+
"mbed-mesh-api.thread-config-panid": "0xBAAB",
18+
"lwip.ipv4-enabled": false,
19+
"lwip.ipv6-enabled": true,
20+
"mbed-trace.enable": 0
21+
}
22+
}
23+
}

configs/wifi_v4.json

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
"config": {
3+
"network-interface":{
4+
"help": "options are ETHERNET,WIFI,MESH_LOWPAN_ND,MESH_THREAD",
5+
"value": "WIFI"
6+
},
7+
"wifi-ssid": {
8+
"help": "WiFi SSID",
9+
"value": "\"SSID\""
10+
},
11+
"wifi-password": {
12+
"help": "WiFi Password",
13+
"value": "\"Password\""
14+
},
15+
"wifi-tx": {
16+
"help": "TX pin for serial connection to external device",
17+
"value": "D1"
18+
},
19+
"wifi-rx": {
20+
"help": "RX pin for serial connection to external device",
21+
"value": "D0"
22+
}
23+
},
24+
"macros": ["MBEDTLS_USER_CONFIG_FILE=\"mbedtls_mbed_client_config.h\""],
25+
"target_overrides": {
26+
"*": {
27+
"target.features_add": ["LWIP", "NANOSTACK", "COMMON_PAL"],
28+
"lwip.ipv4-enabled": true,
29+
"lwip.ipv6-enabled": false,
30+
"mbed-trace.enable": 0
31+
},
32+
"NUCLEO_F401RE": {
33+
"wifi-tx": "PA_11",
34+
"wifi-rx": "PA_12"
35+
},
36+
"NUCLEO_F411RE": {
37+
"wifi-tx": "PA_11",
38+
"wifi-rx": "PA_12"
39+
},
40+
"UBLOX_EVK_ODIN_W2": {
41+
"target.device_has": ["EMAC"]
42+
}
43+
}
44+
}

configs/wifi_v6.json

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
"config": {
3+
"network-interface":{
4+
"help": "options are ETHERNET,WIFI,MESH_LOWPAN_ND,MESH_THREAD",
5+
"value": "WIFI"
6+
},
7+
"wifi-ssid": {
8+
"help": "WiFi SSID",
9+
"value": "\"SSID\""
10+
},
11+
"wifi-password": {
12+
"help": "WiFi Password",
13+
"value": "\"Password\""
14+
},
15+
"wifi-tx": {
16+
"help": "TX pin for serial connection to external device",
17+
"value": "D1"
18+
},
19+
"wifi-rx": {
20+
"help": "RX pin for serial connection to external device",
21+
"value": "D0"
22+
}
23+
},
24+
"macros": ["MBEDTLS_USER_CONFIG_FILE=\"mbedtls_mbed_client_config.h\""],
25+
"target_overrides": {
26+
"*": {
27+
"target.features_add": ["NANOSTACK", "LOWPAN_ROUTER", "COMMON_PAL"],
28+
"lwip.ipv4-enabled": false,
29+
"lwip.ipv6-enabled": true,
30+
"mbed-trace.enable": 0
31+
},
32+
"NUCLEO_F401RE": {
33+
"wifi-tx": "PA_11",
34+
"wifi-rx": "PA_12"
35+
},
36+
"NUCLEO_F411RE": {
37+
"wifi-tx": "PA_11",
38+
"wifi-rx": "PA_12"
39+
},
40+
"UBLOX_EVK_ODIN_W2": {
41+
"target.device_has": ["EMAC"]
42+
}
43+
}
44+
}

0 commit comments

Comments
 (0)