Skip to content

fal.h is missing FAL header include issues #378

@Mekanikalistik

Description

@Mekanikalistik

Hey folks! I'm banging my head against the wall trying to get FlashDB working with ESP32-S3 in PlatformIO VSCODE. Been at this for days and keep hitting include errors. Any help would be awesome!

My setup:

  • ESP32-S3 board: Heltec WiFi LoRa 32 V3
  • Using PlatformIO with VSCode
  • ESP-IDF framework (5.5.0)
  • FlashDB 2024.12.30 from PlatformIO registry
  • Windows 11

What I'm building:
A touch sensor logger that:

  • Uses the ESP32's built-in capacitive touch sensors (GPIO 4-10)
  • Logs touch events to FlashDB TSDB
  • Serves up a web interface over WiFi so I can see the data
  • Eventually wanna add Unity testing directly on the hardware
  • And USB debugging with breakpoints and stuff

The problem:
Build fails with:

fatal error: fal.h: No such file or directory

This happens when I include flashdb.h in main.c, which tries to pull in fal.h.

Stuff I've tried:

  1. Just adding FlashDB to lib_deps in platformio.ini - seemed too easy, didn't work
  2. Making it an ESP-IDF component by creating components/FlashDB/ with CMakeLists.txt
  3. Adding every include path I could think of to platformio.ini
  4. Created CMakeLists.txt in the FlashDB lib directory to register it as a component
  5. Set up custom partition table with flashdb partition

Current structure:

flashDB_example/
├── platformio.ini  
├── partitions.csv
├── src/
│   ├── main.c
│   ├── fal_cfg.h
│   └── fdb_cfg.h
└── .pio/libdeps/heltec_wifi_lora_32_V3/FlashDB/
    ├── CMakeLists.txt (I made this)
    ├── inc/ (flashdb.h etc)
    ├── port/fal/ (fal headers and sources)
    └── src/ (fdb_*.c files)

Questions:

  • What's the proper way to integrate FlashDB with ESP32-S3 in PlatformIO?
  • PlatformIO library or ESP-IDF component approach?
  • How do I get the FAL headers to be found?
  • Got any working examples for ESP32-S3 + FlashDB + PlatformIO?
  • For the Unity testing and USB debugging I wanna do later, any gotchas?

My current config:
platformio.ini:

[env:heltec_wifi_lora_32_V3]
platform = espressif32
board = heltec_wifi_lora_32_V3
framework = espidf
lib_deps = kuba2k2/FlashDB@^2024.12.30
build_flags = 
    -I .pio/libdeps/heltec_wifi_lora_32_V3/FlashDB/port/fal/inc
    -I .pio/libdeps/heltec_wifi_lora_32_V3/FlashDB/inc
board_build.partitions = partitions.csv
monitor_speed = 115200

CMakeLists.txt I added to FlashDB lib:

idf_component_register(
    SRCS
        "src/fdb.c"
        "src/fdb_kvdb.c" 
        "src/fdb_tsdb.c"
        "src/fdb_utils.c"
        "src/fdb_file.c"
        "port/fal/src/fal.c"
        "port/fal/src/fal_flash.c"
        "port/fal/src/fal_partition.c"
        "port/fal/src/fal_rtt.c"
        "../../../../src/fal_flash_esp32_port.c"
    INCLUDE_DIRS
        "inc"
        "port/fal/inc"
        "../../../../src"
    REQUIRES
        "esp_partition"
        "esp_common"
)

I'm pretty stuck here and could really use some guidance. Happy to share more details about what I've tried!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions