-
Notifications
You must be signed in to change notification settings - Fork 14
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
TODOs and ideas #12
Comments
What do you think about full kernel conversion to C++ and C API being implemented as wrappers? This way, Argon could benefit from (modern) C++ features. Even Splitting code into more meaningful namespaces and classes would help with organizations and clearing API. |
(Sorry I missed your question until now.) Several thoughts about C vs C++ as the main API… My original goal for Argon was to have a very small kernel that still had a good feature set, and supports fully statically allocated kernel objects (among other goals). C++ wrapping C produces smaller code because you can't include the C++ defines from the C header, meaning inline implementations of the APIs aren't possible. Another issue with C wrapping C++ is that it makes static allocation for kernel objects difficult and/or ugly. There's also the concern that embedded developers still tend to prefer C. But that's pretty minor… I don't give it much weight now. Otoh, I almost exclusively use C++ for embedded projects, though I tend to use it in a "C++ lite" style and try to avoid template metaprogramming. So… I'm leaning towards dropping the C API. 😄 (For a C API, I'm wondering if it would be better to have a separate project, or at least a separate implementation.) |
Yeah that one of main reasons I like Argon even though it's not mainstream rtos and has some hiccups. Internal principles are clear ad easy to debug/tackle with.
I used to program embedded systems in C too, but ~2 years ago, I've switched to C++ because there were advantages only. I went even further and utilize template meta-programming quite a lot (where it makes sense). With that, I have a lot of things solved at compile time. Well, decision about C API and everything is up to you (I am kind of alien here :). I don't see strong reason to have C API when compiler has to be able to compile C++ anyway. There are changes I'd like to see in Argon, but I'd prefer not to do fork and play on my sand alone. So I want to know you opinions about them and thus ask about everything.
enum _ar_timeouts
{
kArNoTimeout = 0, //!< Return immediately if a resource cannot be acquired.
kArInfiniteTimeout = 0xffffffffUL //!< Pass this value to wait forever to acquire a resource.
}; to using Time = uint32_t; //eg. easier to change when switching to uint64_t and us resolution everywhere
namespace timeout {
constexpr Time None = 0;
constexpr Time Infinite = std::numeric_limits<Time>::max();
}; or go even further about units. Even though custom literals are floats, ctors are
Ar::Mutex mutex("some mutex");
void foo() {
auto _mtx = Ar::ScopedMutexAcquisition(mutex); //C++20 would allows us to put this `if(here; ...)`
if (_mtx) {
//block of code executed when/if mutex acquired
//some code with multiple returns
//where you don't have to bother about mutex releasing before each return thanks to RAII
}
}
|
In my absence, I've had a lot of time to think about this… (I was really conflicted!) So:
There are several things going into the rationale for this.
Btw, there is an |
I was thinking about making a separate GitHub organization for Argon, so it has a home of its own away from my other repos. What do you think? |
C++ has features allowing code to be more safe and compile time checked and evaluated. IMO users should be pushed towards solutions which provide safer application. Yeah, many people don't want to use C++ (on embedded), a few I know..
I am really happy to see Rust gaining popularity! (Even though I am total noob in Rust, key concepts and features of rust really appeal me.)
Whoopsie, did not spot it. I also have another RAII helper which serves as proxy to access some mutex protected data. It is a way how to ensure, that some data are accessed with acquired mutex only.
Well, it's up to you. If you want so separate if from your account, go for it. I don't think it's necessary from outside POV. It would make sense if Argon had more developers and public interest. BTW, I use Argon RTOS in my diploma thesis 😄 |
I completely agree. I've repeatedly pushed for and tried to use C++ in industry projects, but the argument has always been that users won't accept it…
Yeah, I'm a Rust noob too, slowly learning. :) But ironically, I've recently become the maintainer of a Rust project cmsis-pack-manager since it's used by pyOCD and the original author moved on.
Nice! That looks very much like how mutexes work in Rust.
The main reason would be to increase visibility of Argon. For the time being I probably won't change anything.
Awesome!
Totally understood, same here. |
Yeah just look at what happened to livius. He completely rewrote cmsis in c++ and got mostly negative feedback. Though C is my strongest language, I despise it. |
@Loverdeg can you provide more info, links etc.? I am interested in details. |
Hi, I've tried to split todos and ideas into groups. Maybe the are in wrong one. I guess, you should be able to edit this post. Most of points come from
doc/argon_todo.txt
Ideas
Timing
Features
Refactoring
Language
Api
testing
Uncathegorized (need to move)
Issues
The text was updated successfully, but these errors were encountered: