LMIC_setTxData2 58% storage usage

I'm using the LMIC library for LoRaWAN. The function LMIC_setTxData2 takes 58% of program storage space leading the compilation of the sketch to 3% of available storage.

Any suggestion on how to improve the mentioned function to take less storage space?

The sketch can be hardly improved. I have taken away all possible strings to print out to the console.

what host microcontroller and LoRaWAN module are you using?
LMIC is a large and complex library - running OTAA on an Adafruit Feather the Linker displays
Sketch uses 27128 bytes (94%) of program storage space. Maximum is 28672 bytes.

running OTAA on a TTGO LoRa32 SX1276 OLED the linker displays
Sketch uses 315757 bytes (9%) of program storage space. Maximum is 3342336 bytes.
Global variables use 23548 bytes (7%) of dynamic memory, leaving 304132 bytes for local variables. Maximum is 327680 bytes.

Just running on customized board with ATmega328P configured as "Arduino Pro or Pro Mini" with fuse configuration lfuse=0xFF, hfuse=0xDA and efuse=0xFE. LoRa module is RF96.

I get it compiled&uploaded and seems to run stable but it leaves very little margin for trusting on it.

The sketch, without calling LMIC_setTxData2 takes 12 216 bytes. It goes up to 29 824 bytes when calling the function. In other words, just the function takes 17 608 byes.

you have a micro with 32K flash and 2KSRAM running very complex LoRaWAN software - Flash almost full similar to the adafruit feather 32u4
32Kflash is OK for running LoRa point-to-point, e.g. the Feather 32u4 reports
Sketch uses 6748 bytes (23%) of program storage space. Maximum is 28672 bytes.

but LoRaWAN is much more complex and hence larger code
these days I would use an ESP32 as the host micro

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.