Skip to content

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

Closed
wants to merge 24 commits into from

Conversation

janjongboom
Copy link
Contributor

@janjongboom janjongboom commented Mar 26, 2018

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, and mbed_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

@theotherjimmy
Copy link
Contributor

@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.

@theotherjimmy
Copy link
Contributor

FYI @SenRamakri Those tools changes are already on master. As you can see in the history, I made those commits.

@cmonr
Copy link
Contributor

cmonr commented Mar 27, 2018

@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.

@janjongboom janjongboom force-pushed the mbed-os-5.8-simulator branch from 7e9b452 to ed75535 Compare March 28, 2018 11:55
@janjongboom
Copy link
Contributor Author

@cmonr @theotherjimmy Rebased on top of master.

@theotherjimmy
Copy link
Contributor

@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
Copy link
Contributor

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).

Copy link
Contributor Author

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
Copy link
Contributor

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>
Copy link
Contributor

@0xc0170 0xc0170 Apr 4, 2018

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) {
Copy link
Contributor

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
Copy link
Contributor

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?

Copy link
Contributor Author

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.

// 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
Copy link
Contributor

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
Copy link
Contributor

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?).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@cmonr
Copy link
Contributor

cmonr commented Jun 7, 2018

@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.

@janjongboom
Copy link
Contributor Author

@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.

@adbridge
Copy link
Contributor

@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.

@cmonr
Copy link
Contributor

cmonr commented Jun 26, 2018

@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 cmonr closed this Jun 26, 2018
@janjongboom
Copy link
Contributor Author

@cmonr Thanks, will do.

@cmonr
Copy link
Contributor

cmonr commented Jul 9, 2018

@janjongboom Remember, the smaller the changesets are, the quicker we can get the PRs reviewed ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants