Skip to content

boards/qemu-armv8a: Add xedge example program and documentation #16665

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

JorgeGzm
Copy link
Contributor

@JorgeGzm JorgeGzm commented Jul 3, 2025

Summary

Add documentation and xedge exemple program using qemu-armv8a board.

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

Depends on: apache/nuttx-apps#3120 and #16759

Impact

Users can use Edge to develop their IoT applications.

Testing

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.

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 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

image

@github-actions github-actions bot added Area: Documentation Improvements or additions to documentation Size: M The size of the change in this PR is medium labels Jul 3, 2025
@JorgeGzm JorgeGzm marked this pull request as draft July 3, 2025 02:51
@JorgeGzm
Copy link
Contributor Author

JorgeGzm commented Jul 3, 2025

The approval of this PR depends on apache/nuttx-apps#3120

xiaoxiang781216
xiaoxiang781216 previously approved these changes Jul 3, 2025
@xiaoxiang781216
Copy link
Contributor

The approval of this PR depends on apache/nuttx-apps#3120

please create a config on qemu, sim or real device to enable xedge.

Copy link
Contributor

@hartmannathan hartmannathan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this related to PR-16352? #16352

@acassis
Copy link
Contributor

acassis commented Jul 3, 2025

Is this related to PR-16352? #16352

I think we need to close #16352

@hartmannathan
Copy link
Contributor

Is this related to PR-16352? #16352

I think we need to close #16352

@acassis OK I have closed #16352. Thanks!

hartmannathan
hartmannathan previously approved these changes Jul 3, 2025
Copy link
Contributor

@hartmannathan hartmannathan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The text LGTM. As others have said, this PR depends on PR in nuttx-apps, so let's wait until that is merged.

@JorgeGzm
Copy link
Contributor Author

JorgeGzm commented Jul 4, 2025

The approval of this PR depends on apache/nuttx-apps#3120

please create a config on qemu, sim or real device to enable xedge.

I add a example for xedge with qemu-armv8a board

The download and build rules for the xedge library depend on apache/nuttx-apps#3120

acassis
acassis previously approved these changes Jul 4, 2025
@acassis
Copy link
Contributor

acassis commented Jul 4, 2025

@JorgeGzm please split this commit in documentation: and boards/qemu: commits to make it easy to be tracked in the Release Notes during the Release phase

@acassis
Copy link
Contributor

acassis commented Jul 4, 2025

@JorgeGzm please also include this printscreen in the Documentation, this way user will see what to expect from this example

cederom
cederom previously approved these changes Jul 4, 2025
Copy link
Contributor

@cederom cederom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @JorgeGzm :-)

@acassis acassis requested a review from jerpelea July 4, 2025 14:04
@JorgeGzm JorgeGzm dismissed stale reviews from cederom and acassis via 05482c5 July 4, 2025 15:55
@JorgeGzm JorgeGzm changed the title example/xedge: Add documentation for xedge example program. boards/qemu-armv8a: Add xedge example program and documentation Jul 4, 2025
@acassis acassis marked this pull request as ready for review July 4, 2025 17:52
acassis
acassis previously approved these changes Jul 4, 2025
jerpelea
jerpelea previously approved these changes Jul 7, 2025
@JorgeGzm JorgeGzm force-pushed the master branch 3 times, most recently from 973ffa2 to 8b35fc1 Compare July 11, 2025 14:58
@acassis
Copy link
Contributor

acassis commented Jul 11, 2025

@JorgeGzm it is failing:

/home/runner/work/nuttx/nuttx/Documentation/applications/examples/xedge_demo/index.rst:2:Title underline too short.

Please run "make html" locally to catch any issues with Documentation

@acassis
Copy link
Contributor

acassis commented Jul 23, 2025

@JorgeGzm nxstyle modification needs to be in a separated commit to easy tracking in the Release Notes

@JorgeGzm
Copy link
Contributor Author

@JorgeGzm nxstyle modification needs to be in a separated commit to easy tracking in the Release Notes

Ok, I made the change and uploaded the whitelist modification to PR #16759

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

Signed-off-by: Jorge Guzman <jorge.gzm@gmail.com>
@xiaoxiang781216
Copy link
Contributor

