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

WIP: zephyr: added initial support to Zephyr RTOS as host OS. #398

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

uLipe
Copy link

@uLipe uLipe commented Nov 6, 2022

By submiting this PR, you agree with the associated license (Apache 2.0 or MIT) and with our Contributor License Agreement (CLA).

Before to begin

Thank you for contributing to the Luos project!

Before to begin, please follow these steps:

  • Ensure that this PR is not a duplicate.
  • Assign @Simonbdy to this PR
  • Add the PR to the Luos contribution project

Feel free to read the Luos contribution's guidelines and the documentation page to have more insight about how to contribute to Luos.

PR Description section

Description and dependencies

This PR enables Luos to be built on top of Zephyr RTOS, as a result Luos is seen by Zephyr as an out-of-tree module, and a Zephyr application is able to include Luos and its features. It also brings zephyr specific code to the HAL and Robus/HAL sections enabling Luos on Zephyr supported boards.

Changes

Please choose the relevant options:

  • New feature (non-breaking change which adds functionality)

WARNING: Do not edit the checklist below.


Developer section

  • [Documentation] is up to date with new feature
  • [Tests] are passed OK (non regression, new features & bug fixes)
  • [Code Quality] please check if:
    • Each function has a header (description, inputs, outputs)
    • Code is commented (particularly in hard to understand areas)
    • There are no new warnings that can be corrected
    • Commits policy is respected (constitancy commits, clear commits comments)

QA section

  • [Review] tests for new features have been reviewed
  • [Changelog] is up-to-date with expected tags
    🆕 Feature: [Feature] Description...
    🆕 Added: [Feature] Description...
    🆕 Changed: [Feature] Description...
    🛠️ Fix: [Feature] Description...

@uLipe
Copy link
Author

uLipe commented Nov 6, 2022

@Simonbdy , @nicolas-rabault PTAL it is on WIP state but since this touches in some of the common folders from Luos I would like to hear your options while I finish the Zephyr specific code.

The current state of this PR it is able to build and run on qemu zephyr target, but the final PR would add some boards.

@uLipe uLipe changed the title zephyr: added initial support to Zephyr RTOS as host OS. WIP: zephyr: added initial support to Zephyr RTOS as host OS. Nov 6, 2022
@uLipe
Copy link
Author

uLipe commented Nov 6, 2022

@Simonbdy Simonbdy added the RTOS Any RTOS related development label Nov 7, 2022
@nicolas-rabault
Copy link
Member

@Simonbdy, @JeromeGalan is working on it with @uLipe , I think @JeromeGalan will be more relevant than me about it.

@Simonbdy Simonbdy removed the request for review from nicolas-rabault November 29, 2022 14:22
@Simonbdy Simonbdy assigned JeromeGalan and unassigned Salem-Tho Nov 29, 2022
@uLipe
Copy link
Author

uLipe commented Dec 6, 2022

Hi folks, it has been a while, just to update you I'm still working on this PR, probably will update things here at the end of this week.

cc: @JeromeGalan @nicolas-rabault

@nicolas-rabault
Copy link
Member

Nice!
Can't wait to see your results!

@uLipe
Copy link
Author

uLipe commented Dec 29, 2022

Added initial port of robus hal, it still needs to finish the uart part, it just to you follow-up the progress.

@uLipe
Copy link
Author

uLipe commented Dec 29, 2022

cc: @JeromeGalan . @nicolas-rabault

@uLipe uLipe force-pushed the feature/luos_zephyr branch 3 times, most recently from c760508 to 13783df Compare December 30, 2022 21:44
{
{
//Way to make Luos run in event driven mode
RobusHAL_WaitNetworkActivity();
Copy link
Member

Choose a reason for hiding this comment

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

We planned to create a macro on Luos for this!

Choose a reason for hiding this comment

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

Will work on it 👍👨‍💻

Copy link
Author

Choose a reason for hiding this comment

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

Please check also the implementation on Robus side, my initial idea was to defer a user defined callback, although a binary semaphore solves very well the issue of trigeering Luos loop upon a network activity.

Comment on lines +49 to +53
if(irq_nest)
{
irq_nest--;
if(!irq_nest)
{
Copy link
Member

Choose a reason for hiding this comment

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

Very interesting idea!

Copy link
Member

Choose a reason for hiding this comment

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

@uLipe
Copy link
Author

uLipe commented Jan 2, 2023

Added the missing timeout functions, and now tested with high baud rate > 400k

uart_fifo_fill(luos_serial, &c, 1);
LOG_DBG("Transmitting the following byte from serial 0x%x", c);
}
k_sem_give(&net_activity_sem);
Copy link
Member

Choose a reason for hiding this comment

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

If I understand it, you use it to trigger the Luos_loop task.
Here is a few thought about running Luos_loop like that.
We will need a deeper check, but I think:

  • Luos_loop don't need to do anything in case of TX.
  • Luos_loop need to run only one time per complete message (but you can't manage it at HAL level, that is why a macro is interesting here)
  • Luos_loop check time during execution to trigger auto-update messages. We have to find a way to avoid this polling strategy to be able to male it completely event driven.

@varun-softeware
Copy link

varun-softeware commented Jan 3, 2023 via email

Felipe Neves added 2 commits January 3, 2023 10:08
Signed-off-by: Felipe Neves <felipe.neves@linaro.org>
Signed-off-by: Felipe Neves <felipe.neves@linaro.org>
@uLipe
Copy link
Author

uLipe commented Jan 3, 2023

Just rebased

Copy link

@varun-softeware varun-softeware left a comment

Choose a reason for hiding this comment

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

Many improvements have been done

@uLipe
Copy link
Author

uLipe commented Mar 9, 2023

Hi Folks, sorry for the long hiatus here, I got some hard times in my work, with almost no time for my open source stuff.

Once I find a proper timeslot I will finish this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RTOS Any RTOS related development
Projects
Development

Successfully merging this pull request may close these issues.

None yet

6 participants