Platformio not see external changes in .c/.h

I am using platformio+vscode c esp32/arduino on CYD(Cheap Yellow Display). I use LVGL for the GUI and the interface files are generated by EEZ. In general, it is not that important.

The point is this: some of the build files are generated by an external program and put into src/ui. These are the usual .h and .c files. But platformio doesn’t see changes in these files until I run Full Clean (regular clean doesn’t help). I get the usual compilation errors when I reference non-existent entities, e.g.

src/main.cpp: In function ‘void action_editor_uni(lv_event_t*)’:
src/main.cpp:393:37: error: ‘objects_t’ {aka ‘struct _objects_t’} has no member named ‘profile_prev_button’; did you mean ‘profile_editor’?
*** [.pio/build/esp-cyd/src/main.cpp.o] Error 1

But objects.profile_prev_button absolutely exists, I can see it if I go to src/ui/screen.c file with the editor. However, I guess it doesn’t exist in .pio/build/esp-cyd/src/ui/screen.o, because screen.o is built from a previous version of screen.c, and platformio for some reason doesn’t see the change in src/ui/screen.c and doesn’t think it’s necessary to rebuild the object file. Full Clean solves the problem, but it is inconvenient for me to download all the libraries again and rebuild the project completely every time I change the interface, even though one file has changed.

Can you tell me what I should do in this situation?

What is this external program? Where does it come from, what does it do?

This is all very difficult to understand.

Can you provide the content of your platformio.ini and the smallest possible example so that this can be reproduced?

I copy the files into the folder with a bash script.

platform = espressif32
board = esp32dev
framework = arduino
board_upload.flash_size = 4MB
monitor_filters = esp32_exception_decoder, colorize, time

debug_init_break = tbreak setup
debug_tool = esp-prog

board_build.partitions = 4MB_OTA_FACTORY.csv
upload_speed = 921600
upload_port = /dev/cu.wch*
monitor_port = /dev/cu.wch*
monitor_speed = 115200

lib_deps =

build_flags =

build_src_filter =

Reproducing the behavior should be easy:
1)echo “uint8_t test=0;” > src/ui/test.h
2)add “lib_deps = src/ui” in .ini
3)add “#include <test.h>” to the code and try to use the variable “Serial.print(test);”
4)In my project it will not be found until full clean is executed

Thanks for providing your platformio.ini which explains the issues you have.

You’re lib_deps contains several errors:

  • src/ui is wrong, please remove this
  • SD, FS and SPI are builtin libraries provided by the Arduino Framework and are also wrong here. Please remove them

You can also remove

build_src_filter =

Wrong as stated above

That’s where the issue occours.
Either you include it by #include "ui/test.h" or put the test.h it in the include folder and include it simly by #include "test.h"

The file ./src/ui/test.h is not a library, but it is part of your source files.

Yeah, I guess that’s it. Now I can see changes in files right after exporting them with a graphical editor. Thank you very much!

1 Like