yf13 commented on PR #840: URL: https://github.com/apache/nuttx-apps/pull/840#issuecomment-3095292242
Based on latest micropython master, I added an NuttX app `interpreters/mpy` like below: ```sh $ lt interpreters/mpy/ -rw-rw-r-- 1 yf yf 1536 Jul 21 11:09 Kconfig -rw-rw-r-- 1 yf yf 3646 Jul 21 12:07 CMakeLists.txt -rw-rw-r-- 1 yf yf 1049 Jul 21 12:22 mpconfigport.h -rw-rw-r-- 1 yf yf 1468 Jul 21 12:22 main.c ``` Here `main.c` and `mpconfigport.h` are copied from micropython embedding example. The `mpconfigport.h` is enriched to select architecture per NuttX configs. This same NuttX app can run on QEMU rv32 target with all NuttX operation modes: - The FLAT mode has no memory protection at all. - The PROTECTED mode uses MPU to isolate apps from NuttX kernel. - The KERNEL mode further uses MMU to isolate Apps and the kernel. Here is a session log from the KERNEL mode: ```sh $ size nuttx bin/mpy text data bss dec hex filename 113187 421 24048 137656 219b8 nuttx 110434 4 8588 119026 1d0f2 bin/mpy $ qemu-system-riscv32 -M virt,aclint=on -semihosting -nographic -bios nuttx ABC NuttShell (NSH) nsh> cat /proc/version NuttX version 0.0.0 3ba55aa7-dirty Jul 21 2025 12:08:03 rv-virt/nsbi-dirty nsh> ls -l /system/bin/mpy -rwxrwxrwx 120572 /system/bin/mpy nsh> free total used free maxused maxfree nused nfree Kmem: 4166652 8028 4158624 20448 4156376 25 4 Page: 4194304 602112 3592192 3592192 nsh> mpy hello world! [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]eol iter 00000000 iter 00000001 iter 00000002 iter 00000003 iter 00000004 iter 00000005 iter 00000006 iter 00000007 iter 00000008 iter 00000009 caught exception ZeroDivisionError('divide by zero',) run GC collect finish nsh> free total used free maxused maxfree nused nfree Kmem: 4166652 8028 4158624 20448 4156376 25 4 Page: 4194304 602112 3592192 3592192 ``` @dpgeorge, I am wondering if this is the right approach? Of course there are still a lot to do before we can have a meaningful integration: - Micropython side to enhance embeding with more features, ideally to have REPL. - The port needs use more NuttX services like POSIX threads, file system, drivers, connectivity stacks etc. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org