@JorgeGzm please fix the build error(https://github.com/apache/nuttx/actions/runs/16522725505/job/46728268075?pr=16665):

====================================================================================
Configuration/Tool: qemu-armv8a/xedge_demo
2025-07-25 13:23:04
------------------------------------------------------------------------------------
  Cleaning...
  Configuring...
  Building NuttX...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0

100  496k  100  496k    0     0  2359k      0 --:--:-- --:--:-- --:--:-- 2359k

100 3867k    0 3867k    0     0  5929k      0 --:--:-- --:--:-- --:--:-- 5929k
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0

100  653k    0  653k    0     0  1893k      0 --:--:-- --:--:-- --:--:-- 1893k
100  813k    0  813k    0     0  2282k      0 --:--:-- --:--:-- --:--:-- 15.5M
make[3]: *** [Makefile:60: xedge-deps] Error 1
make[3]: Target 'context' not remade because of errors.
make[2]: *** [Makefile:57: /github/workspace/sources/apps/netutils/xedge_context] Error 2
make[2]: Target 'context_all' not remade because of errors.
make[1]: *** [Makefile:187: context] Error 2
make: *** [tools/Unix.mk:458: /github/workspace/sources/apps/.context] Error 2
make: Target 'all' not remade because of errors.
/github/workspace/sources/nuttx/tools/testbuild.sh: line 385: /github/workspace/sources/nuttx/../nuttx/nuttx.manifest: No such file or directory
  [1/1] Normalize qemu-armv8a/xedge_demo

@JorgeGzm
Copy link
Contributor Author

xedge-deps

I don't know exactly what is happening. When I test the "make xedge-deps" command directly on my machine, I need to comment out the routines in apps/netutils/xedge/makefile:

#include $(APPDIR)/Make.defs
#include $(APPDIR)/Application.mk

I compiled the routine that the CI is failing on, and on my local PC the download routine does not fail.

user:~/nuttxspace/apps/netutils/xedge$ make xedge-deps
# ############################################################################
# Config and Fetch xedge
# ############################################################################
Downloading BAS from hash 9f74a2f778b002ad8441471b8a7a5b13172dbe76...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 3867k    0 3867k    0     0  3999k      0 --:--:-- --:--:-- --:--:-- 16.8M
Downloading BAS-Resources from hash 227a4b998300fa4cfde871dc7dac92c09e1636c2...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100  813k    0  813k    0     0   951k      0 --:--:-- --:--:-- --:--:-- 24.4M
# ############################################################################
# Library Configuration
# ############################################################################
Creating XedgeZip.c

When I list the local folder, I can see that the files were actually downloaded:

user:~/nuttxspace/apps/netutils/xedge$ ls
BAS  BAS-Resources  Kconfig  Make.defs  Makefile

During the build process, I don't encounter any failures either:

nuttx$ export PATH=$PATH:/home/user/Downloads/gcc-arm-11.2-2022.02-x86_64-aarch64-none-elf/bin
user:~/nuttxspace/nuttx$ make distclean -j
user:~/nuttxspace/nuttx$ ./tools/configure.sh qemu-armv8a:xedge_demo
user:~/nuttxspace/nuttx$ make -j
...
LD: nuttx
CP: nuttx.hex
CP: nuttx.bin

Based on the failure logs, the errors seem to be occurring in the echo and unzip routines. I'm not sure if this error is actually on my side or if it's a CI environment issue. The download works correctly on my local machine.

file: apps/netutils/xedge/makefile
56    if [ ! -d $(BAS_UNPACKNAME) ]; then \
57        echo "Downloading BAS from hash $(BAS_HASH)..."; \
58        curl -f -L $(BAS_ZIP_URL) -o bas-temp.zip || \
59        (echo "Error downloading BAS"; exit 1); \
60        unzip -q bas-temp.zip; \
61        mv BAS-$(BAS_HASH) $(BAS_UNPACKNAME); \
62        rm -f bas-temp.zip; \
63    fi

Since the same makefile works locally but fails in CI, I suspect there may be some environment differences I'm not accounting for. What would you recommend I investigate to identify and resolve this issue?

@xiaoxiang781216
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Documentation Improvements or additions to documentation Board: arm64 Size: M The size of the change in this PR is medium
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants