boards/qemu-armv8a: Add xedge example program and documentation
Build Documentation / build-html (push) Has been cancelled
Docker-Linux / push (push) Has been cancelled

- Add documentation for xedge example program
- Add defconfig to run xedge with qemu-armv8a board

Signed-off-by: Jorge Guzman <jorge.gzm@gmail.com>
This commit is contained in:
Jorge Guzman
2025-07-02 23:41:23 -03:00
committed by Alan C. Assis
parent 433b7170fe
commit 44b65cbafd
4 changed files with 347 additions and 9 deletions
@@ -0,0 +1,141 @@
``xedge_demo`` a lightweight Lua-based web framework for building secure, real-time IoT applications
====================================================================================================
`Xedge <https://realtimelogic.com/products/xedge/>`_ is a robust IoT and web framework that is designed for microcontrollers. It is based on the industrial-grade Barracuda Application Server, designed for seamless OEM integration. Xedge accelerates embedded firmware development by providing a flexible, Lua-based environment and a full stack of industrial-strength protocols, including:
- OPC UA
- Modbus
- MQTT
- SMQ
- WebSockets
- HTTP/HTTPS
This Xedge port for NuttX comes pre-configured and requires:
- TCP/IP v4 and v6 support
- File System support
- 2 MB RAM allocated statically in ``xedge_demo/xedge_main.c``
- QEMU
- Toolchain aarch64-none-elf (gcc-arm-11.2-2022.02 or higher)
.. note::
These instructions set up Xedge in **development mode**. Xedge supports many configuration options that differ between development and production builds. For production settings and optimization, refer to the general Xedge build instructions (details below).
Why Use Lua and Xedge in Embedded Systems
------------------------------------------
Great Lua developers don't treat it as a "better C"; they treat it as a complement. Lua is an extension language, which means it's designed to work alongside C, not replace it. Smart embedded programmers use C for performance-critical, low-level code and Lua for high-level business logic, such as processing sensor data and managing secure cloud connectivity.
Writing embedded business logic purely in C often means hundreds of lines of boilerplate code to manage memory, handle complex APIs, and handle errors. Lua, especially when paired with a framework like Xedge, lifts that burden. It provides high-level libraries and modules out of the box for protocols, networking, file systems, and more.
This shift doesn't just make development easier; it makes it faster. What used to take weeks in C can now be done in days. Lua's simplicity encourages rapid prototyping and quick iteration, which is essential in modern IoT and embedded development, where both time-to-market and security are critical. For a conceptual overview of why this hybrid development model is so powerful, check out the tutorial `Why Smart C Coders Love Lua <https://realtimelogic.com/articles/Using-Lua-for-Embedded-Development-vs-Traditional-C-Code>`_.
.. figure:: https://realtimelogic.com/blogmedia/lots-of-embedded-c-code-cartoon-600.jpg
:align: center
:alt: Too much C code
Getting Started
---------------
To compile Xedge for NuttX, follow these steps:
**1. Configure NuttX for Xedge.**
For this example, we're using **QEMU** and **aarch64-none-elf-gcc** with the **qemu-armv8a** board. You can use any NuttX-supported board,
but Xedge requires boards with external RAM since it defines a 2MB static array in xedge_main.c. We recommend at least 2MB RAM for stable performance.
To install and configure **QEMU** and **aarch64-none-elf-gcc**, follow the instructions in the `NuttX Getting Started Guide <https://nuttx.apache.org/docs/latest/quickstart/quickstart.html>`_.
**2. Build NuttX.**
Run xedge example with qemu-armv8a board ::
$ ./tools/configure.sh qemu-armv8a:xedge_demo
$ make
Running with QEMU::
$ qemu-system-aarch64 -cpu cortex-a53 -smp 4 -nographic \
-machine virt,virtualization=on,gic-version=3 \
-chardev stdio,id=con,mux=on -serial chardev:con \
-netdev user,id=u1,hostfwd=tcp:127.0.0.1:8080-10.0.2.15:80,hostfwd=tcp:127.0.0.1:8443-10.0.2.15:443,hostfwd=tcp:127.0.0.1:10023-10.0.2.15:23 \
-device virtio-net-device,netdev=u1 \
-fsdev local,security_model=none,id=fsdev0,path=/mnt/xxx \
-device virtio-9p-device,id=fs0,fsdev=fsdev0,mount_tag=host \
-mon chardev=con,mode=readline -kernel ./nuttx
.. note:: Replace **/mnt/xxx** with your actual host directory path. This directory will be shared between your host system and the NuttX environment.
Setting up the filesystem mount point
-------------------------------------
Before running Xedge, you need to create and mount a filesystem that Xedge will use for storing configuration files and web content::
nsh> mkdir mnt
nsh> mount -t v9fs -o trans=virtio,tag=host mnt
nsh> mkdir /mnt/lfs
Running Xedge
-------------
Running Xedge in NuttX terminal::
nsh> xedge_demo
[ 18.490000] [CPU0] Xedge: Server listening on IPv4 port 80
[ 18.500000] [CPU0] Xedge: SharkSSL server listening on IPv4 port 443
[ 18.510000] [CPU0] Xedge: Configuration file: /mnt/lfs/xcfg.bin: enoent
[ 38.240000] [CPU1] 10.0.2.2 GET "rtl/"
[ 38.240000] [CPU1] Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138
[ 38.240000] [CPU1] .0.0.0 Safari/537.36
[ 38.240000] [CPU1] Host: 127.0.0.1:8080
[ 38.240000] [CPU1] Connection: keep-alive
[ 38.240000] [CPU1] sec-ch-ua: "Not)A;Brand";v="8", "Chromium";v="138", "Google Chrome";v="138"
[ 38.240000] [CPU1] sec-ch-ua-mobile: ?0
[ 38.240000] [CPU1] sec-ch-ua-platform: "Linux"
[ 38.240000] [CPU1] Upgrade-Insecure-Requests: 1
[ 38.240000] [CPU1] User-Agent: c
[ 38.240000] [CPU1] Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138
[ 38.240000] [CPU1] .0.0.0 Safari/537.36
[ 38.240000] [CPU1] Sec-Purpose: prefetch;prerender
[ 38.240000] [CPU1] Purpose: prefetch
[ 38.240000] [CPU1] Accept:
[ 38.240000] [CPU1] text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image
[ 38.240000] [CPU1] /apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7
[ 38.240000] [CPU1] Sec-Fetch-Site: none
[ 38.240000] [CPU1] Sec-Fetch-Mode: navigate
[ 38.240000] [CPU1] Sec-Fetch-User: ?1
[ 38.240000] [CPU1] Sec-Fetch-Dest: document
[ 38.240000] [CPU1] Accept-Encoding: gzip, deflate, br, zstd
[ 38.240000] [CPU1] Accept-Language: pt,en-US;q=0.9,en;q=0.8
[ 38.240000] [CPU1]
[ 38.240000] [CPU0] 10.0.2.2 Response:
,
[ 38.240000] [CPU0] no-store, no-cache, must-revalidate, max-age=0
Transfer-Encoding: chunked
Keep-
[ 38.240000] [CPU0] Alive: Keep-Alive
Launch your web browser and access 127.0.0.1:8080
You should see the Xedge IDE, which is enabled in developer mode:
.. figure:: xedge_example.png
:align: center
Further Reading
===============
To learn more about Xedge and how to work with it effectively, see the following resources:
- **Using Xedge in Developer Mode:**
Learn how to configure and work with Xedge during development, including dynamic Lua scripting, file system layout, and runtime behavior.
`How to use Xedge when in developer mode <https://realtimelogic.com/ba/doc/en/Xedge.html>`_
- **Building Xedge for Developer or Production Mode:**
Understand the differences between development and production builds, and follow detailed instructions for compiling Xedge appropriately for your target environment.
`How to compile Xedge for developer or production mode <https://realtimelogic.com/ba/examples/xedge/readme.html>`_
Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

