Any lightweight alternative to WiFi lib ?
Any lightweight alternative to WiFi lib ?
I am moving from ESP8266 to M5Stack C3U Stamp board. I am using Arduino IDE 1.8.19. Is there any lightweight alternative to the WiFi lib ? The WiFi lib consumes lots of flash memory (~600kB) if one compares it to the ESP8366WiFi lib. Actually, I only need to connect to an AP by providing the SSID and password, but I would wish to have Wifi and BLE at the same time in my sketch.
-
- Posts: 9770
- Joined: Thu Nov 26, 2015 4:08 am
Re: Any lightweight alternative to WiFi lib ?
Not really, but may I ask why 600K is an issue? That board has 4MiB to play around with; sounds like more than enough to me.
Re: Any lightweight alternative to WiFi lib ?
When I compile a simple sketch that just invokes the WiFi lib, I obtain the following info:
Sketch uses 637642 bytes (48%) of program storage space. Maximum is 1310720 bytes
The maximum usable flash is actually 1310720 even if the board has 4MB
If I compile a sketch that just invokes the Wifi+BLE, I obtain the following info:
Sketch uses 1152484 bytes (87%) of program storage space. Maximum is 1310720 bytes
So there is not much room available for real application code
Sketch uses 637642 bytes (48%) of program storage space. Maximum is 1310720 bytes
The maximum usable flash is actually 1310720 even if the board has 4MB
If I compile a sketch that just invokes the Wifi+BLE, I obtain the following info:
Sketch uses 1152484 bytes (87%) of program storage space. Maximum is 1310720 bytes
So there is not much room available for real application code
-
- Posts: 831
- Joined: Mon Jul 22, 2019 3:20 pm
Re: Any lightweight alternative to WiFi lib ?
WiFi.h is just a wrapper for the underlying ESP-IDF APIs.
It is a total of 192K of code at the moment, so probably less than 15K compiled. I doubt you would find anything thinner than that.
The IDF APIs in turn are wrappers around the net80211 driver provided as a binary from Espressif. It might be possible to make that slimmer (it was in older versions of IDF), but presumably you want a robust and extensible framework for your network interfaces, even if you "just" want to type in your ssid and password. The whole IDF stack is probably about 150K of your 600K used.
The driver is what it is. It is the proprietary part bit of code that includes a lot of the secret sauce that gives the esp32 such power in a small bit of silicon. It is a 1M binary that you will probably use about half of in a typical deployment.
In summary, while it might be feasible to have a slimmer WiFi stack, nobody is going to invest the effort needed to do so when there is a team of professionals making a solid framework for their own product, particularly when you can buy a device with twice as much flash memory for $0.30 more.
It is a total of 192K of code at the moment, so probably less than 15K compiled. I doubt you would find anything thinner than that.
The IDF APIs in turn are wrappers around the net80211 driver provided as a binary from Espressif. It might be possible to make that slimmer (it was in older versions of IDF), but presumably you want a robust and extensible framework for your network interfaces, even if you "just" want to type in your ssid and password. The whole IDF stack is probably about 150K of your 600K used.
The driver is what it is. It is the proprietary part bit of code that includes a lot of the secret sauce that gives the esp32 such power in a small bit of silicon. It is a 1M binary that you will probably use about half of in a typical deployment.
In summary, while it might be feasible to have a slimmer WiFi stack, nobody is going to invest the effort needed to do so when there is a team of professionals making a solid framework for their own product, particularly when you can buy a device with twice as much flash memory for $0.30 more.
-
- Posts: 9770
- Joined: Thu Nov 26, 2015 4:08 am
Re: Any lightweight alternative to WiFi lib ?
That is because the ESP SDKs use a partition table to distinguish between data format; if you change the partition table, you can get more space allocated to the program. According to the Internet, the Arduino SDK should have partition table editing functionality under the 'Tools' menu.
-
- Posts: 831
- Joined: Mon Jul 22, 2019 3:20 pm
Re: Any lightweight alternative to WiFi lib ?
There is a lighter weight BLE library. https://github.com/h2zero/NimBLE-Arduino
Re: Any lightweight alternative to WiFi lib ?
Thank you so much ESP_Sprite and lbernstone.
Who is online
Users browsing this forum: No registered users and 43 guests