Skip to content

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

Draft
wants to merge 15 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions examples/xedge/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#
# Xedge IoT Toolkit - NuttX Kconfig integration
#
# Xedge is an embedded software toolkit designed to enable high-level developers
# (e.g., web and Lua programmers) to create sophisticated, secure IoT and industrial
# device applications. It abstracts low-level embedded development through a lightweight
# runtime built on top of the Barracuda App Server and Lua, giving developers direct access
# to HTTP(S), WebSockets, MQTT, file system, and device I/O - all from high-level Lua scripts.
#
# This NuttX integration allows developers to compile and run Xedge as a user application,
# bringing powerful device control capabilities and an embedded web server to NuttX-based
# systems.
#
# Use this if you want to build smart, networked embedded devices with minimal C code,
# and maximum productivity.
#

config EXAMPLES_XEDGE
tristate "Xedge IoT Toolkit"
depends on ALLOW_GPL_COMPONENTS
default n
---help---
Enable Xedge support in NuttX. Xedge is a high-level
toolkit that lets you develop complete IoT device
applications using Lua, backed by the Barracuda App
Server. This application demonstrates a complete
Xedge runtime integrated into NuttX.

if EXAMPLES_XEDGE

config EXAMPLES_XEDGE_PROGNAME
string "Program name"
default "xedge"
---help---
This is the name of the ELF executable for the Xedge application in NSH.

config EXAMPLES_XEDGE_PRIORITY
int "Xedge task priority"
default 100
---help---
Set the task priority for the Xedge runtime.

config EXAMPLES_XEDGE_STACKSIZE
int "Xedge stack size"
default 20000
---help---
Set the stack size allocated to the Xedge Lua interpreter and application runtime.

endif
24 changes: 24 additions & 0 deletions examples/xedge/Make.defs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
############################################################################
# apps/examples/xedge/Make.defs
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership. The
# ASF licenses this file to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance with the
# License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
############################################################################

ifneq ($(CONFIG_EXAMPLES_XEDGE),)
CONFIGURED_APPS += $(APPDIR)/examples/xedge
CFLAGS += ${INCDIR_PREFIX}$(APPDIR)/examples/xedge/BAS/inc ${INCDIR_PREFIX}$(APPDIR)/examples/xedge/BAS/inc/arch/Posix ${INCDIR_PREFIX}$(APPDIR)/examples/xedge/BAS/inc/arch/NET/Posix -DNO_INIT_DISK_IO -DUSE_DBGMON=1 -DUSE_IPV6
endif
42 changes: 42 additions & 0 deletions examples/xedge/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
############################################################################
# apps/examples/xedge/Make.defs
Copy link
Contributor

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

#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership. The
# ASF licenses this file to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance with the
# License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
############################################################################

include $(APPDIR)/Make.defs

# Xedge, World! built-in application info

PROGNAME = $(CONFIG_EXAMPLES_XEDGE_PROGNAME)
PRIORITY = $(CONFIG_EXAMPLES_XEDGE_PRIORITY)
STACKSIZE = $(CONFIG_EXAMPLES_XEDGE_STACKSIZE)
MODULE = $(CONFIG_EXAMPLES_XEDGE)

# 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
Copy link
Contributor

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.


XEDGEZIP = BAS/examples/xedge/XedgeZip.c

$(XEDGEZIP):
. prepare.sh

context:: $(XEDGEZIP)


include $(APPDIR)/Application.mk
20 changes: 20 additions & 0 deletions examples/xedge/prepare.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash
# This script clones the required repos and builds the Xedge resource file
Copy link
Contributor

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

Copy link
Author

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

Copy link
Contributor

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.


# Clone BAS repo if not already present
if [ ! -d "BAS" ]; then
git clone https://github.com/RealTimeLogic/BAS.git
fi

# Clone BAS-Resources repo if not already present
if [ ! -d "BAS-Resources" ]; then
git clone https://github.com/RealTimeLogic/BAS-Resources.git
fi

# Build XedgeZip.c (Xedge resource file) only if it doesn't exist
if [ ! -f "BAS/examples/xedge/XedgeZip.c" ]; then
echo "Building XedgeZip.c"
cd BAS-Resources/build/ || exit 1
printf "n\nl\nn\n" | bash Xedge.sh > /dev/null
cp XedgeZip.c ../../BAS/examples/xedge/ || exit 1
fi
Loading
Loading