@mikrojs/firmware 0.17.1-pr-300.20260731010039 → 0.18.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.
@@ -125,7 +125,7 @@ target_compile_options(${COMPONENT_LIB} PRIVATE -Wno-implicit-fallthrough -Wno-m
125
125
  # -Wno-unused-but-set-variable: several quickjs.c variables are only read
126
126
  # inside assert(), which NDEBUG compiles away.
127
127
  set_source_files_properties(${QUICKJS_SOURCES} PROPERTIES
128
- COMPILE_DEFINITIONS NDEBUG
128
+ COMPILE_DEFINITIONS "NDEBUG;${QUICKJS_COMPILE_DEFINITIONS}"
129
129
  COMPILE_OPTIONS "-Wno-unused-but-set-variable")
130
130
 
131
131
  # ── Board and version metadata ──────────────────────────────────────
@@ -195,7 +195,6 @@ mikrojs_generate_bytecode(
195
195
  SYMBOL_PREFIX "mikro"
196
196
  TARGET gen_bytecode
197
197
  WORKING_DIRECTORY "${MIKROJS_PROJECT_DIR}"
198
- FREEZE_ATOMS
199
198
  )
200
199
  add_dependencies(${COMPONENT_LIB} gen_bytecode)
201
200
  target_include_directories(${COMPONENT_LIB} PRIVATE "${gen_bytecode_INCLUDE_DIR}")
@@ -93,7 +93,16 @@ static MIKI2sState* mik__i2s_get(JSContext* ctx, JSValue this_val) {
93
93
  return static_cast<MIKI2sState*>(JS_GetOpaque2(ctx, this_val, mik_i2s_class_id));
94
94
  }
95
95
 
96
- static void mik__i2s_buf_free(JSRuntime* rt, void* opaque, void* ptr) { js_free_rt(rt, ptr); }
96
+ /* Backing-store hook for the sample buffer: size 0 means free. A non-zero
97
+ * size services ArrayBuffer.prototype.transfer(), which relocates even
98
+ * non-resizable buffers. The buffer is js_malloc'd. */
99
+ static void* mik__i2s_buf_realloc(JSRuntime* rt, void* opaque, void* ptr, size_t size) {
100
+ if (size == 0) {
101
+ js_free_rt(rt, ptr);
102
+ return nullptr;
103
+ }
104
+ return js_realloc_rt(rt, ptr, size);
105
+ }
97
106
 
98
107
  /* write() returns Promise<Result>; settle synchronously for the immediate cases
99
108
  * (errors, fully-drained writes). Consumes `value`. */
@@ -105,7 +114,7 @@ static JSValue mik__i2s_resolved(JSContext* ctx, JSValue value) {
105
114
  * samples). The typed array never shares its buffer with another chunk, so it is
106
115
  * safe to retain. */
107
116
  static JSValue mik__i2s_new_samples(JSContext* ctx, uint8_t* data, size_t bytes) {
108
- JSValue ab = JS_NewArrayBuffer(ctx, data, bytes, mik__i2s_buf_free, nullptr, false);
117
+ JSValue ab = JS_NewArrayBuffer(ctx, data, bytes, 0, mik__i2s_buf_realloc, nullptr, false);
109
118
  if (JS_IsException(ab)) {
110
119
  js_free(ctx, data);
111
120
  return ab;
@@ -415,8 +415,8 @@ void MIK_Main(void) {
415
415
  * came up successfully." If a step earlier in boot panicked or
416
416
  * aborted, the banner doesn't print — the absence is the diagnostic.
417
417
  *
418
- * Two lines: first identifies the device (version, chip, cores,
419
- * radios), second reports free app heap.
418
+ * Two lines: first identifies the device (version, engine version,
419
+ * chip, cores, radios), second reports free app heap.
420
420
  *
421
421
  * The "free app heap" number is QuickJS's `malloc_limit − malloc_size`
422
422
  * immediately after runtime init — i.e. how much the user's JS code
@@ -437,10 +437,11 @@ void MIK_Main(void) {
437
437
  char banner[160];
438
438
  int off = 0;
439
439
  #ifdef MIK_FW_VERSION
440
- off += snprintf(banner + off, sizeof(banner) - off, "Mikro.js v%s on %s", MIK_FW_VERSION,
441
- CONFIG_IDF_TARGET);
440
+ off += snprintf(banner + off, sizeof(banner) - off, "Mikro.js v%s (quickjs-ng %s) on %s",
441
+ MIK_FW_VERSION, JS_GetVersion(), CONFIG_IDF_TARGET);
442
442
  #else
443
- off += snprintf(banner + off, sizeof(banner) - off, "Mikro.js on %s", CONFIG_IDF_TARGET);
443
+ off += snprintf(banner + off, sizeof(banner) - off, "Mikro.js (quickjs-ng %s) on %s",
444
+ JS_GetVersion(), CONFIG_IDF_TARGET);
444
445
  #endif
445
446
  /* Stable per-board device id (chip MAC as Crockford Base32). */
446
447
  if (dev_id && dev_id[0]) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikrojs/firmware",
3
- "version": "0.17.1-pr-300.20260731010039",
3
+ "version": "0.18.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/native": "0.17.1-pr-300.20260731010039+a6350ad",
51
- "@mikrojs/quickjs": "0.17.1-pr-300.20260731010039+a6350ad"
50
+ "@mikrojs/native": "0.18.0",
51
+ "@mikrojs/quickjs": "0.18.0"
52
52
  },
53
53
  "engines": {
54
54
  "node": ">=24.0.0"
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -20,3 +20,14 @@ CONFIG_ESP_CONSOLE_SECONDARY_USB_SERIAL_JTAG=y
20
20
  CONFIG_SPIRAM=y
21
21
  CONFIG_SPIRAM_USE_MALLOC=y
22
22
  CONFIG_SPIRAM_IGNORE_NOTFOUND=y
23
+
24
+ # Xtensa call frames are markedly larger than RISC-V ones (windowed ABI
25
+ # register spills), and quickjs-ng 0.16's inlined interpreter grew them
26
+ # further: the base 24 KB main-task stack leaves a JS stack limit (2/3 of
27
+ # the task stack, see mik_main.cpp) of only ~23 interpreter frames, which is
28
+ # thin for deeply nested user code. Observable dispatch no longer scales
29
+ # with chain length, so this is margin rather than a fix for a known
30
+ # failure; it stays because internal SRAM is not the constraint here
31
+ # (512 KB, JS heap in PSRAM). The esp32 classic keeps the 24 KB base, where
32
+ # the same 16 KB would come straight out of a ~230 KB heap.
33
+ CONFIG_ESP_MAIN_TASK_STACK_SIZE=40960