@@ -299,6 +299,82 @@ Running with QEMU + hvf on M1/MacBook Pro (macOS 12.6.1)
-mon chardev=con,mode=readline -kernel ./nuttx
----------------------------------
Single Core /w Xedge
----------------------------------
Configuring NuttX and compile:
.. code:: console
$ ./tools/configure.sh -l qemu-armv8a:xedge_demo
$ make
Running with QEMU:
.. code:: console
$ qemu-system-aarch64 -cpu cortex-a53 -smp 4 -nographic \
-machine virt,virtualization=on,gic-version=3 \
-chardev stdio,id=con,mux=on -serial chardev:con \
-netdev user,id=u1,hostfwd=tcp:127.0.0.1:8080-10.0.2.15:80,hostfwd=tcp:127.0.0.1:8443-10.0.2.15:443,hostfwd=tcp:127.0.0.1:10023-10.0.2.15:23 \
-device virtio-net-device,netdev=u1 \
-fsdev local,security_model=none,id=fsdev0,path=/mnt/xxx \
-device virtio-9p-device,id=fs0,fsdev=fsdev0,mount_tag=host \
-mon chardev=con,mode=readline -kernel ./nuttx
.. note:: Replace **/mnt/xxx** with your actual host directory path. This directory will be shared between your host system and the NuttX environment.
Before running Xedge, you need to create and mount a filesystem that Xedge will use for storing configuration files and web content::
.. code:: console
nsh> mkdir mnt
nsh> mount -t v9fs -o trans=virtio,tag=host mnt
nsh> mkdir /mnt/lfs
Running Xedge in NuttX terminal
.. code:: console
nsh> xedge_demo
[ 18.490000] [CPU0] Xedge: Server listening on IPv4 port 80
[ 18.500000] [CPU0] Xedge: SharkSSL server listening on IPv4 port 443
[ 18.510000] [CPU0] Xedge: Configuration file: /mnt/lfs/xcfg.bin: enoent
[ 38.240000] [CPU1] 10.0.2.2 GET "rtl/"
[ 38.240000] [CPU1] Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138
[ 38.240000] [CPU1] .0.0.0 Safari/537.36
[ 38.240000] [CPU1] Host: 127.0.0.1:8080
[ 38.240000] [CPU1] Connection: keep-alive
[ 38.240000] [CPU1] sec-ch-ua: "Not)A;Brand";v="8", "Chromium";v="138", "Google Chrome";v="138"
[ 38.240000] [CPU1] sec-ch-ua-mobile: ?0
[ 38.240000] [CPU1] sec-ch-ua-platform: "Linux"
[ 38.240000] [CPU1] Upgrade-Insecure-Requests: 1
[ 38.240000] [CPU1] User-Agent: c
[ 38.240000] [CPU1] Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138
[ 38.240000] [CPU1] .0.0.0 Safari/537.36
[ 38.240000] [CPU1] Sec-Purpose: prefetch;prerender
[ 38.240000] [CPU1] Purpose: prefetch
[ 38.240000] [CPU1] Accept:
[ 38.240000] [CPU1] text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image
[ 38.240000] [CPU1] /apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7
[ 38.240000] [CPU1] Sec-Fetch-Site: none
[ 38.240000] [CPU1] Sec-Fetch-Mode: navigate
[ 38.240000] [CPU1] Sec-Fetch-User: ?1
[ 38.240000] [CPU1] Sec-Fetch-Dest: document
[ 38.240000] [CPU1] Accept-Encoding: gzip, deflate, br, zstd
[ 38.240000] [CPU1] Accept-Language: pt,en-US;q=0.9,en;q=0.8
[ 38.240000] [CPU1]
[ 38.240000] [CPU0] 10.0.2.2 Response:
,
[ 38.240000] [CPU0] no-store, no-cache, must-revalidate, max-age=0
Transfer-Encoding: chunked
Keep-
[ 38.240000] [CPU0] Alive: Keep-Alive
Launch your web browser and access 127.0.0.1:8080
You should see the Xedge IDE, which is enabled in developer mode:
Single Core /w kernel mode (GICv3)
----------------------------------
@@ -563,16 +639,17 @@ ostest crash at signal testing
Platform Features
=================
The following hardware features are supported:
+--------------+------------+----------------------+
| Interface | Controller | Driver/Component |
+==============+============+======================+
| GIC | on-chip | interrupt controller |
+--------------+------------+----------------------+
| PL011 UART | on-chip | serial port |
+--------------+------------+----------------------+
| ARM TIMER | on-chip | system clock |
+--------------+------------+----------------------+
============== ============ ======================
Interface Controller Driver/Component
============== ============ ======================
GIC on-chip interrupt controller
PL011 UART on-chip serial port
ARM TIMER on-chip system clock
============== ============ ======================
The kernel currently does not support other hardware features on this
QEMU platform.
@@ -0,0 +1,120 @@
#
# This file is autogenerated: PLEASE DO NOT EDIT IT.
#
# You can use "make menuconfig" to make any modifications to the installed .config file.
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
# modifications.
#
CONFIG_ALLOW_BSD_COMPONENTS=y
CONFIG_ALLOW_GPL_COMPONENTS=y
CONFIG_ARCH="arm64"
CONFIG_ARCH_ARM64=y
CONFIG_ARCH_BOARD="qemu-armv8a"
CONFIG_ARCH_BOARD_QEMU_ARMV8A=y
CONFIG_ARCH_CHIP="qemu"
CONFIG_ARCH_CHIP_QEMU=y
CONFIG_ARCH_CHIP_QEMU_A53=y
CONFIG_ARCH_INTERRUPTSTACK=4096
CONFIG_ARCH_SETJMP_H=y
CONFIG_AUDIO=y
CONFIG_BUILTIN=y
CONFIG_CODECS_HASH_MD5=y
CONFIG_DEBUG_FULLOPT=y
CONFIG_DEBUG_SYMBOLS=y
CONFIG_DEFAULT_TASK_STACKSIZE=8192
CONFIG_DEVICE_TREE=y
CONFIG_DEV_SIMPLE_ADDRENV=y
CONFIG_DRIVERS_AUDIO=y
CONFIG_DRIVERS_VIRTIO=y
CONFIG_DRIVERS_VIRTIO_BLK=y
CONFIG_DRIVERS_VIRTIO_MMIO=y
CONFIG_DRIVERS_VIRTIO_NET=y
CONFIG_DRIVERS_VIRTIO_RNG=y
CONFIG_DRIVERS_VIRTIO_SERIAL=y
CONFIG_DRIVERS_VIRTIO_SOUND=y
CONFIG_EXAMPLES_HELLO=y
CONFIG_EXAMPLES_XEDGE_DEMO=y
CONFIG_FAT_LCNAMES=y
CONFIG_FAT_LFN=y
CONFIG_FS_FAT=y
CONFIG_FS_FATTIME=y
CONFIG_FS_PROCFS=y
CONFIG_FS_V9FS=y
CONFIG_HAVE_CXX=y
CONFIG_HAVE_CXXINITIALIZE=y
CONFIG_IDLETHREAD_STACKSIZE=8192
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_INTELHEX_BINARY=y
CONFIG_IOB_ALIGNMENT=16
CONFIG_IOB_BUFSIZE=1534
CONFIG_IOB_NBUFFERS=64
CONFIG_IOB_THROTTLE=8
CONFIG_LIBC_EXECFUNCS=y
CONFIG_LIBC_LOCALE=y
CONFIG_NET=y
CONFIG_NETDB_DNSCLIENT=y
CONFIG_NETDB_DNSCLIENT_ENTRIES=4
CONFIG_NETDB_DNSSERVER_NOADDR=y
CONFIG_NETINIT_DRIPADDR=0x0a000202
CONFIG_NETINIT_IPADDR=0x0a00020f
CONFIG_NETINIT_NOMAC=y
CONFIG_NETUTILS_CODECS=y
CONFIG_NETUTILS_IPERF=y
CONFIG_NETUTILS_NTPCLIENT=y
CONFIG_NETUTILS_TELNETD=y
CONFIG_NETUTILS_TFTPC=y
CONFIG_NETUTILS_WEBCLIENT=y
CONFIG_NETUTILS_XEDGE=y
CONFIG_NET_ALLOC_DEVIF_CALLBACKS=1
CONFIG_NET_BROADCAST=y
CONFIG_NET_ETH_PKTSIZE=1514
CONFIG_NET_ICMP_SOCKET=y
CONFIG_NET_LL_GUARDSIZE=32
CONFIG_NET_MAX_LISTENPORTS=8
CONFIG_NET_RECV_BUFSIZE=32768
CONFIG_NET_STATISTICS=y
CONFIG_NET_TCP=y
CONFIG_NET_TCP_ALLOC_CONNS=20
CONFIG_NET_UDP=y
CONFIG_NFS=y
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_FILEIOSIZE=512
CONFIG_NSH_READLINE=y
CONFIG_NXPLAYER_HTTP_STREAMING_SUPPORT=y
CONFIG_PREALLOC_TIMERS=4
CONFIG_PTHREAD_STACK_MIN=8192
CONFIG_RAM_SIZE=134217728
CONFIG_RAM_START=0x40000000
CONFIG_RAW_BINARY=y
CONFIG_READLINE_CMD_HISTORY=y
CONFIG_RR_INTERVAL=200
CONFIG_SCHED_HAVE_PARENT=y
CONFIG_SCHED_HPWORK=y
CONFIG_SCHED_HPWORKPRIORITY=192
CONFIG_SCHED_LPWORK=y
CONFIG_SMP=y
CONFIG_STACK_COLORATION=y
CONFIG_START_DAY=14
CONFIG_START_MONTH=11
CONFIG_START_YEAR=2022
CONFIG_SYMTAB_ORDEREDBYNAME=y
CONFIG_SYSLOG_TIMESTAMP=y
CONFIG_SYSTEM_DHCPC_RENEW=y
CONFIG_SYSTEM_FDTDUMP=y
CONFIG_SYSTEM_NSH=y
CONFIG_SYSTEM_NXPLAYER=y
CONFIG_SYSTEM_NXRECORDER=y
CONFIG_SYSTEM_PING=y
CONFIG_SYSTEM_SYSTEM=y
CONFIG_SYSTEM_TASKSET=y
CONFIG_SYSTEM_TIME64=y
CONFIG_TESTING_GETPRIME=y
CONFIG_TESTING_OSTEST=y
CONFIG_TESTING_SMP=y
CONFIG_UART1_BASE=0x9000000
CONFIG_UART1_IRQ=33
CONFIG_UART1_PL011=y
CONFIG_UART1_SERIAL_CONSOLE=y
CONFIG_UART_PL011=y
CONFIG_V9FS_VIRTIO_9P=y