diff options
| author | Damien George | 2018-05-21 16:48:24 +1000 |
|---|---|---|
| committer | Damien George | 2018-05-21 17:36:06 +1000 |
| commit | cda964198a36e8d1ce4497d90484fae4b9d661a5 (patch) | |
| tree | 5964019f3ca2df34cf48a309f1169751077dcf9c /ports/stm32/main.c | |
| parent | 41766ba7e67022d2d15ce78896a730745ea3871f (diff) | |
stm32: Integrate lwIP as implementation of usocket module.
This patch allows to use lwIP as the implementation of the usocket module,
instead of the existing socket-multiplexer that delegates the entire TCP/IP
layer to the NIC itself.
This is disabled by default, and enabled by defining MICROPY_PY_LWIP to 1.
When enabled, the lwIP TCP/IP stack will be included in the build with
default settings for memory usage and performance (see
lwip_inc/lwipopts.h). It is then up to a particular NIC to register itself
with lwIP using the standard lwIP netif API.
Diffstat (limited to 'ports/stm32/main.c')
| -rw-r--r-- | ports/stm32/main.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/ports/stm32/main.c b/ports/stm32/main.c index 460a19ccb..44f5b05c4 100644 --- a/ports/stm32/main.c +++ b/ports/stm32/main.c @@ -34,6 +34,7 @@ #include "lib/mp-readline/readline.h" #include "lib/utils/pyexec.h" #include "lib/oofatfs/ff.h" +#include "lwip/init.h" #include "extmod/vfs.h" #include "extmod/vfs_fat.h" @@ -512,6 +513,12 @@ void stm32_main(uint32_t reset_mode) { sdcard_init(); #endif storage_init(); + #if MICROPY_PY_LWIP + // lwIP doesn't allow to reinitialise itself by subsequent calls to this function + // because the system timeout list (next_timeout) is only ever reset by BSS clearing. + // So for now we only init the lwIP stack once on power-up. + lwip_init(); + #endif soft_reset: @@ -726,6 +733,9 @@ soft_reset_exit: storage_flush(); printf("PYB: soft reboot\n"); + #if MICROPY_PY_NETWORK + mod_network_deinit(); + #endif timer_deinit(); uart_deinit(); #if MICROPY_HW_ENABLE_CAN |
