Adding component to ESP32 build causes it not to load

Sysprogs forums Forums VisualGDB Adding component to ESP32 build causes it not to load

Tagged: 

This topic contains 14 replies, has 2 voices, and was last updated by  support 2 months, 2 weeks ago.

Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #20926

    dedvalson
    Participant

    Hi,

    Fairly new to VisualGDB. Created a new ESP32 IDF project based on the smart_config sample and the current master ESP-IDF. This worked properly. I added a component (libesphttpd) to the components directory. Then, in the VisualGDB properties window I enabled the esphttpd component. I also had to add an html directory to my project.

    I did that, and it then built and ran fine. But if I close the solution and reopen it I get a message that states: Load failed. Double-click for details.

    The details of the error are as follows:

    If I turn off the component the project reloads properly.

    Am I missing something obvious here?

    Don

    • This topic was modified 7 months, 1 week ago by  dedvalson.
    • This topic was modified 7 months, 1 week ago by  dedvalson.
    #20929

    dedvalson
    Participant

    I should have stated that I see this with both 5.3 and with 5.4 preview 3.

    #20930

    support
    Keymaster

    Hi,

    Yes, most likely something goes wrong with the build scripts. Please try building the project and check the build log – it should show what exactly is stopping the ESP-IDF build system from proceeding.

    #20932

    dedvalson
    Participant

    Do you mean build it outside of Visual Studio? I can’t build it in Visual Studio because the project won’t even load.

    #20933

    support
    Keymaster

    Hi,

    Building with VS should actually work (as in produce the relevant error message). The ESP-IDF projects work differently from the regular VS projects – instead of storing a redundant copy of the project structure in the .vcxproj file, they query the up-to-date structure directly from ESP-IDF and render it in the Solution Explorer. Hence if the ESP-IDF is not able to configure and produce a list of the built files, VisualGDB won’t be able to show anything in Solution Explorer, although it will still be able to kick off the build command.

    Once you resolve the build errors (just the ones in the build scripts, errors in source files won’t affect anything), VisualGDB will load the project structure and let you use the convenient GUI to manage it.

    #20934

    dedvalson
    Participant

    Ahh, silly me. I assumed that because the load failed I couldn’t run build. So I ran the build and it built successfully within Visual Studio. However the project still wont load in the Solution Explorer.

    After a lot of looking around, I think I have figured out what is going on, though I don’t know how to fix it.

    When the project loads in visual studio, the following command is issued:

    C:\SysGCC\esp32\bin\bash.exe --login -c "export IDF_PATH=/esp-idf/master && export BATCH_BUILD=1 && export LANG=en_US && cd /cygdrive/c/Users/Don/Documents/esphttpd-freertos && make -n -k BUILD_DIR_BASE='/cygdrive/c/Users/Don/source/repos/EmbeddedProject12/EmbeddedProject12/VisualGDBCache/EmbeddedProject12-Debug/CodeSenseDir' SDKCONFIG='/cygdrive/c/Users/Don/source/repos/EmbeddedProject12/EmbeddedProject12/VisualGDBCache/EmbeddedProject12-Debug/sdkconfig' V=0

    If I run this same command from a Windows command prompt, the following appears on stderr (not on stdout)

    mkespfsimage is a windows executable that is built as part of the build process. The libesphttpd component creates mkespfsimage.exe which ends up located in the original esp-idf project directory under Debug/libesphttpd/mkespfsimage.exe

    The problem appears to be that during the load, make is told that BUILD_DIR_BASE is the CodeSenseDir, so the executable is not there causing the make -n -k to fail.

    So the project builds fine both from Visual studio and from esp-idf, but it can’t load because of this error.

    #20943

    support
    Keymaster

    Hi,

    Thanks for the detailed description, it indeed explains what is going on, so we will try to suggest a good workaround.

    The advanced ESP-IDF subsystem works by running the ESP-IDF build command in a special “dry run” mode where it simply prints the gcc command lines that would be used during the build (it still generates config files and a few others). This works for the regular ESP-IDF projects, however it appears to be breaking the custom component you imported.

    The easiest fix would be to simply copy the mkespfsimage binary from the actual build directory to the equivalent path under VisualGDBCache/EmbeddedProject12-Debug/CodeSenseDir and then reload the project. It should unblock the ESP-IDF build logic and VisualGDB will be able to pick up the project structure from it. Another option would be to remove the ‘-n -k’ arguments from the build command line you mentioned and rerun it manually. This should build the necessary files automatically and let VisualGDB load the project.

    Also if you could point us to the specific version of the library that is causing the issue, we might be able to add a better workaround.

    #20972

    dedvalson
    Participant

    Hi,

    Copying the executable as you suggested does solve the problem.

    The library I am using is available at:

    https://github.com/Spritetm/libesphttpd

    Thanks,

    Don

    #20973

    dedvalson
    Participant

    As a related question, the ESP-IDF project contains the main and components folder as you would expect, but at the same level there is a directory called “html” that includes sub directories with html pages, jpeg images and so forth to build a website with. How could I make that folder appear in the solution explorer. It would be great to use Visual Studio to edit and manage these file also.

    THanks,

    Don

    #20980

    support
    Keymaster

    Hi,

    Thanks for the link. That version actually uses a completely custom makefile layout, so minor glitches are to be expected. If manually copying the file works, this is the recommended way to go around it.

    Regarding HTML, we could add an option to show the contents of additional manually specified directories in Solution Explorer for ESP-IDF projects. Would that work for you?

    #20987

    dedvalson
    Participant

    The option for additional directories is what I was looking for, that sounds good.

    Don

    #20997

    support
    Keymaster

    Hi,

    No problem. We will try to fit this in the next preview build of VisualGDB.

    #21149

    dedvalson
    Participant

    Hi,

    I appreciate your great support and help.

    Earlier in this chain you stated:

    Regarding HTML, we could add an option to show the contents of additional manually specified directories in Solution Explorer for ESP-IDF projects. Would that work for you?

    I just wanted to mention that I would still find that extremely helpful if you get time to do it sometime.

    Thanks,

    Don

     

     

    #21151

    support
    Keymaster

    Hi,

    Sorry for the delay. We are still planning to add this in the near future, as soon as we complete finalizing the Arduino support. Please expect this to be available in the next 3-6 weeks.

    #22182

    support
    Keymaster

    Hi All,

    Just wanted to share an update that we have added support for resource folders to the CMake-based ESP-IDF projects (and other Advanced CMake projects) to VisualGDB 5.4 Preview 6.

    You can use the Add->Pin a Resource Folder in Solution Explorer command to attach an arbitrary folder with the specified file masks to Solution Explorer.

Viewing 15 posts - 1 through 15 (of 15 total)

You must be logged in to reply to this topic.