diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2017-10-07 14:08:50 +0300 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2017-10-07 14:08:50 +0300 |
commit | 58ea239510530b5ce80aa24cd084b43698309bb4 (patch) | |
tree | bfc668929429a481b957cf82f186c535e08e8318 | |
parent | 6f1a61542746e3ef3704f6e563e2526454df0112 (diff) |
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.
-rw-r--r-- | ports/zephyr/main.c | 5 | ||||
-rw-r--r-- | ports/zephyr/prj_base.conf | 8 |
2 files changed, 12 insertions, 1 deletions
diff --git a/ports/zephyr/main.c b/ports/zephyr/main.c index 7255d981f..7eb9da3e1 100644 --- a/ports/zephyr/main.c +++ b/ports/zephyr/main.c @@ -60,7 +60,9 @@ static char *stack_top; static char heap[MICROPY_HEAP_SIZE]; void init_zephyr(void) { - // TODO: Make addresses configurable + // We now rely on CONFIG_NET_APP_SETTINGS to set up bootstrap + // network addresses. +#if 0 #ifdef CONFIG_NETWORKING if (net_if_get_default() == NULL) { // If there's no default networking interface, @@ -81,6 +83,7 @@ void init_zephyr(void) { static struct in6_addr in6addr_my = {{{0x20, 0x01, 0x0d, 0xb8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}}}; net_if_ipv6_addr_add(net_if_get_default(), &in6addr_my, NET_ADDR_MANUAL, 0); #endif +#endif } int real_main(void) { diff --git a/ports/zephyr/prj_base.conf b/ports/zephyr/prj_base.conf index c3ba2812f..a4cc14513 100644 --- a/ports/zephyr/prj_base.conf +++ b/ports/zephyr/prj_base.conf @@ -18,6 +18,14 @@ CONFIG_NET_SOCKETS=y CONFIG_TEST_RANDOM_GENERATOR=y CONFIG_NET_NBUF_RX_COUNT=5 +CONFIG_NET_APP_SETTINGS=y +CONFIG_NET_APP_INIT_TIMEOUT=3 +CONFIG_NET_APP_NEED_IPV6=y +CONFIG_NET_APP_NEED_IPV4=y +CONFIG_NET_APP_MY_IPV6_ADDR="2001:db8::1" +CONFIG_NET_APP_MY_IPV4_ADDR="192.0.2.1" +CONFIG_NET_APP_MY_IPV4_GW="192.0.2.2" + # DNS CONFIG_DNS_RESOLVER=y CONFIG_DNS_RESOLVER_ADDITIONAL_QUERIES=2 |