Skip to content

[Question] Can goto-cc be used with an ESP-IDF project easily #8640

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
jdbaptista opened this issue May 19, 2025 · 0 comments
Open

[Question] Can goto-cc be used with an ESP-IDF project easily #8640

jdbaptista opened this issue May 19, 2025 · 0 comments

Comments

@jdbaptista
Copy link

Firstly, I apologize for anything that doesn't make sense here because I am both trying to wrap my head around what I can do and how I can potentially do it. I am interested in testing some portions of my esp32s3 project (built with ESP-IDF) with formal verification. An example of what I mean is:

/**
 * Specifies that a greater major version outputs UPDATE_MAJOR.
 */
void spec1(void)
{
    VersionInfo in;
    UpdateType out;

    __CPROVER_assume(in.hardwareVer == OTA_HARDWARE_VERSION);
    __CPROVER_assume(in.revisionVer == OTA_REVISION_VERSION);
    __CPROVER_assume(in.majorVer > OTA_MAJOR_VERSION);

    out = compareVersions(in);

    assert(out == UPDATE_MAJOR);
}

I would typically write some unit tests for this, however these types of CBMC tests seem more robust and quicker to create. I was able to test compareVersions by copying it out of the source file it is in and manually copying dependencies. I would like to avoid the overhead of copying and manually mocking dependencies. The issue I am facing is that my source files tend to include a large number of ESP-IDF header files:

#include "esp_crt_bundle.h"
#include "esp_err.h"
#include "esp_http_client.h"
#include "esp_https_ota.h"
#include "esp_log.h"
#include "esp_system.h"
#include "freertos/FreeRTOS.h"
#include "freertos/portmacro.h"
#include "freertos/projdefs.h"
#include "freertos/task.h"
#include "sdkconfig.h"

This means that I need to use goto-cc with effectively every header file and source file necessary for my project, down to hardware specific files. I believe the correct solution would be to decouple my business logic from hardware files, however even then including something like esp_err.h requires inclusion of various ESP-IDF internal source and header files. I have tried to get around this issue by including every source and header file in the project in my call to goto-cc with some custom CMake, however I always seem to be missing some files.

One question I had was whether it is possible to have goto-cc drop-in as a replacement for the xtensa-esp32s3-elf-gcc cross-compiler. If that is not possible, I suppose it is a lost cause to try to track down all the machine-specific source files that my project depends on. Overall, I would like to know if anyone has used CBMC or other formal verification tools alongside ESP-IDF for an ESP32 and how I can go about doing that without refactoring my entire project. Thank you!

@jdbaptista jdbaptista changed the title Question: Can goto-cc be used with an ESP-IDF project easily [Question] Can goto-cc be used with an ESP-IDF project easily May 19, 2025
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

No branches or pull requests

1 participant