Skip to content

Commit

Permalink
Remove binary chunk assembly logic
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffMboya committed Jan 15, 2025
1 parent 4694fe7 commit f3d03c6
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 30 deletions.
22 changes: 0 additions & 22 deletions embed-proplet/src/wasm_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,6 @@

LOG_MODULE_REGISTER(wasm_handler);

static uint8_t wasm_file_buffer[8192];
static size_t wasm_file_offset = 0;

void handle_wasm_chunk(const uint8_t *data, size_t len)
{
if (wasm_file_offset + len > sizeof(wasm_file_buffer)) {
LOG_ERR("Wasm file too large to fit in buffer.");
wasm_file_offset = 0;
return;
}

memcpy(&wasm_file_buffer[wasm_file_offset], data, len);
wasm_file_offset += len;

if (data[len - 1] == '\0') {
LOG_INF("All Wasm chunks received. Total size: %zu bytes. Executing Wasm file...", wasm_file_offset);
execute_wasm_from_memory(wasm_file_buffer, wasm_file_offset);
wasm_file_offset = 0;
}
}

void execute_wasm_from_memory(const uint8_t *wasm_data, size_t wasm_size)
{
RuntimeInitArgs init_args = { .mem_alloc_type = Alloc_With_System_Allocator };
Expand Down Expand Up @@ -61,7 +40,6 @@ void execute_wasm_from_memory(const uint8_t *wasm_data, size_t wasm_size)
LOG_ERR("Function 'main' not found in Wasm module.");
}


wasm_runtime_deinstantiate(module_inst);
wasm_runtime_unload(module);
wasm_runtime_destroy();
Expand Down
8 changes: 0 additions & 8 deletions embed-proplet/src/wasm_handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,6 @@

#include <zephyr/kernel.h>

/**
* Handle a chunk of incoming Wasm file data.
*
* @param data Pointer to the data chunk.
* @param len Length of the data chunk.
*/
void handle_wasm_chunk(const uint8_t *data, size_t len);

/**
* Execute a Wasm application from the provided memory buffer.
*
Expand Down

0 comments on commit f3d03c6

Please sign in to comment.