v2n-secure-element-sign
Talk to the OPTIGA Trust M on V2N's BRD_I2C from a Linux/Yocto user-space app on the Cortex-A55 cluster: probe it, read its Coprocessor UID, and run a raw APDU session. The driver runs Infineon's host library through a PAL on the portable <alp/peripheral.h> I²C and timing calls. Nothing here writes to the chip — despite the directory name, this example does not sign anything.
Source: examples/v2n/v2n-secure-element-sign/.
BRD_I2C is A55/Linux-exclusive — the Cortex-M33 must never master it. Earlier releases ran this example on m33_sm and issued a hand-rolled CalcSign APDU; the v0.17.0 example runs on the A55 and is read-only.
What it shows
- Open
BRD_I2C(bus_id = 8, Linux/dev/i2c-8) at 400 kHz and initialiseoptiga_trust_m_t.optiga_trust_m_init_with_resetreads theI2C_STATEregister only. - Reset hook for an idled part. A Trust M idle for more than about 10 s can stop ACKing until it is hardware-reset.
SE_RSTis driven by the GD32 supervisor, which the kernel'salplab,gd32-bridge-gpiodriver owns, so the app finds these-rstline on thegd32-bridge-gpiogpiochip and passes it to the driver as the reset hook. If the part is silent the driver pulsesSE_RSTonce and probes again. An image whose kernel does not export these-rstline gets no hook (plain probe). optiga_trust_m_read_product_infoopens the Trust M application and reads the 27-byte Coprocessor UID (data object0xE0C2).optiga_trust_m_send_apduruns a raw session: the app sendsOpenApplicationitself, thenGetDataObject(0xE0C2), and checks the bytes match step 3.
Failing after the reset retry means the chip is not on the bus, is not strapped to address 0x30, or is held in reset.
board.yaml
som:
sku: E1M-V2N101
preset: e1m-x-evk
cores:
a55_cluster:
app: ./src
peripherals:
- i2c
chips:
- optiga_trust_m
diagnostics:
log_level: info
Expected output (OPTIGA-populated SoM)
[se] I2C_STATE probe -> ALP_OK
[se] UID: cim CD platform 16 model 33 fw 80101071 build 2564
[se] raw APDU UID matches (27 bytes)
[se] RESULT PASS: Trust M probe, Coprocessor UID and raw APDU session work
Expected output (missing or held-in-reset chip)
[se] RESULT FAIL: optiga_trust_m_init (Trust M not ACKing) -> -2
Wiring this into a real app
The raw APDU session reaches every Trust M command (key generation, ECDSA, secure NVM) today, with the caller owning the command bytes and the application session. Typed calls for those commands, and a PSA driver registered with <alp/security.h>'s MbedTLS wrapper so the chip is used transparently, are still to come.
See also
<alp/chips/optiga_trust_m.h><alp/security.h>reference- AEN Secure-Element Sign — the AEN-side counterpart