Espressif config parameters?

Hi

I am trying to get a newer version of the espressif32 framework to compile some older code - where I have a bit of challenges.

The original platformio.ini file has this:

platform = espressif32@1.12.2
board = esp32dev
framework = arduino

The original source has a fseek hack/patch included - which apparently should be in the espressif 32 framework now according to expose FF_USE_FASTSEEK in menuconfig (IDFGH-3696) · Issue #5625 · espressif/esp-idf · GitHub

The question is just how to enable it from VSCode/PIO ?

I assume, that I somehow need to add build flags like this ?

build_flags =
  -D FATFS_USE_FASTSEEK=y
  -D FATFS_FAST_SEEK_BUFFER_SIZE=64

But I have tried both with and without these flags - and see no change in performance on the test-code on GitHub - michael-betz/fast_seek_test: Benchmark ESP32 seek times on FAT32 FS with platform = espressif32@6.1.0

Any hints ?

Regards
Brian

You cannot affect the ESP-IDF build parameters with build_flags in a framework = arduino project because the ESP-IDF library is precompiled. The code has already been generated. Also the right parameter is called CONFIG_FATFS_USE_FASTSEEK.

Arduino-ESP32 2.0.14 has that disabled. (Same for latest 3.x)

To use a modified ESP-IDF base in your Arduino project, use https://github.com/platformio/platform-espressif32/tree/develop/examples/espidf-arduino-blink as the starting project, then use the menuconfig to enable CONFIG_FATFS_USE_FASTSEEK.

This will be in turn used in the FF config.

Actually that’s an interesting hack. It just also compiles the ff libary source code with its own config and then hopes that the linker will use its implementation instead of the one built into ESP-IDF? That’s uh, smart.

Trying out to compile right now…
I hope, that the newer version of the framework maybe has libraries for makign it easier to implement a mqtt client in the original code (that utilizes the fseek stuff) … That is the main reason for trying to run it in a newer framework…

Not quite there yet, uploading the code and running it gives me:

E (195424) task_wdt: Task watchdog got triggered. The following tasks did not reset the watchdog in time:
E (195424) task_wdt:  - IDLE (CPU 1)
E (195424) task_wdt: Tasks currently running:
E (195424) task_wdt: CPU 0: IDLE
E (195424) task_wdt: CPU 1: loopTask
E (195424) task_wdt: Print CPU 0 (current core) backtrace


Backtrace: 0x400D7EC3:0x3FFB0770 0x4008260D:0x3FFB0790 0x400F1027:0x3FFB5C30 0x400D85EB:0x3FFB5C50 0x40086E5E:0x3FFB5C70 0x40088529:0x3FFB5C90

E (195424) task_wdt: Print CPU 1 backtrace


Backtrace: 0x40081BE9:0x3FFB0D70 0x4008260D:0x3FFB0D90 0x4000BFED:0x3FFB79C0 0x40087A01:0x3FFB79D0 0x400866C9:0x3FFB79F0 0x400E1111:0x3FFB7A30 0x400DEC15:0x3FFB7A50 0x400DF97E:0x3FFB7A70 0x400DFC46:0x3FFB7A90 0x400E1A01:0x3FFB7AD0 0x400DC9A2:0x3FFB7B00 0x4000BDBB:0x3FFB7B20 0x40001125:0x3FFB7B40 0x400594E9:0x3FFB7B60 0x400E2AC9:0x3FFB7B80 0x400E2B59:0x3FFB7BC0 0x400D1331:0x3FFB7BE0 0x400D156E:0x3FFB8C10 0x40088529:0x3FFB8C30

E (200424) task_wdt: Task watchdog got triggered. The following tasks did not reset the watchdog in time:
E (200424) task_wdt:  - IDLE (CPU 1)
E (200424) task_wdt: Tasks currently running:
E (200424) task_wdt: CPU 0: IDLE
E (200424) task_wdt: CPU 1: loopTask
E (200424) task_wdt: Print CPU 0 (current core) backtrace


Backtrace: 0x400D7EC3:0x3FFB0770 0x4008260D:0x3FFB0790 0x400F1027:0x3FFB5C30 0x400D85EB:0x3FFB5C50 0x40086E5E:0x3FFB5C70 0x40088529:0x3FFB5C90

E (200424) task_wdt: Print CPU 1 backtrace


Backtrace: 0x40081BE9:0x3FFB0D70 0x4008260D:0x3FFB0D90 0x400D3EAD:0x3FFB79B0 0x400D28C9:0x3FFB79E0 0x400D1A28:0x3FFB7A00 0x400D1B74:0x3FFB7A20 0x400D1C9B:0x3FFB7A40 0x400DE945:0x3FFB7A70 0x400DFDC9:0x3FFB7A90 0x400E1A01:0x3FFB7AD0 0x400DC9A2:0x3FFB7B00 0x4000BDBB:0x3FFB7B20 0x40001125:0x3FFB7B40 0x400594E9:0x3FFB7B60 0x400E2AC9:0x3FFB7B80 0x400E2B59:0x3FFB7BC0 0x400D1331:0x3FFB7BE0 0x400D156E:0x3FFB8C10 0x40088529:0x3FFB8C30

Does the referenced mininmal example espidf-arduino-blink work fine?

That one works file… Re-arranging the code in the perfomance test example and adding a dealy(1); seems to help - now the watchdog is not being triggered any more - and the output gets like:

[228531][I][Blink.cpp:67] loop(): fseek( 104886267) dt:   1228 us, read 4096
[228539][I][Blink.cpp:67] loop(): fseek( 104886268) dt:   1228 us, read 4096
[228547][I][Blink.cpp:67] loop(): fseek( 104886269) dt:   1228 us, read 4096
[228555][I][Blink.cpp:67] loop(): fseek( 104886270) dt:   1228 us, read 4096
[228563][I][Blink.cpp:67] loop(): fseek( 104886271) dt:   1231 us, read 4096
[228570][I][Blink.cpp:67] loop(): fseek( 104886272) dt:    116 us, read 4096
[228577][I][Blink.cpp:67] loop(): fseek( 104886273) dt:    698 us, read 4096
[228584][I][Blink.cpp:67] loop(): fseek( 104886274) dt:    704 us, read 4096
[228591][I][Blink.cpp:67] loop(): fseek( 104886275) dt:    704 us, read 4096

So far, so good. Now this issue is just whether I can get the “main” project converted as well…

Mission almost accomplished.
With the old/original framework a spiffs partitions.bin file was automatically created, maybe based on some of the dependent libs ? That is the last thing I need to sort out now, as the compiled code seems to run without triggering the watchdog.
Thanks for the input so far - I am much closer in being able to get things up and running with a newer framework now :slight_smile: