We have a simple sideboard to our main board. It talks to the main board through serial and does not have any ethernet interface and thus all traces of LWIP should be disabled and all the precious memory freed. I can not seem to find any configuration option to disable it entirely. These are the options I’ve tried in my mbed_app.json
file:
"target_overrides": {
"*": {
"target.components_add": [],
"target.components_remove": ["LWIP"],
"target.features_remove": ["LWIP"],
"target.network-default-interface-type": "null",
"lwip.ethernet-enabled": false,
"lwip.tcp-enabled": false,
"lwip.ipv4-enabled": false,
"lwip.ipv6-enabled": false,
"lwip.l3ip-enabled": false,
"lwip.ppp-enabled": false,
"lwip.ppp-ipv4-enabled": false,
"lwip.ppp-ipv6-enabled": false,
"lwip.raw-socket-enabled": false,
"target.xip-enable": false,
"lwip.debug-enabled": false,
"lwip.udp-socket-max": false,
"lwip.socket-max": false,
"nsapi.socket-stats-enabled": false,
"nsapi.default-stack": "",
"nsapi.present": 0,
They seem to do something, as both IPv4 and 6 are disabled, but that causes the following compilation error:
> mbed compile
[mbed] Working path "/..." (program)
Building project airfi-iob (LPC1768, GCC_ARM)
Scan: iob
Using ROM regions bootloader, application in this build.
Region bootloader: size 0x20000, offset 0x0
Region application: size 0x60000, offset 0x20000
Compile [ 21.3%]: lwip_random.c
[Error] lwipopts.h@34,2: #error "Either IPv4 or IPv6 must be enabled."
[ERROR] In file included from ./mbed-os/connectivity/lwipstack/lwip/src/include/lwip/opt.h:51,
from ./mbed-os/connectivity/lwipstack/lwip-sys/lwip_random.c:18:
./mbed-os/connectivity/lwipstack/include/lwipstack/lwipopts.h:34:2: error: #error "Either IPv4 or IPv6 must be enabled."
34 | #error "Either IPv4 or IPv6 must be enabled."
| ^~~~~
[mbed] ERROR: "/opt/homebrew/opt/python@3.9/bin/python3.9" returned error.
Code: 1
Path: "/..."
Command: "/opt/homebrew/opt/python@3.9/bin/python3.9 -u /.../mbed-os/tools/make.py -t GCC_ARM -m LPC1768 --source . --build ./BUILD/LPC1768/GCC_ARM"
Tip: You could retry the last command with "-v" flag for verbose output
---
Most of the config options are pure guesswork based on random forum posts and some are taken from BUILD/.../mbed-os/mbed-config.h
. I can’t seem to find a documented list of these configuration options anywhere and any googling for how to fix this and/or totally disable LWIP/Ethernet have turned up nothing useful. The best resource so far seems to be:
It states:
Name: target.network-default-interface-type
Description: Default network interface type. Typical options: null, ETHERNET, WIFI, CELLULAR, MESH
Defined by: target:Target
No value set
But null
does not seem to do anything. Is it thus impossible to compile without a networking stack? I could of course go in and just remove all traces of LWIP from the clone mbed-os
repository, but that seems like such a brutal approach.