This doesn’t really say more than “oh noes, linking failed :(” (img). The error right before that line would have been the actual important one. Could be a missing function, a missing object, wrong C and C++ intermixing, et cetara. Please upload the whole project to e.g. Github, Google Drive or Dropbox so that we can exactly determine what’s wrong with it.
This Microchip-written library is terrible. They’re missing all the extern "C" declarations in their headers as if you only needed to use it in C. So none of your I2C HAL implementations etc are found because you implement them in a C++ file (which you must to call Arduino functions etc). Also you’re not implementing some needed HAL functions like delay and create the same global variables although they should only be file-local (static) or not existant at all.
And just for reference, these are the actual linker errors that should have been posted from the start:
c:/users/max/.platformio/packages/toolchain-xtensa/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/bin/ld.exe: .pio\build\huzzah\src\main.cpp.o:(.bss.status+0x0): multiple definition of `status'; .pio\build\huzzah\src\ATECCX08A_Arduino\hal\hal_esp8266_i2c.cpp.o:(.bss.status+0x0): first defined here
c:/users/max/.platformio/packages/toolchain-xtensa/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/bin/ld.exe: .pio\build\huzzah\src\ATECCX08A_Arduino\atca_execution.c.o:(.text.atca_execute_command+0x0): undefined reference to `atca_delay_ms'
c:/users/max/.platformio/packages/toolchain-xtensa/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/bin/ld.exe: .pio\build\huzzah\src\ATECCX08A_Arduino\atca_execution.c.o: in function `atca_execute_command':
atca_execution.c:(.text.atca_execute_command+0x36): undefined reference to `atca_delay_ms'
c:/users/max/.platformio/packages/toolchain-xtensa/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/bin/ld.exe: atca_execution.c:(.text.atca_execute_command+0x66): undefined reference to `atca_delay_ms'
c:/users/max/.platformio/packages/toolchain-xtensa/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/bin/ld.exe: .pio\build\huzzah\src\ATECCX08A_Arduino\atca_iface.c.o: in function `atwake':
atca_iface.c:(.text.atwake+0x18): undefined reference to `atca_delay_ms'
c:/users/max/.platformio/packages/toolchain-xtensa/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/bin/ld.exe: .pio\build\huzzah\src\ATECCX08A_Arduino\atca_iface.c.o: in function `atidle':
atca_iface.c:(.text.atidle+0x10): undefined reference to `atca_delay_ms'
c:/users/max/.platformio/packages/toolchain-xtensa/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/bin/ld.exe: .pio\build\huzzah\src\ATECCX08A_Arduino\hal\atca_hal.c.o:(.text.hal_iface_init+0x0): undefined reference to `hal_i2c_init'
c:/users/max/.platformio/packages/toolchain-xtensa/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/bin/ld.exe: .pio\build\huzzah\src\ATECCX08A_Arduino\hal\atca_hal.c.o:(.text.hal_iface_init+0x4): undefined reference to `hal_i2c_post_init'
c:/users/max/.platformio/packages/toolchain-xtensa/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/bin/ld.exe: .pio\build\huzzah\src\ATECCX08A_Arduino\hal\atca_hal.c.o:(.text.hal_iface_init+0x8): undefined reference to `hal_i2c_receive'
c:/users/max/.platformio/packages/toolchain-xtensa/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/bin/ld.exe: .pio\build\huzzah\src\ATECCX08A_Arduino\hal\atca_hal.c.o:(.text.hal_iface_init+0xc): undefined reference to `hal_i2c_send'
c:/users/max/.platformio/packages/toolchain-xtensa/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/bin/ld.exe: .pio\build\huzzah\src\ATECCX08A_Arduino\hal\atca_hal.c.o:(.text.hal_iface_init+0x10): undefined reference to `hal_i2c_sleep'
c:/users/max/.platformio/packages/toolchain-xtensa/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/bin/ld.exe: .pio\build\huzzah\src\ATECCX08A_Arduino\hal\atca_hal.c.o:(.text.hal_iface_init+0x14): undefined reference to `hal_i2c_wake'
c:/users/max/.platformio/packages/toolchain-xtensa/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/bin/ld.exe: .pio\build\huzzah\src\ATECCX08A_Arduino\hal\atca_hal.c.o:(.text.hal_iface_init+0x18): undefined reference to `hal_i2c_idle'
c:/users/max/.platformio/packages/toolchain-xtensa/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/bin/ld.exe: .pio\build\huzzah\src\ATECCX08A_Arduino\hal\atca_hal.c.o:(.text.hal_iface_init+0x1c): undefined reference to `hal_i2c_release'
only thing added is the library.json file that describes how to build the library to PlatformIO in here. Specifically, it does not build any source files that are for mbedtls, openssl, wolffsl or HALs of other unrelated microcontrollers
use new updated config file and move atca_config.h to src/
The ESP8266’s initial bootloader messages are at 74880, so if you change to that in Serial.begin(74880); and use monitor_speed = 74880 you should be able to see it properly.
This may also be a crash message. I have not tested this on hardware yet.
Thank you so much, that was it. I’m able to answer the prompts. One more question since I’m brand new to the platformio environment. The config file is in the main.cpp as you can see, what would be the easiest way to build the encrypt/decrypt file.
The tutorial had both of the files in that Example folder as .ino arduino sketch files. So took both of those out and just placed the code in the configuartion_example.ino into main.cpp
Would I just create another project with everything being the same and use the code in the AES_crypto_example.ino in the main.cpp or is there an easier way?
This actually works? I plugged in my ESP and saw it wanted to write to I2C address 0x00 instead of the configured 0xc0 address and I thought this was a bug. I compared the code again to other HALs in the github repo and saw them using
ATCAIfaceCfg *cfg = atgetifacecfg(iface);
int address = cfg->atcai2c.slave_address;
After I used that, it did want to write to 0xc0. I also configured trace output to actually show in the serial monitor. (The repo’s code was updated with it).
You can put the file as src/AES_crypto_example.cpp and then create two environments in your platformio.ini, each of which compiles one example (the config or the crypto example or whatever) by using build_src_flags accordingly. I just did that in my repo.
I actually changed the i2C to 0x60 in the init portion of the config main.cpp (I’m using the ATECC608 module from Adafruit). I’ll pull down the latest files from your repo and check it out.
I might have locked myself out of the chip.
I made it down to:
Do you want to write the key in the given slot ?
In the terminal and it will display:
Impossible to Write configuration | Code Error 0xFFFFFFF4
and then it goes back to the beginning:
Do you want to write the configuration ?
Impossible to Write configuration | Code Error 0xFFFFFFF4
UPDATE: The chip isn’t locked, I just used the arduino library given by adafruit to assigned the cert and the serial monitor came back with it not being locked.
Very hard to debug, you would have to compare I2C transactions between one and the other library, maybe it does something different or has a different setting.
I don’t think there is anything wrong with the 12C communication since I’m sending and recieving bytes from the ATECC608. The problem comes when the “lock configuration” protion of the comes. I’m reading that error code as 0xF4 which states that the chip is a state where the operation could not be excuted. I’m looking the configuration example and I’m not sure it’s correct for this chip. I’m going to post another question dealing with this topic considering you helped my my original inquiry. Thank you for that!