-
Notifications
You must be signed in to change notification settings - Fork 3k
Mbed os 5.8 simulator support #6457
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
@janjongboom It looks like this is based on 5.8. As it stands, this is fine for discussion, but it could not be merged to master until you rebase it onto master. That will avoid duplicating all of the other commits onto master. |
FYI @SenRamakri Those tools changes are already on master. As you can see in the history, I made those commits. |
@janjongboom Simple question to kick things off. Could you rebase your branch to make this commit history simpler to follow? Looks like the branch is quite a ways off from master right now. |
7e9b452
to
ed75535
Compare
@cmonr @theotherjimmy Rebased on top of master. |
@janjongboom It looks like you still have 2 "add mbed version block" commits. Could you remove them? |
@@ -115,9 +115,11 @@ class Ticker : public TimerEvent, private NonCopyable<Ticker> { | |||
void attach_us(Callback<void()> func, us_timestamp_t t) { | |||
core_util_critical_section_enter(); | |||
// lock only for the initial callback setup and this is not low power ticker | |||
#if DEVICE_SLEEP |
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.
this fix should be a separate PR ! We provide empty implementation fro sleep manager so it would end up being removed anyway (does not need to have sleep protect in the user code).
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
@@ -16,6 +16,23 @@ | |||
#ifndef MBED_H | |||
#define MBED_H | |||
|
|||
#define MBED_LIBRARY_VERSION 160 |
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.
As pointed earlier, this should not be part of this branch
@@ -0,0 +1,42 @@ | |||
#include <math.h> |
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.
Add license header in new files please
#include "objects.h" | ||
#include "emscripten.h" | ||
|
||
void analogout_init(dac_t *obj, PinName pin) { |
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.
{
new line for function body
@@ -23,7 +23,11 @@ | |||
#define WRITE_FLAG 0x2u | |||
|
|||
UDPSocket::UDPSocket() | |||
#ifdef MBED_CONF_RTOS_PRESENT |
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.
Which files in this PR are needed to be non-rtos? Why is this being added?
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.
UDPSocket and TCPSocket are currently only for RTOS because they need EventFlags. But they work fine without RTOS as long as you wrap the EventFlags things.
events/equeue/equeue.c
Outdated
// ok... so for some reason this is necessary | ||
// no idea why, maybe something with blocks not actually allocated until we yield back | ||
wait_ms(10); | ||
#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.
Hmmmm, yeah we need to look into this before this goes in.
_event_flag.set(READ_FLAG|WRITE_FLAG); | ||
#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 wonder if this would be better as a PlatformSemaphore (and PlatformEventFlags?).
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.
+1
Enable LoRaWAN in the simulator
@janjongboom Do you think this would be better served to go into a feature branch? As it stands, this PR makes a lot of small but deep changes to all aspects of Mbed OS, and would be easier to review with smaller commits. |
@cmonr, yes, but I don't have push rights to Mbed so if I move it to a feature branch I can't work on it anymore ;-) Also I have an Mbed OS 5.9 branch. But yes, would be good to discuss how we can this closer to upstream. |
@janjongboom The only people allowed push access to mbed-os are the maintainers. The way everyone else works is that we create a feature branch for them, they fork mbed-os, work on the feature branch in their fork and then when they want to drop code onto the ARMmbed version of the feature they create a PR from their fork. |
@janjongboom I've created the branch feature-simulator-target for this feature, and will be closing this PR. You can open a PR against that branch for this feature. |
@cmonr Thanks, will do. |
@janjongboom Remember, the smaller the changesets are, the quicker we can get the PRs reviewed ;) |
Description
Just opening this pull request to spark some discussion. This is adding a new simulator target to Mbed OS 5.8. It modifies a couple of files (
Ticker.h
which I think fixes a bug, andmbed_retarget.h
, which I'm not sure how to fix otherwise, and then some changes in netsocket so it does not require RTOS, which I think is a bug too). In addition you'll notice that some files are overridden in the simulator target folder. These are swapped out in the build process for the simulator, so not through Mbed CLI at this point.The reason that I want this in Mbed OS core is that it should be much easier to keep up to date. In addition I'd like to have support for this in CLI as well, and integrate this nicely in our tools. This is not something we can do in a single release, but by adding it to the core at least we know when we break something.
Opinions?
This branch is used in https://github.com/janjongboom/mbed-simulator/tree/upstream-mbed-os by the way, which updates the simulator branch to this version of Mbed OS. Work in progress of course.
Pull request type
[ ] Fix
[ ] Refactor
[X] New target
[X] Feature
[ ] Breaking change