CryptoAutholib with ESP_IDF and Platformio for ESP32

I have been using the cryptoautholib library with previous versions according to the examples at GitHub - kmwebnet/ECC608-Configure: ATECC608A configuration for ESP32 platform in VisualCodeStudio and platformio.

Now with the new ESP_IDF (4.0) I have installed CryptoAuthLib by Gabriel Notman on platformio with the LibraryaManager.

I can’t make the kmwebnet’s examples works

To test, simply, in the Hello_word example I incorporate and the begin

ATCAIfaceCfg cfg = {
.iface_type = ATCA_I2C_IFACE,
.devtype = ATECC608A,
.atcai2c.slave_address = 0XC0,
.atcai2c.bus = 1,
.atcai2c.baud = 100000,
.wake_delay = 1500,
.rx_retries = 20
};

ATCA_STATUS status = atcab_init (& cfg);

if (status! = ATCA_SUCCESS) {
ESP_LOGE (TAG_ECC608, "atcab_init () failed with ret = 0x% 08d \ r \ n", status); 

But I don’t know how to make find the library

#include “cryptoauthlib.h” does not work

#include “C: \ Users \ JOSE \ .platformio \ lib \ CryptoAuthLib_ID6095 \ src \ cryptoauthlib.h” find the library but does not work

the ouput is:

Compiling .pio\build\esp32dev\esp-idf\src\hello_world_main.c.o
In file included from C:\Users\JOSE\.platformio\lib\CryptoAuthLib_ID6095\src\cryptoauthlib.h:34,
                 from src\hello_world_main.c:14:
C:\Users\JOSE\.platformio\lib\CryptoAuthLib_ID6095\src\hal/atca_hal.h:32:10: fatal error: atca_status.h: No such file or directory

Putting in plaftform.ini

[env:esp32dev]
platform = espressif32
framework = espidf
board = esp32dev
monitor_speed = 115200

lib_deps =
# Using library Id
6095

# Using library Name
CryptoAuthLib

# Depend on specific version
CryptoAuthLib@1.0.1

# Semantic Versioning Rules
CryptoAuthLib@^1.0.1
CryptoAuthLib@~1.0.1
CryptoAuthLib @> = 1.0.1

It doesn’t work either.

I have been with Visual Code Studio and Plaftform for a short time and this is driving me crazy.

The old way to incorporate it was simply by placing it in the project directory and defining it in platformio.ini

[env: esp32dev]
platform = espressif32@1.11.2
board = esp32dev
framework = espidf
src_filter =
    + <*>
    - <. git />
    - <svn />
    - <example />
    - <examples />
    - <test />
    - <tests />
    - <cryptoauthlib / app />
    - <cryptoauthlib / test />
    - <cryptoauthlib / python />
    - <cryptoauthlib / third_party />
    - <cryptoauthlib / lib / hal />
    - <cryptoauthlib / lib / basic / atca_helpers.c>
    + <cryptoauthlib / lib / hal / atca_hal.c>
    + <cryptoauthlib / lib / hal / atca_hal.h>
    + <cryptoauthlib / lib / hal / hal_esp32_timer.c>
    + <cryptoauthlib / lib / hal / hal_freertos.c>
build_flags =
    -I "lib / cryptoauthlib / lib"
    -I "lib / cryptoauthlib"
    -I "$ PROJECT_CORE_DIR / packages / framework-espidf / components / freertos / include / freertos"
    -DESP32
    -DATCA_HAL_I2C
    -DATCA_PRINTF
    -DATCA_USE_RTOS_TIMER
upload_port = COM7
monitor_speed = 115200

This project is targeted against ESP-IDF 3.3.0.

Also the example uses a different fork of the cryptoauthlibrary

and not https://github.com/GabrielNotman/cryptoauthlib.

Can’t you use GitHub - kmwebnet/ECC608-Configure: ATECC608A configuration for ESP32 platform but change the platform and the path in the build_flags to just target the latest platform and ESP-IDF?

I’ve fix the freetos path
-I “$PROJECT_CORE_DIR/packages/framework-espidf/components/freertos/include/freertos”
but it doesn´t work yet
I have change the crytoautolib from Gabriel Notman for the Microchip original library.

I put the library in a Lib folder inside proyect folder and change cryptoautolib\lib folder name for
cryptoautolib\src

I have add in platformio.ini
**build_flags = **

** -I “$PROJECT_DIR/lib/cryptoauthLib/src”**

And now I can compile with ESP_IDF 4.0

The only problem are the directives for remove o add parts of llbrary to the build process

Before the new platformio configuration I could do

src_filter = **
** -<cryptoauthlib/lib/hal/>

To avoid use this part of library, and I could add a folder (ports) with the necessary files modified

For example for used a new atca_helpers.c file instead of the file of llbrary

Now I have directly changed the library files, and I dont like it, but it works.

Now I am going to implement the provisioning functions in Azure with azure-iot-sdk-c, with the example https://github.com/kmwebnet/ECC608-AzureDPS-Provision
But that in the next days

Thank you for you help.