File size: 1,972 Bytes
7947cba
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
diff -ru a/ports/qemu/Makefile b/ports/qemu/Makefile
--- a/ports/qemu/Makefile	2026-10-16 21:42:16
+++ b/ports/qemu/Makefile	2026-10-16 21:42:16
@@ -236,7 +236,7 @@
 CFLAGS += -g
 COPT = -O0
 else
-COPT += -Os -DNDEBUG
+COPT += -O3 -DNDEBUG
 endif
 
 # If Picolibc is available then select it explicitly.  Ubuntu 22.04 ships its
diff -ru a/ports/qemu/mcu/riscv/virt.ld b/ports/qemu/mcu/riscv/virt.ld
--- a/ports/qemu/mcu/riscv/virt.ld	2026-10-16 21:42:16
+++ b/ports/qemu/mcu/riscv/virt.ld	2026-10-16 21:42:16
@@ -28,18 +28,20 @@
 {
     /* Code + Read-Only data segment */
 
+    /* All code in one executable section; read-only data in its own section. */
     .text : ALIGN (4K)
     {
         *(.start)
         *(.text)
-        . = ALIGN (4K);
-        *(.rodata)
-        _sirodata = .;
+        *(.text.*)
     } > ROM
 
-    .rodata : AT (_sirodata) ALIGN (4K)
+    .rodata : ALIGN (4K)
     {
         *(.rodata)
+        *(.rodata.*)
+        *(.srodata)
+        *(.srodata.*)
     } > ROM
 
     /* Data + BSS segment */
diff -ru a/ports/qemu/mpconfigport.h b/ports/qemu/mpconfigport.h
--- a/ports/qemu/mpconfigport.h	2026-10-16 21:42:16
+++ b/ports/qemu/mpconfigport.h	2026-10-16 21:42:16
@@ -29,6 +29,8 @@
 // options to control how MicroPython is built
 
 #define MICROPY_CONFIG_ROM_LEVEL    (MICROPY_CONFIG_ROM_LEVEL_EXTRA_FEATURES)
+#define MICROPY_OPT_COMPUTED_GOTO   (1)
+#define MICROPY_OPT_MAP_LOOKUP_CACHE_SIZE (1024)
 
 #if defined(__ARM_ARCH_ISA_ARM)
 #define MICROPY_EMIT_ARM            (1)
@@ -41,10 +43,7 @@
 #define MICROPY_MAKE_POINTER_CALLABLE(p) ((void *)((mp_uint_t)(p) | 1))
 #elif defined(__riscv)
 #if (__riscv_xlen == 32)
-#define MICROPY_EMIT_RV32           (1)
-#define MICROPY_EMIT_RV32_ZBA       (1)
-#define MICROPY_EMIT_RV32_ZCMP      (1)
-#define MICROPY_EMIT_INLINE_RV32    (1)
+// Native and inline-assembler emitters are off in this build.
 #elif (__riscv_xlen == 64)
 #define MICROPY_PERSISTENT_CODE_LOAD_NATIVE (1)
 #else