# Write the firmware-side meta header for one packaged plugin (task T4). # # Invoked as: cmake -D PLUGIN_NAME= -D PLUGIN_MPB_NAME= # -D PLUGIN_VERSION= -D PLUGIN_ENTRY= # [-D PLUGIN_MAGIC=<0xVALUEu>] -D MPB= -D OUT=
# -P gen_meta_header.cmake # # The header carries the exact size and SHA-256 of the mpb that was embedded # into this firmware image, so `poca load` can prove on-device that the bytes # it is about to stage are the bytes that were packaged at build time # (stale-embed detection). PLUGIN_MAGIC (T8) additionally records the # generation-variant activate() magic so the firmware asserts the value a # plugin generation returns. file(SHA256 "${MPB}" mpb_sha256) file(SIZE "${MPB}" mpb_size) string(TOUPPER "${PLUGIN_NAME}" name_upper) file(WRITE "${OUT}" "/* Generated by poc/apps/poc_a/plugins/gen_meta_header.cmake - do not edit. */\n" "#define POCA_${name_upper}_MPB_SIZE ${mpb_size}u\n" "#define POCA_${name_upper}_MPB_SHA256 \"${mpb_sha256}\"\n" "#define POCA_${name_upper}_NAME \"${PLUGIN_MPB_NAME}\"\n" "#define POCA_${name_upper}_VERSION \"${PLUGIN_VERSION}\"\n" "#define POCA_${name_upper}_ENTRY \"${PLUGIN_ENTRY}\"\n") if(PLUGIN_MAGIC) file(APPEND "${OUT}" "#define POCA_${name_upper}_MAGIC ${PLUGIN_MAGIC}\n") endif() message(STATUS "[poca-plugin] ${PLUGIN_NAME}.mpb size=${mpb_size} sha256=${mpb_sha256}")