Skip to content
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

Zephyr application ABI #64038

Open
mkschreder opened this issue Oct 17, 2023 · 3 comments
Open

Zephyr application ABI #64038

mkschreder opened this issue Oct 17, 2023 · 3 comments
Labels
Feature Request A request for a new feature

Comments

@mkschreder
Copy link

mkschreder commented Oct 17, 2023

Is your feature request related to a problem? Please describe.

Currently Zephyr has source code compatibility with applications that use zephyr, but this is insufficient to be able to define bindings on top of Zephyr for supporting applications written in other languages that would run on zephyr and that could potentially use a completely different build process and compiler.

While Zephyr does define many system calls, there currently does not seem to exist a well defined application interface that does not require the application to be compiled as part of the same build process as the rest of the system.

This problem occurs when trying to interface rust and also erlang atomvm to zephyr.

Describe the solution you'd like

I would like a well defined application interface similar to linux system calls but possibly more "flat" to avoid incuring unnecessary overhead by too many high level abstractions. This interface should not be dependent on macros and other preprocessor definitions that require building with zephyr headers. It should be enough to just link to zephyr.

Not sure if aiming for full posix compliance would solve enough issues. It would at least be good to be able to link seamlessly to code that is built separately outside of zephyr such as when building rust code to object code that is then linked to zephyr.

Possibly if there is some easy way to generate bindings for other languages solely by extracting and post processing system call definitions then this may be a workable solution. Not sure how to proceed here though so thankful for some suggestions.

Describe alternatives you've considered

  • Writing wrappers for some zephyr functions that are to be exposed to "application" code written in a different language: requires way too much work and doesn't work very well since some zephyr stuff is implemented using macros.

Additional context

@mkschreder mkschreder added the Feature Request A request for a new feature label Oct 17, 2023
@pillo79
Copy link
Collaborator

pillo79 commented Oct 17, 2023

#57086 very recently added the Linkable Loadable Extensions (LLEXT) subsystem, and it is now in the just released Zephyr 3.5 (albeit still at a very experimental stage).
Would this eventually fit your use case?

@teburd
Copy link
Collaborator

teburd commented Oct 18, 2023

Even #57086 would also benefit from a stable ABI at least to some extent so that extensions could work across some subset of zephyr versions.

I don't think we can assume Zephyr will have a stable syscall interface at any point in the future as its not the primary interface. Syscalls are easy to add and remove, and doing so changes the syscall table entirely. We would need instead to have C function and object symbols remain stable. That is a difficult task.

@mkschreder
Copy link
Author

@pillo79 looks very promising. Thanks for mentioning that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Request A request for a new feature
Projects
None yet
Development

No branches or pull requests

3 participants