- Thu Oct 29, 2020 5:30 am
#89246
It seems like "wdev" stands for "wireless" "wifi" or "wlan" device.
What I can see from the interface to lwip, it's memory buffer for sending and receiving frames. So I guess it's required.
There are various ways to regain A LOT of DRAM memory though, making this amount for "wdev" no longer an issue. The most important one is that everything you use (variables and their storage, initialised or unitialised) are copied to DRAM before your code starts. The problem is you can make them completely "const" but that is not enough to make them NOT end up in DRAM. You explicitly need to make the variables of storage in section ".flash.rodata". That's enough though, if you use an initialiser, make sure you declare an array and not a pointer. If you declare
Code: Select all__attribute__((section(".flash.rodata"))) const char *test = "test";
the value of "test" will still end up in DRAM, so do it this way:
Code: Select all__attribute__((section(".flash.rodata"))) const char test[] = "test";
Then, anything you put in flash (and not copy to DRAM) must be referred to as 32 bit words. You cannot address a single byte or 16 bit word. Also the 32 bit word needs to be 32 bit aligned (i.o.w. bit 0 and 1 need to be zero).
Also I am not sure the "standard" linker config file exactly names it that way, it could be the section is named otherwise or not even present, I guess the others here could extend on that.
It's very well possible make an environment of tools around this that make operation "seemless". The SDK has an "snprintf" version that should do this (but I tried once and got a crash, so I don't trust it). For myself I have a set of functions that allows me to use "flash" strings almost as if their in DRAM. This saves me something like 20 kbytes, without it, I would have been stuck a long time ago.