Skip to content

fix(techo-lite): remove duplicate EXTERNAL_FLASH_DEVICES definition#2719

Open
jirogit wants to merge 2 commits into
meshcore-dev:devfrom
jirogit:fix/techo-lite-flash-device
Open

fix(techo-lite): remove duplicate EXTERNAL_FLASH_DEVICES definition#2719
jirogit wants to merge 2 commits into
meshcore-dev:devfrom
jirogit:fix/techo-lite-flash-device

Conversation

@jirogit

@jirogit jirogit commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Problem

variants/lilygo_techo_lite/variant.h defines EXTERNAL_FLASH_DEVICES twice:

// Line 73 (correct)
#define EXTERNAL_FLASH_DEVICES ZD25WQ32CEIGR  // 32Mbit = 4MB, actual hardware

// Line 98 (incorrect)
#define EXTERNAL_FLASH_DEVICES MX25R1635F     // 16Mbit = 2MB, used on T-Echo
                                               // (non-Lite) and Heltec T114

Both definitions were introduced simultaneously in the initial commit
adding T-Echo Lite support (b11f084). Per LILYGO's official schematic,
ZD25WQ32CEIGR is the only flash chip used on T-Echo Lite hardware.

Fix

Remove the erroneous second definition (lines 98–99) to avoid confusion
for anyone reading the variant file.

Testing

Built LilyGo_T-Echo-Lite_non_shell_companion_radio_ble — Success.
Also fixes missing newline at end of file.

@liamcottle

Copy link
Copy Markdown
Member

Hey, thanks for the PR.

As far as I'm aware, EXTERNAL_FLASH_DEVICES is not actually used by the MeshCore firmware, and CustomLFS retrieves the JEDC ID to determine which flash chip is available.

https://github.com/oltaco/CustomLFS/blob/9a6a514c2ba0d64dad21463fc153630891fa7975/src/CustomLFS_QSPIFlash.cpp#L647

So I can't see how changing this will make any difference to LittleFS. However, I'll tag @oltaco as we probably should remove the define that's incorrect.

@jirogit

jirogit commented Jun 12, 2026

Copy link
Copy Markdown
Contributor Author

Thank you for the clarification! I wasn't aware that CustomLFS uses
JEDEC ID detection at runtime rather than relying on EXTERNAL_FLASH_DEVICES.
I'll update the PR description to remove the incorrect claim about LittleFS
behavior.

The fix still seems worthwhile to avoid confusion for anyone reading
variant.h, even if there's no functional impact on the current firmware.
Happy to close this if you'd prefer to handle it differently.

@entr0p1

entr0p1 commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Liam is correct, we don't have to define it at all; its all handled in CustomLFS. The T-Echo Lite does have QSPI flash as you found, but it isn't currently active for meshcore. Wouldn't hurt to just strip out the EXTERNAL_FLASH_DEVICES definition altogether since we don't need it even when QSPI flash support is added for the board.

jirogit added 2 commits July 2, 2026 08:28
variant.h defines EXTERNAL_FLASH_DEVICES twice:
- First (correct):    ZD25WQ32CEIGR (32Mbit = 4MB, matches actual hardware)
- Second (incorrect): MX25R1635F    (16Mbit = 2MB, T-Echo non-Lite chip)

Due to C preprocessor behavior, the second definition silently overrides
the first, causing firmware to initialize the wrong flash chip. This can
result in LittleFS operating incorrectly on T-Echo Lite hardware.

Remove the erroneous second definition.

Also fix missing newline at end of file.
…rely

Per review feedback from @liamcottle and @entr0p1, EXTERNAL_FLASH_DEVICES
is not used by MeshCore firmware — CustomLFS determines the flash chip
via JEDEC ID at runtime instead. Removing the definition entirely rather
than keeping the (now-confirmed-unnecessary) correct value.

Also removes EXTERNAL_FLASH_USE_QSPI, which was paired with the same
define.
@jirogit jirogit force-pushed the fix/techo-lite-flash-device branch from 70ee434 to 5de6512 Compare July 2, 2026 15:44
@jirogit

jirogit commented Jul 2, 2026

Copy link
Copy Markdown
Contributor Author

Thanks both for the input — I've updated this PR to remove EXTERNAL_FLASH_DEVICES/EXTERNAL_FLASH_USE_QSPI entirely from lilygo_techo_lite/variant.h rather than just fixing the duplicate. I checked and EXTERNAL_FLASH_USE_QSPI isn't referenced anywhere outside variant.h files either, so it looked equally safe to drop. Verified build success on LilyGo_T-Echo-Lite_non_shell_companion_radio_ble.

While looking into this, I noticed EXTERNAL_FLASH_DEVICES is still defined in 22 other variant.h files across the repo (e.g. rak4631, heltec_t114, wio-tracker-l1, lilygo_techo). If it's genuinely unused firmware-wide per CustomLFS's JEDEC ID detection, would it be worth opening a separate issue to track cleanup across those too? Happy to open one if useful, just didn't want to scope-creep this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants