Skip to content

Commit 58ea239

Browse files
committed
zephyr: Use CONFIG_NET_APP_SETTINGS to setup initial network addresses.
Ideally, these should be configurable from Python (using network module), but as that doesn't exist, we better off using Zephyr's native bootstrap configuration facility.
1 parent 6f1a615 commit 58ea239

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

ports/zephyr/main.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@ static char *stack_top;
6060
static char heap[MICROPY_HEAP_SIZE];
6161

6262
void init_zephyr(void) {
63-
// TODO: Make addresses configurable
63+
// We now rely on CONFIG_NET_APP_SETTINGS to set up bootstrap
64+
// network addresses.
65+
#if 0
6466
#ifdef CONFIG_NETWORKING
6567
if (net_if_get_default() == NULL) {
6668
// If there's no default networking interface,
@@ -81,6 +83,7 @@ void init_zephyr(void) {
8183
static struct in6_addr in6addr_my = {{{0x20, 0x01, 0x0d, 0xb8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}}};
8284
net_if_ipv6_addr_add(net_if_get_default(), &in6addr_my, NET_ADDR_MANUAL, 0);
8385
#endif
86+
#endif
8487
}
8588

8689
int real_main(void) {

ports/zephyr/prj_base.conf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@ CONFIG_NET_SOCKETS=y
1818
CONFIG_TEST_RANDOM_GENERATOR=y
1919
CONFIG_NET_NBUF_RX_COUNT=5
2020

21+
CONFIG_NET_APP_SETTINGS=y
22+
CONFIG_NET_APP_INIT_TIMEOUT=3
23+
CONFIG_NET_APP_NEED_IPV6=y
24+
CONFIG_NET_APP_NEED_IPV4=y
25+
CONFIG_NET_APP_MY_IPV6_ADDR="2001:db8::1"
26+
CONFIG_NET_APP_MY_IPV4_ADDR="192.0.2.1"
27+
CONFIG_NET_APP_MY_IPV4_GW="192.0.2.2"
28+
2129
# DNS
2230
CONFIG_DNS_RESOLVER=y
2331
CONFIG_DNS_RESOLVER_ADDITIONAL_QUERIES=2

0 commit comments

Comments
 (0)