Skip to content

Commit

Permalink
indicate what user program is run; also more debug logging
Browse files Browse the repository at this point in the history
  • Loading branch information
mmoskal committed Apr 27, 2023
1 parent 0aa6df3 commit 4d7617b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
3 changes: 3 additions & 0 deletions cli/src/build.ts
Expand Up @@ -441,7 +441,10 @@ export async function compileFile(

const host = await getHost(buildConfig, options, folder)

const t0 = Date.now()
const res = compileWithHost(fn, host)
const time = Date.now() - t0
verboseLog(`compile: ${time}ms`)

if (res.binary) {
res.dbg.binarySHA256 = toHex(await sha256([res.binary]))
Expand Down
2 changes: 2 additions & 0 deletions runtime/devicescript/devicescript.c
Expand Up @@ -63,6 +63,8 @@ devs_ctx_t *devs_create_ctx(const uint8_t *img, uint32_t size, const devs_cfg_t
jd_sha256_update(img, size);
jd_sha256_finish(ctx->program_hash);

DMESG("DevS-SHA256: %*p", JD_SHA256_HASH_BYTES, ctx->program_hash);

setup_ctx(ctx, img);

return ctx;
Expand Down
12 changes: 9 additions & 3 deletions runtime/devicescript/devsmgr.c
Expand Up @@ -110,8 +110,11 @@ static void run_img(srv_t *state, const void *img, unsigned size) {
devs_cfg_t cfg = {.mgr_service_idx = state->service_index};
state->ctx = devs_create_ctx(img, size, &cfg);
if (state->ctx) {
if (img != devs_empty_program)
if (img != devs_empty_program) {
DMESG("* start: %s %s", dcfg_get_string("@name", NULL),
dcfg_get_string("@version", NULL));
devsdbg_restarted(state->ctx);
}
}
}

Expand Down Expand Up @@ -154,8 +157,11 @@ static void try_run(srv_t *state) {
}

static void stop_program(srv_t *state) {
devs_free_ctx(state->ctx);
state->ctx = NULL;
if (state->ctx) {
devs_free_ctx(state->ctx);
state->ctx = NULL;
DMESG("* stop program");
}
send_status(state);
}

Expand Down

0 comments on commit 4d7617b

Please sign in to comment.