lancaster-university / microbit-v2-samples

CODAL build tools and sample programs for the micro:bit v2.x
MIT License
66 stars 87 forks source link

Update CMakeLists.txt to add DEVICE_DAL_VERSION to codal_extra_definitions.h. #87

Closed microbit-carlos closed 5 months ago

microbit-carlos commented 6 months ago

Together with this PR:

Resolves https://github.com/lancaster-university/codal-microbit-v2/issues/138.

This only works when the CMake build system is reading target-locked.json instead of target.json, which should be most of the time. The only way in which it uses target.json is when the codal.json flag has target.dev set.

With both PRs this test programme prints the codal-microbit-v2 latest tag in all entries (basically whatever is in codal-microbit-v2/target-locked.json#L74:

int main() {
    uBit.init();

    uBit.serial.printf("MICROBIT_DAL_VERSION: %s\n", MICROBIT_DAL_VERSION);
    uBit.serial.printf("DEVICE_DAL_VERSION: %s\n", DEVICE_DAL_VERSION);
    uBit.serial.printf("microbit_dal_version(): %s\n", microbit_dal_version());
    uBit.serial.printf("uBit.getVersion(): %s\n", uBit.getVersion());

    while (true);
}
microbit-carlos commented 5 months ago

Superseded by: