-
Notifications
You must be signed in to change notification settings - Fork 671
[GSoC2025] Add Silicon Heaven protocol adaptation into NuttX and SHV examples #3170
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?
Conversation
b1c5f3b
to
7ca6f60
Compare
ad61dea
to
12f3c4f
Compare
b657b39
to
a6ede5f
Compare
I came across an issue, which must be fixed: locally, I was running against All i know is that the script worked with the previous version, the target device functionality has not changed. |
|
@simbit18 I know about that, I'm working on a different fix and I'm gonna fix the linter error too. |
I also need to address the
I'm in favor with the second option. That means I'll have to specify the commit hash inside the Makefile. Currently, I'm running against master as it's still draft and I'm fixing last errors. Then I'll specify the correct version. |
a6ede5f
to
39ec06f
Compare
I am also for the second option. The commit hash can even be a configurable option in Kconfig to easily allow the change of a version per project. |
7fd3ae8
to
2657996
Compare
Thanks to Pavel Pisa, the Currently, Also I suppose the export of the library should be done outside of this PR as a separate commit. I have found out we can use an I have also changed the apps a bit, now the mandatory arguments are position independent. Also the pipeline is failing due to a typo. But I do not think it's a typo the pipeline should fail at since it is used in a macro in the Makefile. But I'll consult this with Pavel Pisa. |
2657996
to
2912530
Compare
02eed11
to
3bac145
Compare
I have unmarked this commit as draft since we have agreed upon a stable solution. The only thing that needs to be done is the documention, I'm working on it right now. |
netutils/libshvc/Kconfig
Outdated
|
||
config NETUTILS_LIBSHVC | ||
bool "Silicon Heaven Protocol (lightweight C implementation)" | ||
select NETUTILS_LIBULUT |
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.
can we use depends on instead select
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 am not sure. The depend would hide SHV support if LIBULUT is not enabled and we do not want to enable it by default. When somebody looks for SHV (which is probable start point/intention) then enable of SHV would enable ULUT when select is used. And ULUT is not used for anything else in the NuttX for now. It can change in future if we want and common sense would consider useful to include some other our project utilizing uLUt
- uLan communication “Open Source implementation of a multi-master RS485 communication protocol” https://ulan.sourceforge.net/ (already tested with NuttX and includes NuttX support in mainline in addition to Linux, Windows and operating-system-less devices - sysless)
- OCERA Real-Time CAN https://ortcan.sourceforge.net/ with dynamic, EDS lead based CAN open device, manager and monitor (little dated unfortunately, but with extension to CAN FD interesting project still) (Linux NuttX and system less support included)
- Open Real-Time Ethernet (ORTE) DDS RTPS C language implementation https://orte.sourceforge.net/ Again without care for long time and only protocol version 1.0 at that time. But it has been exactly the worldwide second implementation compatible with original RTI NDDS and that interoperability has been base for DDS Internet standard acceptance. It can be interesting still if upgrade to DDS RTPS 2.0 version is finished (there is the start of update by Jiri Vlasak - https://en.osm.town/@qeef).
- Small User Interface Toolkit (SuiTk) https://gitlab.com/pikron/sw-base/suitk/-/wikis/home providing higher level layer above Microwindows which allows for hand written C code run on systemless MCUs with 64 kB RAM and still utilizing event connectors (Qt signal slot equivalents) and with little more RAM it can use full declarative interface, busyness logic description dynamically build from files with XML syntax subset.
So there is some potential for uLUt broader use with NuttX, but it is only support dependency for SHV in NuttX for now. When situation changes we can reconsider the choice.
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.
select XXX
has its problems and should be avoided when possible. There were discussions about this topic in several places on github lately (I don't remember exactly where) and on the mailing list: https://lists.apache.org/thread/n7qq5341cln5d3d4roy5nj23yc8hgzn6
The conclusion is that we should use select
only for options that are not visible to the user. BTW, the user can always show hidden symbols using "show-all mode" in menuconfig.
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 initially wanted to use depends on because i think it's not that of a big issue to manually turn it on by yourself. But Pavel Píša (mentor) suggested using select. Still, Im in favor of depends on.
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.
OK, then I suggest to add into uLUt text (required by SHV)
or something similar that even if you search through visible options for SHV, you find the uLUt and enable it to see more.
"uLan Utilities Library (ULUT, required by SHV)"
Is that OK?
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.
We can use something like this:
if !NETUTILS_LIBULUT && !NETUTILS_LIBSHVC
comment "uLan Utilities Library requiered to support SHV"
endif
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 agree with @raiden00pl, you see what it's for but the moment you turn it on, it dissapears and it does not bloat the kconfig menu.
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.
@raiden00pl @ppisa fixed. Also I've tested that the whole system compiles with ulut only and ulut + shv.
$(SHVOBJS) : shv-build-library | ||
|
||
$(SHVDIR): | ||
$(call CLONE, https://github.com/silicon-heaven/shv-libs4c, $(SHVDIR), ) |
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.
should we skip the clone if user already git clone manually like other 3rd party project?
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 am not sure what is the best option. If the repository is already cloned then there should be mechanism how to keep it at the correct version matching given NuttX version/commit.
I have implemented next script for integration into pysimCoder
https://github.com/zdebanos/pysimCoder/blob/gsoc-2025-shv-refactor/ExtLibs/extlib-fetch.sh
It keeps the local
branch, if the repository is clean it switches it to the specified library version by reset. If there is only small local change which does not clash with switch to newly required commit, it informs user and switches. If there are conflicting changes it fails. If there is another branch and state is clean it switches and it is user's task to move changes.
I am not sure what is preferred and typical for NuttX
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 think the current solution is better - you get the correct version that Is supported by the library (i.e. what we think works the best). Your approach would in my opinion overcomplicate things.
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 also think we should use a similar approach as in other 3rd party projects to be consistent in the project: download the archive and unpack it.
Example here:
nuttx-apps/wireless/bluetooth/nimble/Makefile
Lines 43 to 58 in 10cab6b
$(NIMBLE_TAR): | |
$(Q) curl -L $(NIMBLE_URL) -o $(NIMBLE_TAR) | |
$(NIMBLE_UNPACKDIR): $(NIMBLE_TAR) | |
$(Q) tar zxf $(NIMBLE_TAR) | |
$(Q) mv mynewt-nimble-$(CONFIG_NIMBLE_REF) $(NIMBLE_UNPACKDIR) | |
$(Q) touch $(NIMBLE_UNPACKDIR) | |
# Download and unpack tarball if no git repo found | |
ifeq ($(wildcard $(NIMBLE_UNPACKDIR)/.git),) | |
context:: $(NIMBLE_UNPACKDIR) | |
distclean:: | |
$(call DELFILE,$(NIMBLE_TAR)) | |
$(call DELDIR,$(NIMBLE_UNPACKDIR)) | |
endif |
By default, if the user only wants to use a 3rd party project, the code will always be downloaded from a verified hash.
But skipping the package download when a git repository exists makes the work of developers working on a given 3rd party project much easier.
Maintaining the correct version of code when a user uses their own git repo is not a problem. The user has to clone the repository to the correct location, and if they do so, we can assume they're doing it consciously and intentionally.
Another thing is that the user may want to use custom 3rd party package with custom patches. With the current solution this is impossible.
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.
In a perfect world we would like to have all external dependencies listed somewhere, fetch before build, and then build. This is important for testing automation in order to provide all dependencies prior build is executed where malicious scripts can be executed. But this is another story of the future :-)
$(ULUTOBJS) : ulut-build-library | ||
|
||
$(ULUTDIR): | ||
$(call CLONE, https://git.code.sf.net/p/ulan/ulut.git, $(ULUTDIR), ) |
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.
should we skip the clone if user already git clone manually like other 3rd party project
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.
Ditto
566328c
to
02a7762
Compare
…xamples This commit marks the end of my GSoC 2025 project in the NuttX section. All changes: - Silicon Heaven protocol (SHV) implementation: The library is cloned from github.com/silicon-heaven/shv-libs4c and compiled here. The library has out-of-the-box support for NuttX and possibly all posix systems. The library is compiled with CONFIG_SHV_LIBS4C_PLATFORM define set to "nuttx". The library's dependancy is Pavel Pisa's ULUT and originates from Michal Lenc's GSoC. - examples/shv-nxboot-updater: An example which constructs a SHV tree with which you can perform firmware updates using a SHV "file node". The file node wraps around NXBoot's update partition. The application also allows for NXBoot confirmation of the images. This application is to be meant used as a "background service", started before any apps, possibly using rcS. The tree is allocated as GAVL (see below). - examples/shv-test: An example which constructs a SHV tree and gives the user the ability to choose which type of construction should be used, either: - GAVL: dynamic SHV tree allocation encapsulated within an AVL tree. - GSA: dynamic SHV tree allocation encapsulated within a continuous array with binary search - GSA_STATIC: SHV tree is defined as static const, this means all the data structures are placed in .rodata. Extremely beneficial for embedded systems, as .rodata is located in flash and embedded systems usually have more flash than sram, thus reducing sram usage. The downside is that the definitions are rather tedious, but can be automated in case of some code generation (like in pysimCoder). All of it is places in a continuous array with binary search. Signed-off-by: Stepan Pressl <pressl.stepan@gmail.com>
02a7762
to
e0543e7
Compare
This commit marks the end of my GSoC 2025 project in the NuttX section.
Currently creating as a draft pull request.
I have agreed with Pavel Pisa to separate the library's dependancy named ulut from the shv-libs4c repository (located currently here https://github.com/silicon-heaven/shv-libs4c/tree/master/submodule). This will require more time for me. Also, I have discussed with Karel Koci from Elektroline a.s. about the posibilities of the exports of external libraries - something that I somehow solved in this commit: #3154.
In the end we have agreed that this should be considered as "hacking the whole Makefile system" and I should rather come up with a better solution, and thus I'm postponing it. Since I require the export for the GSoC, I'd be glad to leave it here as draft until I solve all the issues already mentioned.
I am about to add documentation into the nuttx repo, too.
Summary
Please look into the commit's verbose message :-).
Impact
Adds the Silicon Heaven protocol implementation. A framework designed to register your callbacks into your application. The callbacks are organized into nodes and the nodes can form a tree structure.
Testing
The testing was done on my custom samv7 board. In nuttx:
tools/configure.sh myboard/myconfig
- configuration OKmake
- downloads the shv-libs4c repo from github, and compiles OKDISCLAIMER: in my GSoC, I was using
make export
. But with the solution used here (https://github.com/zdebanos/pysimCoder/tree/shv-refactor) I succesfully compiled against automatically generated source code in pysimCoder.