Skip to content

Fix: Build calib component also for CA2 device configurations - #424

Open
fr89k wants to merge 1 commit into
MicrochipTech:mainfrom
fr89k:bugfix/calib_not_built_for_ca2_devices
Open

Fix: Build calib component also for CA2 device configurations#424
fr89k wants to merge 1 commit into
MicrochipTech:mainfrom
fr89k:bugfix/calib_not_built_for_ca2_devices

Conversation

@fr89k

@fr89k fr89k commented Aug 4, 2026

Copy link
Copy Markdown

v3.8.0: CA2 device configurations do not compile calib at all (link failures, non-functional CA2 support)

Affected version

  • v3.8.0 (d49c7d5) — regression introduced with the new per-device CMake selection; v3.7.9 is not affected

Configuration

Any configuration supporting only CA2-class devices (ECC204/ECC206, TA010, SHA104/SHA105).

Problem

The calib sources are only compiled when the CMake variable ATCA_CA_SUPPORT is set:

  • lib/CMakeLists.txt:270: if (ATCA_CA_SUPPORT)add_subdirectory(calib)
  • lib/calib/CMakeLists.txt:4: if(ATCA_CA_SUPPORT)target_sources(cryptoauth PRIVATE ${CALIB_SRC})

but the per-device checks set that variable only for classic cryptoauth parts (e.g. ecc608_checks.cmake: set(ATCA_CA_SUPPORT ON)), while CA2 parts set a different one (ecc204_checks.cmake: set(ATCA_CA2_SUPPORT ON)).

A CA2-only configuration therefore compiles none of the calib sources — including the CA2 devices' own command implementations (calib_ca2_*).

At the same time, the same-named preprocessor macro ATCA_CA_SUPPORT (lib/atca_config_check.h) still evaluates to 1 in such builds, so atcacert_client.c and the atcab_* dispatch layer keep referencing those functions. Linking any consumer fails, e.g.:

atcacert_client.c:(.text.atcacert_read_device_loc_ext+0x60): undefined reference to `calib_get_pubkey'
atcacert_client.c:(.text.atcacert_read_device_loc_ext+0xc4): undefined reference to `calib_get_zone_size'
atcacert_client.c:(.text.atcacert_read_device_loc_ext+0x108): undefined reference to `calib_read_bytes_zone_ext'

Even without atcacert, the resulting library cannot talk to the configured CA2 device, since its entire command layer is missing.

Expected behaviour

Selecting only a CA2 device produces a library containing the CA2 command implementations and dispatchers, and consumers link.

Suggested fix

Compile calib whenever classic or CA2 support is selected.

# lib/CMakeLists.txt
-if (ATCA_CA_SUPPORT)
+if (ATCA_CA_SUPPORT OR ATCA_CA2_SUPPORT)

# lib/calib/CMakeLists.txt
-if(ATCA_CA_SUPPORT)
+if(ATCA_CA_SUPPORT OR ATCA_CA2_SUPPORT)

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

Successfully merging this pull request may close these issues.

1 participant