- Wed Jan 20, 2016 9:36 am
#39297
I am thinking of the following (now it appears my dram is shrinking rapidly lately):
- I have a wrapper function snprintf that calls ets_vsnprintf (I think snprintf is way more useful than vsnprintf)
- I'll add a wrapper, something like snprintf_flash, that will copy the format string to dram temporarily and then call ets_vsnprintf
- when ets_vsnprintf returns, the dram space for the format string can be released or reused
- add an additional region in the linker script that follows the irom0_0_seg segment, e.g. flash_data_seg
- make the format strings go to a new section (e.g. .flash.rodata) that is placed into the flash_data_seg (add __attr__((section(".flash.rodata))), I guess that should work) + add a #define, something like "rodata".
- that way most my strings will be virtually in flash without too much hassle
- maybe a dedicted wrapper for str(l/n)cpy could be added as well, to save even more dram