Skip to content

SDFS/SD make F() strings appear in RODATA, not flash #6767

Closed
@TD-er

Description

@TD-er

Basic Infos

  • This issue complies with the issue POLICY doc.
  • I have read the documentation at readthedocs and the issue is not addressed there.
  • I have tested that the issue is present in current master branch (aka latest git).
  • I have searched the issue tracker for a similar issue.
  • If there is a stack dump, I have decoded it.
  • I have filled out all fields below.

Platform

  • Hardware: [ESP-12|ESP-01|ESP-07|ESP8285 device|other]
  • Core Version: [Core 2.6.0]
  • Development Env: [Platformio]
  • Operating System: [Windows]

Settings in IDE

  • Module: [Generic ESP8266 Module]
  • Flash Mode: [dio]
  • Flash Size: [4MB/1MB]
  • lwip Variant: [v2 Lower Memory]
  • Reset Method: [nodemcu]
  • Flash Frequency: [40Mhz]
  • CPU Frequency: [80Mhz]
  • Upload Using: [OTA|SERIAL]
  • Upload Speed: [115200] (serial upload only)

Problem Description

In my project, we have had log to SD present, but since it was disabled for a long time, I now made it compile again.
At first there is this strange thing when including SD.h, a lot of __FlashStringHelper related code would no longer compile.

For example I could not compile code like this anymore:

   static const __FlashStringHelper *gpMenu[8][3] = {
      F("⌂"),   F("Main"),          F("/"),              // 0
[...]
      F("🔧"), F("Tools"),         F("/tools"),         // 7
    };

Had to change it into separate functions with a switch statement returning F() macro defined strings.

After changing all of these, I ended up with this error:

c:/users/gijs/.platformio/packages/toolchain-xtensa/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: address 0x3fffe008 of .pio\build\debug_custom_ESP8266_4M1M\firmware.elf section `.bss' is not within region `dram0_0_seg'
c:/users/gijs/.platformio/packages/toolchain-xtensa/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: address 0x3fffe008 of .pio\build\debug_custom_ESP8266_4M1M\firmware.elf section `.bss' is not within region `dram0_0_seg'
collect2.exe: error: ld returned 1 exit status
*** [.pio\build\debug_custom_ESP8266_4M1M\firmware.elf] Error 1

Only when throwing out almost all code from my sketch, I was able to compile it wilt SD support enabled.
But I doubt it is useful, since you don't have any memory left.

Without SD support:

DATA:    [=====     ]  52.0% (used 42572 bytes from 81920 bytes)
PROGRAM: [=======   ]  69.0% (used 616020 bytes from 892912 bytes)
Creating BIN file ".pio\build\minimal_core_260_ESP8266_1M_OTA\firmware.bin" using ".pio\build\minimal_core_260_ESP8266_1M_OTA\firmware.elf"

With SD support:

DATA:    [========  ]  84.7% (used 69356 bytes from 81920 bytes)
PROGRAM: [=======   ]  70.9% (used 632760 bytes from 892912 bytes)
Creating BIN file ".pio\build\minimal_core_260_ESP8266_1M_OTA\firmware.bin" using ".pio\build\minimal_core_260_ESP8266_1M_OTA\firmware.elf"

That's an increase of over 26 kByte RAM usage.

I'm not entirely sure the issue with the __FlashStringHelper related code has anything to do with this, but maybe it does somehow prevent strings to be stored in flash?

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions