<alp/version.h> — Version & ABI Feature-Test
Compile-time version identification plus per-class ABI-tier macros. Application code that must adapt to the SDK it builds against (#if ALP_VERSION_AT_LEAST(...)) or feature-test an ABI tier reads everything it needs from this one header.
This header is [ABI-STABLE]: the macro names and the composite encoding are frozen. The numeric values change every release by design, and the per-class ALP_ABI_STATUS_* values move only via a deliberate promotion PR.
Header
#include <alp/version.h>
Compile-time version macros
The numeric macros track the SDK release (metadata/sdk_version.yaml) and are rewritten on every version bump — never hand-edit them.
| Macro | v0.9.0 value | Notes |
|---|---|---|
ALP_VERSION_MAJOR | 0 | ABI-breaking changes bump this. |
ALP_VERSION_MINOR | 9 | Additive ABI changes bump this. |
ALP_VERSION_PATCH | 0 | Fixes with no surface change. |
ALP_VERSION_STRING | "0.9.0" | String literal, "MAJOR.MINOR.PATCH". |
ALP_VERSION_ENCODE(maj, min, pat) | (maj << 16) | (min << 8) | pat | Encode a triple into one comparable integer. |
ALP_VERSION | ALP_VERSION_ENCODE(0, 9, 0) | This SDK's version as one comparable integer. |
ALP_VERSION_AT_LEAST(maj, min, pat) | ALP_VERSION >= ALP_VERSION_ENCODE(…) | Compile-time "at least" check, usable in #if. |
Feature-testing a version
ALP_VERSION_AT_LEAST expands to a preprocessor-constant expression, so it works directly in #if:
#if ALP_VERSION_AT_LEAST(0, 9, 0)
// use a surface introduced in v0.9.0 (e.g. alp_i2c_target_open)
alp_i2c_target_t *tgt = alp_i2c_target_open(&cfg);
#else
// fall back for older SDKs
#endif
ABI-tier macros
Every public header declares one ABI tier via its @par ABI status: marker. <alp/version.h> exposes that classification to the preprocessor so application code can feature-test a class before depending on it.
| Macro | Value | Meaning |
|---|---|---|
ALP_ABI_EXPERIMENTAL | 1 | Surface may change in any minor release. |
ALP_ABI_STABLE | 2 | Frozen; removals / renames require a major bump. |
Each peripheral / service class carries an ALP_ABI_STATUS_<CLASS> macro set to one of the two tiers above:
#if ALP_ABI_STATUS_STORAGE == ALP_ABI_STABLE
// rely on <alp/storage.h> staying frozen until the next major
#endif
Per-class ABI status (v0.9.0)
| Class(es) | ABI tier |
|---|---|
GPIO, I2C, SPI, UART (all of <alp/peripheral.h>) | ALP_ABI_STABLE |
ADC, DAC, PWM, CAN, RTC, WDT, COUNTER, I2S, AUDIO | ALP_ABI_STABLE |
BLE, IOT, SECURITY, INFERENCE, MPROC, HW_INFO, GUI, RPC | ALP_ABI_STABLE |
STORAGE, USB, POWER, CAMERA, DISPLAY, DSP, GPU2D, TMU | ALP_ABI_EXPERIMENTAL |
MODEL, UPDATE_LOG, BACKEND, CAP | ALP_ABI_EXPERIMENTAL |
ADC's base surface is stable, but its newer filter / spectrum additions stay experimental at function granularity — see the ADC page and the header. Function-level experimental additions inside an otherwise-stable class (e.g. <alp/peripheral.h>'s new I²C/SPI target-mode surface) are likewise marked in the header, not in ALP_ABI_STATUS_*.
Runtime version getter
const char *alp_version_string(void);
Returns the SDK release as a static "MAJOR.MINOR.PATCH" string; never NULL.
Compile-time vs link-time
ALP_VERSION_STRING is baked from the header you compiled against. alp_version_string() reports the SDK the application was linked against. When the SDK is consumed as a shared library, the runtime can be newer than the header at compile time — compare the two to detect that skew:
printf("built against %s, linked against %s\n",
ALP_VERSION_STRING, alp_version_string());
See also
- API Overview — the full header surface
<alp/peripheral.h>— GPIO / I²C / SPI / UART, including v0.9 target-modedocs/abi-stability.md— the ABI policy