@mikrojs/firmware 0.18.3-next.20260829153835 → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/mikrojs/CMakeLists.txt +4 -1
- package/components/mikrojs/mik_main.cpp +30 -4
- package/package.json +3 -3
- package/prebuilds/esp32/bootloader/bootloader.bin +0 -0
- package/prebuilds/esp32/mikrojs.bin +0 -0
- package/prebuilds/esp32c3/bootloader/bootloader.bin +0 -0
- package/prebuilds/esp32c3/mikrojs.bin +0 -0
- package/prebuilds/esp32c5/bootloader/bootloader.bin +0 -0
- package/prebuilds/esp32c5/mikrojs.bin +0 -0
- package/prebuilds/esp32c6/bootloader/bootloader.bin +0 -0
- package/prebuilds/esp32c6/mikrojs.bin +0 -0
- package/prebuilds/esp32s3/bootloader/bootloader.bin +0 -0
- package/prebuilds/esp32s3/mikrojs.bin +0 -0
|
@@ -57,6 +57,8 @@ idf_component_register(
|
|
|
57
57
|
"${MIK_SRC_DIR}/builtins.cpp"
|
|
58
58
|
"${MIK_SRC_DIR}/eval_bytecode.cpp"
|
|
59
59
|
"${MIK_SRC_DIR}/mik_abort.cpp"
|
|
60
|
+
"${MIK_SRC_DIR}/mik_http_client.cpp"
|
|
61
|
+
"${MIK_SRC_DIR}/mik_wifi_client.cpp"
|
|
60
62
|
"${MIK_SRC_DIR}/fs.cpp"
|
|
61
63
|
"${MIK_SRC_DIR}/mem.cpp"
|
|
62
64
|
"${MIK_SRC_DIR}/mik_app_config.cpp"
|
|
@@ -69,6 +71,7 @@ idf_component_register(
|
|
|
69
71
|
"${MIK_SRC_DIR}/mik_sys.cpp"
|
|
70
72
|
"${MIK_SRC_DIR}/mik_text_encoding.cpp"
|
|
71
73
|
"${MIK_SRC_DIR}/mik_cbor.cpp"
|
|
74
|
+
"${MIK_SRC_DIR}/mik_schema.cpp"
|
|
72
75
|
"${MIK_SRC_DIR}/mik_sys_codec.cpp"
|
|
73
76
|
"${MIK_SRC_DIR}/mik_result.cpp"
|
|
74
77
|
"${MIK_SRC_DIR}/mik_udp.cpp"
|
|
@@ -193,7 +196,7 @@ include("${MIK_BYTECODE_CMAKE}")
|
|
|
193
196
|
# Force linker to include self-registering native modules
|
|
194
197
|
set(_MIK_MODULES cbor pin i2c i2s spi http http_server wifi rtc nvs_kv sntp sleep neopixel pwm uart ota)
|
|
195
198
|
list(APPEND _MIK_MODULES ota_client)
|
|
196
|
-
set(_MIK_BYTECODE_MODULES abort cbor env result schema fs http/
|
|
199
|
+
set(_MIK_BYTECODE_MODULES abort cbor env result schema fs http/server i2c i2s kv/nvs kv/rtc kv/shared module neopixel observable observable/lazy observable/operators ota ota/client ota/config pin pwm reader sleep spi sntp stdio stream sys test uart udp)
|
|
197
200
|
if(CONFIG_BT_ENABLED)
|
|
198
201
|
list(APPEND _MIK_MODULES ble)
|
|
199
202
|
list(APPEND _MIK_BYTECODE_MODULES ble)
|
|
@@ -376,17 +376,43 @@ void MIK_Main(void) {
|
|
|
376
376
|
|
|
377
377
|
/* Create JS runtime — reserve heap for WiFi, TLS, HTTP, LittleFS, and other
|
|
378
378
|
* ESP-IDF subsystems that allocate after the runtime is created.
|
|
379
|
-
*
|
|
379
|
+
* Measured with dev/feature-costs (C6 and S3, 2026-08): WiFi driver
|
|
380
|
+
* ≈ 33 KB steady, association ≈ 1-2 KB, the rest transient — HTTP
|
|
381
|
+
* ≈ 20-25 KB, TLS handshake ≈ 25-40 KB — stacking to ≈ 80 KB worst case.
|
|
382
|
+
* The 64 KB default under-covers that peak; it holds in practice because
|
|
383
|
+
* JS rarely sits at its cap when a burst lands. */
|
|
380
384
|
MIKRunOptions options;
|
|
381
385
|
MIK_DefaultOptions(&options);
|
|
386
|
+
/* Floor for the JS budget: the runtime's cold-start cost is ~78 KB
|
|
387
|
+
* (atoms, class tables, builtin bytecode), so anything much below this
|
|
388
|
+
* can't even finish MIK_NewRuntimeOptions. */
|
|
389
|
+
constexpr uint32_t kMinJsHeap = 96 * 1024;
|
|
382
390
|
uint32_t free_heap = esp_get_free_heap_size();
|
|
383
|
-
|
|
384
|
-
if (free_heap < reserved) {
|
|
391
|
+
if (free_heap < kMinJsHeap) {
|
|
385
392
|
ESP_LOGE(TAG, "Not enough memory to start JS runtime (free: %" PRIu32
|
|
386
393
|
", need: %" PRIu32 ")",
|
|
387
|
-
free_heap,
|
|
394
|
+
free_heap, kMinJsHeap);
|
|
388
395
|
return;
|
|
389
396
|
}
|
|
397
|
+
/* The budget is computed ONCE, from boot-time free heap, and reused for
|
|
398
|
+
* every runtime this boot creates (test supervisor, post-test session).
|
|
399
|
+
* memReserved is the native subsystems' FUTURE demand from this point, so
|
|
400
|
+
* heap they consume later already counts against it; re-subtracting the
|
|
401
|
+
* full reserve from current free heap at a later creation double-counts
|
|
402
|
+
* what is already resident and shrinks the budget by exactly that amount
|
|
403
|
+
* (observed as e2e module-graph OOMs on the C3). */
|
|
404
|
+
uint32_t reserved = app_config.mem_reserved;
|
|
405
|
+
if (free_heap < reserved || free_heap - reserved < kMinJsHeap) {
|
|
406
|
+
/* Clamp instead of failing: honoring an oversized memReserved would
|
|
407
|
+
* leave the device without REPL/deploy, so a bad deployed config
|
|
408
|
+
* couldn't be fixed over the wire. */
|
|
409
|
+
uint32_t clamped = free_heap - kMinJsHeap;
|
|
410
|
+
ESP_LOGE(TAG,
|
|
411
|
+
"memReserved %" PRIu32 " leaves less than %" PRIu32
|
|
412
|
+
" bytes for JS (free: %" PRIu32 "); clamping reserve to %" PRIu32,
|
|
413
|
+
reserved, kMinJsHeap, free_heap, clamped);
|
|
414
|
+
reserved = clamped;
|
|
415
|
+
}
|
|
390
416
|
options.mem_limit = (int)(free_heap - reserved);
|
|
391
417
|
/* QuickJS's stack overflow check compares the current SP against
|
|
392
418
|
* (stack_top − stack_size). The library default (1 MB) assumes a desktop
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikrojs/firmware",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.19.0",
|
|
4
4
|
"description": "Mikro.js ESP32 firmware: ESP-IDF component, build tools, and project template",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"esp-idf",
|
|
@@ -47,8 +47,8 @@
|
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"esbuild": "^0.28.0",
|
|
50
|
-
"@mikrojs/quickjs": "0.
|
|
51
|
-
"@mikrojs/native": "0.
|
|
50
|
+
"@mikrojs/quickjs": "0.19.0",
|
|
51
|
+
"@mikrojs/native": "0.19.0"
|
|
52
52
|
},
|
|
53
53
|
"engines": {
|
|
54
54
|
"node": ">=24.0.0"
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|