-
Notifications
You must be signed in to change notification settings - Fork 606
Adding new example Xedge #3071
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
base: master
Are you sure you want to change the base?
Adding new example Xedge #3071
Conversation
Draft build instructions: Xedge on NuttX ============== 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/xedge_main.c`` .. 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). Getting Started --------------- To compile Xedge for NuttX, follow these steps: 1. **Prepare the Xedge apps directory.** Navigate to the Xedge application folder: .. code-block:: bash cd nuttxspace/apps/examples/xedge 2. **Clone the required dependencies.** .. code-block:: bash git clone https://github.com/RealTimeLogic/BAS.git git clone https://github.com/RealTimeLogic/BAS-Resources.git 3. **Build the Xedge resources.** Move into the build directory: .. code-block:: bash cd BAS-Resources/build/ Run the Xedge resource build script. The following command answers the script prompts automatically: .. code-block:: bash printf "n\nl\nn\n" | bash Xedge.sh 4. **Copy the generated file.** Copy ``XedgeZip.c`` to the Xedge example directory: .. code-block:: bash cp XedgeZip.c ../../BAS/examples/xedge/ 5. **Configure NuttX for Xedge.** Return to the NuttX top-level directory and start the configuration tool: .. code-block:: bash make menuconfig In the configuration menu: - Enable the Xedge application: ``Application Configuration -> Examples -> Xedge`` - Enable dynamic socket callback allocation: ``Networking Support -> Socket Support -> Enable dynamic socket callback allocation`` (set value to **1**) - Increase the number of dynamic TCP connections: ``Networking Support -> TCP/IP Networking -> Dynamic TCP/IP connections allocation`` (set value to **at least 20**) - Enable automatic time synchronization via SNTP: ``Application Configuration -> Network Utilities -> NTP Client`` - Make sure syslog is enabled: ``Device Drivers -> System Logging -> Enable system logging`` ``Device Drivers -> System Logging -> Log to /dev/console `` 6. **Build NuttX.** Save your changes, exit ``menuconfig``, and build: .. code-block:: bash make Running Xedge ------------- Once NuttX is flashed and running, bring up the network interface and start time synchronization: .. code-block:: bash ifup eth0 xedge 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>`_
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@surfskidude Normally examples should compile without user intervention, that means user shouldn't manually clone a repository, etc, it is done automatically using Makefile and CMake commands. Please take a look at apps/graphics/lvgl/ and examples/lvgldemo/. I think Xedge should be divided that same way, maybe including an apps/industry/xedge that will download the framework and an apps/examples/xedgedemo
examples/xedge/Kconfig
Outdated
tristate "Xedge IoT Toolkit" | ||
default n | ||
---help--- | ||
Enable Xedge |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please include details: what this application is support to do? Also include a short explanation about Xedge, what is it? Why should people use this? etc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have created and included a bash script that automates the process, but I have not included the script in the makefile. I do not recommend it to be this way. This becomes clear when reading the Xedge documentation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you need follow the nuttx guide to integrate 3rd party code, otherwise we can't merge your change, sorry.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you are looking at an outdated version
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, I look at your latest version, please study how other 3rd party library is integrated into nuttx before making your own porting:
https://github.com/apache/nuttx-apps/tree/master/examples/lvgldemo
https://github.com/apache/nuttx-apps/tree/master/graphics/lvgl
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @surfskidude very interesting :-)
- Please update git commit subject to
examples/xedge: ..
. - Please move descriptive git commit body to
nuttx/Documentation/applications/iot/xedge
(documentation is in a separate nuttx.git repository so needs separate PR) and link the doc PR in description of this PR so we can merge in sync. In this git commit description just leave short commit summary :-) - Please
git commit -s
the commits.
please remove the merge commit |
Draft build instructions: Xedge on NuttX ============== 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/xedge_main.c`` .. 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). Getting Started --------------- To compile Xedge for NuttX, follow these steps: 1. **Prepare the Xedge apps directory.** Navigate to the Xedge application folder: .. code-block:: bash cd nuttxspace/apps/examples/xedge 2. **Clone the required dependencies.** .. code-block:: bash git clone https://github.com/RealTimeLogic/BAS.git git clone https://github.com/RealTimeLogic/BAS-Resources.git 3. **Build the Xedge resources.** Move into the build directory: .. code-block:: bash cd BAS-Resources/build/ Run the Xedge resource build script. The following command answers the script prompts automatically: .. code-block:: bash printf "n\nl\nn\n" | bash Xedge.sh 4. **Copy the generated file.** Copy ``XedgeZip.c`` to the Xedge example directory: .. code-block:: bash cp XedgeZip.c ../../BAS/examples/xedge/ 5. **Configure NuttX for Xedge.** Return to the NuttX top-level directory and start the configuration tool: .. code-block:: bash make menuconfig In the configuration menu: - Enable the Xedge application: ``Application Configuration -> Examples -> Xedge`` - Enable dynamic socket callback allocation: ``Networking Support -> Socket Support -> Enable dynamic socket callback allocation`` (set value to **1**) - Increase the number of dynamic TCP connections: ``Networking Support -> TCP/IP Networking -> Dynamic TCP/IP connections allocation`` (set value to **at least 20**) - Enable automatic time synchronization via SNTP: ``Application Configuration -> Network Utilities -> NTP Client`` - Make sure syslog is enabled: ``Device Drivers -> System Logging -> Enable system logging`` ``Device Drivers -> System Logging -> Log to /dev/console `` 6. **Build NuttX.** Save your changes, exit ``menuconfig``, and build: .. code-block:: bash make Running Xedge ------------- Once NuttX is flashed and running, bring up the network interface and start time synchronization: .. code-block:: bash ifup eth0 xedge 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>`_
Signed-off-by: surfskidude <[email protected]>
OK, I updated a few things and ran git commit -s ... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The added files are far from the coding standard we use in NuttX.
Also, the external project should be automatically downloaded, unpacked and configured without any user intervention as its done for other external projects.
In this state this PR shouldn't be merged. Please look at other external projects like lvgl in NuttX and fix this PR :)
Xedge is an existing and mature product with over 130,000 lines of code developed under a separate coding style. Unfortunately, changing the formatting or structure of the source, including the NuttX startup integration code, is not possible. For this reason, both the Xedge core and the NuttX startup code that boots into Xedge must remain as-is. |
@surfskidude I'm not talking about Xedge sources, I'm talking about sources that are added to NuttX repositories in this PR :) I understand that external functions may not meet the NuttX standard, but everything else that goes into the NuttX repositories should. |
examples/xedge/Kconfig
Outdated
tristate "Xedge IoT Toolkit" | ||
default n | ||
---help--- | ||
Enable Xedge support in NuttX. Xedge is a high-level toolkit that lets you |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove spaces and add a tab (line 22 to 24)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have removed all spaces in the file
examples/xedge/Kconfig
Outdated
string "Program name" | ||
default "xedge" | ||
---help--- | ||
This is the name of the ELF executable for the Xedge application in NSH. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove spaces and add a tab (line 32)
examples/xedge/Kconfig
Outdated
int "Xedge stack size" | ||
default 20000 | ||
---help--- | ||
Set the stack size allocated to the Xedge Lua interpreter and application runtime. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove spaces and add a tab (44)
@@ -0,0 +1,35 @@ | |||
############################################################################ | |||
# apps/examples/xedge/Make.defs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
apps/examples/xedge/Make.defs -> apps/examples/xedge/Makefile
Signed-off-by: surfskidude <[email protected]>
please squash your change into one patch. |
@@ -0,0 +1,20 @@ | |||
#!/bin/bash | |||
# This script clones the required repos and builds the Xedge resource file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you need move the script to Makefile
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not recommend this. The user needs to understand the sequence. Please see: https://realtimelogic.com/ba/examples/xedge/readme.html#release
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's required by nuttx, if you don't follow, please close this pr since nobody can merge the patch which doesn't comply with the guide.
|
||
# Xedge: BAS Example | ||
|
||
MAINSRC = xedge_main.c BAS/src/BAS.c BAS/src/dlmalloc.c BAS/src/arch/Posix/ThreadLib.c BAS/src/arch/NET/generic/SoDisp.c BAS/src/DiskIo/posix/BaFile.c BAS/examples/xedge/src/xedge.c BAS/examples/xedge/ BAS/examples/xedge/XedgeZip.c |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please split your example and xedge package to different path.
examples/xedge/Kconfig
Outdated
tristate "Xedge IoT Toolkit" | ||
default n | ||
---help--- | ||
Enable Xedge |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, I look at your latest version, please study how other 3rd party library is integrated into nuttx before making your own porting:
https://github.com/apache/nuttx-apps/tree/master/examples/lvgldemo
https://github.com/apache/nuttx-apps/tree/master/graphics/lvgl
/**************************************************************************** | ||
* xedge_main.c | ||
* | ||
* Copyright (C) 2025. All rights reserved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you need use apache copyright like other files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried, but it failed. Sorry, I am no git expert.
git rebase -i HEAD~11
Auto-merging examples/xedge/Kconfig
CONFLICT (add/add): Merge conflict in examples/xedge/Kconfig
Auto-merging examples/xedge/xedge_main.c
CONFLICT (add/add): Merge conflict in examples/xedge/xedge_main.c
error: could not apply 055fcfc... Adding new example Xedge
hint: Resolve all conflicts manually, mark them as resolved with
hint: "git add/rm <conflicted_files>", then run "git rebase --continue".
hint: You can instead skip this commit: run "git rebase --skip".
hint: To abort and get back to the state before "git rebase", run "git rebase --abort".
Could not apply 055fcfc... Adding new example Xedge
let me change this patch to draft until it follow the nuttx guide. |
@surfskidude here is a new example how to integrate 3rd party library, please study and change your patch as needed: #3074 |
No checkpatch.sh errors, except "Mixed case identifier found"
Draft build instructions:
Xedge on NuttX
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:
This Xedge port for NuttX comes pre-configured and requires:
xedge/xedge_main.c
.. 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).
Getting Started
To compile Xedge for NuttX, follow these steps:
Prepare the Xedge apps directory.
Navigate to the Xedge application folder:
.. code-block:: bash
cd nuttxspace/apps/examples/xedge
Clone the required dependencies.
.. code-block:: bash
git clone https://github.com/RealTimeLogic/BAS.git
git clone https://github.com/RealTimeLogic/BAS-Resources.git
Build the Xedge resources.
Move into the build directory:
.. code-block:: bash
cd BAS-Resources/build/
Run the Xedge resource build script. The following command answers the script prompts automatically:
.. code-block:: bash
printf "n\nl\nn\n" | bash Xedge.sh
Copy the generated file.
Copy
XedgeZip.c
to the Xedge example directory:.. code-block:: bash
cp XedgeZip.c ../../BAS/examples/xedge/
Configure NuttX for Xedge.
Return to the NuttX top-level directory and start the configuration tool:
.. code-block:: bash
make menuconfig
In the configuration menu:
Enable the Xedge application:
Application Configuration -> Examples -> Xedge
Enable dynamic socket callback allocation:
Networking Support -> Socket Support -> Enable dynamic socket callback allocation
(set value to 1)Increase the number of dynamic TCP connections:
Networking Support -> TCP/IP Networking -> Dynamic TCP/IP connections allocation
(set value to at least 20)Enable automatic time synchronization via SNTP:
Application Configuration -> Network Utilities -> NTP Client
Make sure syslog is enabled:
Device Drivers -> System Logging -> Enable system logging
Device Drivers -> System Logging -> Log to /dev/console
Build NuttX.
Save your changes, exit
menuconfig
, and build:.. code-block:: bash
make
Running Xedge
Once NuttX is flashed and running, bring up the network interface and start time synchronization:
.. code-block:: bash
ifup eth0
xedge
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>
_Summary
Impact
Testing