-
Notifications
You must be signed in to change notification settings - Fork 401
Add RTEMS support #87
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
Conversation
It looks good. Can you suggest a good guide about setting up a crosscompiler for RTMES so I could add it into the current CI? |
For building the cross-compiler there is the rtems-source-builder. It does essentially everything for you you can find the quick start tutorial here: https://docs.rtems.org/branches/master/rsb/quick-start.html# |
@@ -24,7 +24,7 @@ | |||
# define PLOG_GET_FUNC() __PRETTY_FUNCTION__ | |||
#endif | |||
|
|||
#if PLOG_CAPTURE_FILE | |||
#ifdef PLOG_CAPTURE_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.
Is there any problem with #if
instead of #ifdef
on RTEMS? I compiled fine without thease changes (rtems4.11/gcc4.9.3).
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 is probably because we compile with a quite pedantic compiler setting. I got a "-Wundef" warning during compilation. As far as I see it by default the PLOG_CAPTURE_FILE
is not defined by default, so I thought ifdef would be the better choice here.
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.
Good point, I'll add -Wundef
to the flags.
@@ -18,6 +18,8 @@ namespace plog | |||
m_stdoutHandle = GetStdHandle(stdHandle::kOutput); | |||
} | |||
} | |||
#elif __rtems__ | |||
ConsoleAppender() : m_isatty(true) {} |
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.
Why not using isatty
check?
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 if you compile rtems without the --enable-posix
option then isatty
is not available. At least I got an undefined reference. I will check when I am back in the office.
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 worked fine without --enable-posix
.
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.
@thesummer Could you check that on your setup?
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, I investigated a bit further. It appears that in the current setup we have (rtems4.10) the fileno function is not declared in stdio.h.
If I replace m_isatty(!!isatty(fileno(stdout)))
with m_isatty(!!isatty(STDOUT_FILENO))
everything works fine.
STDOUT_FILENO
is defined in unistd.h
I will have to check if we have a system with rtems4.11 running somewhere.
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 checked with another setup with rtems4.12 with the fileno
version. Everything builds fine.
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 tested on 4.11 and it worked with fileno
.
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. I removed the change here. We will phase out rtems4.10 soon hopefully and I can have the change locally for the time being.
I also replaced the #elif __rtems__
with #elif defined(__rtems__)
as I was getting more undef warnings in Linux with that.
1037a5b
to
9f23fef
Compare
We started to use plog in a project which uses multiple OSes among them RTEMS.
The port was pretty straight forward. In case you don't mind supporting RTEMS upstream this commit adds the necessary includes and defnitions for the mutex.
It also fixed a few warnings due to missing defines.