-
I am seeing high host CPU use from QEMU with idle REPL console on both |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
MicroPython is primarily for bare-metal, and there is no RTOS in the core. So probably it just spins as fast as the "CPU" can execute. Which will take up non-trivial amount of CPU on the host, when using an emulator. |
Beta Was this translation helpful? Give feedback.
-
The QEMU port will spin in If you want to lower CPU time, you may achieve that by rewriting the console's UART interaction to be interrupt driven - and I guess you'll then need to implement your own version of |
Beta Was this translation helpful? Give feedback.
-
thank you both. Now I understand current behavior is expected due to hot spins in UART read. |
Beta Was this translation helpful? Give feedback.
The QEMU port will spin in
ports/qemu/mphalport.c
regardless of the architecture, inmp_hal_stdin_rx_chr
to be precise.If you want to lower CPU time, you may achieve that by rewriting the console's UART interaction to be interrupt driven - and I guess you'll then need to implement your own version of
MICROPY_INTERNAL_WFE
for both Arm and RV32 targets or the interpreter won't process timers/delayed events until there's an incoming keypress.