8000 Add DateTime HIL, and implement for RPi Pico and STM32f429ZI by Remus7 · Pull Request #3559 · tock/tock · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add DateTime HIL, and implement for RPi Pico and STM32f429ZI #3559

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

Merged
merged 6 commits into from
Oct 11, 2023

Conversation

Remus7
Copy link
Contributor
@Remus7 Remus7 commented Jul 21, 2023

Pull Request Overview

This pull request adds a Date and Time HIL, driver and component. This includes low level drivers for Real Time Clock for nucleo-stm32f429zi and raspberry pi pico boards. The Real Time Clock for raspberry pi pico board was rebased for an older commit written for tock 1.0 (#2760). The code compiles with other changes made to the libtock-c project, including an example project to test Real Time Clock intended usage (tock/libtock-c#334).

Testing Strategy

This pull request was tested by running the implemented commands both in the board/main.src for the nucleo board, and also by running a program from the libtock-c userspace (setting and then printing current time each second).

TODO or Help Wanted

The Real Time Clock works for the two boards, RTC support for more boards might be added using the component, hil and capsule provided.

Documentation Updated

  • Updated the relevant files in /docs, or no updates are required.

Formatting

  • Ran make prepush.
  • Ran make format.

< 8000 svg aria-label="Loading..." style="box-sizing: content-box; color: var(--color-icon-primary);" width="32" height="32" viewBox="0 0 16 16" fill="none" role="img" data-view-component="true" class="anim-rotate">

@github-actions github-actions bot added HIL This affects a Tock HIL interface. stm32 Change pertains to the stm32 family of MCUSs component labels Jul 21, 2023
let grant_enter_res = self.apps.enter(appid, |app, _| {
app.subscribed = true;
});

Copy link
Contributor

Choose a reason for hiding this comment

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

Need to actually store the command here.

Copy link
Contributor

Choose a reason for hiding this comment

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

Wait how does this work? If an app calls get time while a different app calls set time, how does the second app actually get the time?

@Remus7
Copy link
Contributor Author
Remus7 commented Jul 31, 2023

Thank you very much for the suggestions. I updated the function names and the capsule documentation as instructed.
However, for the next week I will be unable to test the actual code, since I do not have access to any stm32f429zi boards. This is why I would rather wait before making any large changes to the code, so that I am able to test for any unforseen effects on the rest of the code

@bradjc bradjc changed the title Raspberry pi pico rtc Add DateTime HIL, and implement for RPi Pico and STM32f429ZI Aug 1, 2023
@@ -12,4 +12,3 @@ hla_vid_pid 0x0483 0x374b
set WORKAREASIZE 0x10000

source [find target/stm32f4x.cfg]

Copy link
Contributor

Choose a reason for hiding this comment

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

revert

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Revert to what? As far as I remember, I never edited this file

Copy link
Contributor

Choose a reason for hiding this comment

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

If github is showing a change, then the file changed. Looks like a line was removed.

Copy link
Contributor
@bradjc bradjc left a comment

Choose a reason for hiding this comment

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

Very close!!

8000
@@ -12,4 +12,3 @@ hla_vid_pid 0x0483 0x374b
set WORKAREASIZE 0x10000

source [find target/stm32f4x.cfg]

Copy link
Contributor

Choose a reason for hiding this comment

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

If github is showing a change, then the file changed. Looks like a line was removed.

@Remus7
Copy link
Contributor Author
Remus7 commented Sep 11, 2023

I deleted the endline in the openocd.cfg file, it seems that in my original text editor it was automatically ignored. The file should now be the same as in the main tock code.

Copy link
Contributor
@bradjc bradjc left a comment

Choose a reason for hiding this comment

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

I think this is close just need to remove extra changes and indent comments for register definitions to match.

@Remus7 Remus7 force-pushed the raspberry_pi_pico_rtc branch from 8ab28af to bd7e228 Compare September 15, 2023 16:35
@Remus7
Copy link
Contributor Author
Remus7 commented Sep 15, 2023

For some reason, after I ran make format to clear up indentation, the "Pull Request Labeler / triage" test fails with the message " YAMLException: can not read a block mapping entry; a multiline key may not be an implicit key (56:1)". Although I tried reverting the changes, the error persists. I do not have experience on this topic, would you have any suggestions as to how should I fix this issue?

@ppannuto
Copy link
Member

Error in our tooling, sorry :(

Rebase/merge once #3673 goes through and it should be fixed.

@bradjc
Copy link
Contributor
bradjc commented Sep 20, 2023

Can you run git checkout origin/master boards/nucleo_f429zi/openocd.cfg and commit the result?

@Remus7
Copy link
Contributor Author
Remus7 commented Sep 21, 2023

Done.
Another thing; the ci-build and ci-tests from last time kept telling me that the "extract()" method is not found in `OptionalCell', although it seems to be there (and it compiles locally). Moreover, the test only complains about the method in the raspberry pi rtc, even though I use the exact same method in the nucleo board rtc. Should I delete it?

@bradjc
Copy link
Contributor
bradjc commented Sep 21, 2023

The best thing to do would be to squash commits and then rebase on the latest master.

@Remus7 Remus7 force-pushed the raspberry_pi_pico_rtc branch 3 times, most recently from 92e11cd to d56a939 Compare September 24, 2023 19:06
@Remus7
Copy link
Contributor Author
Remus7 commented Sep 24, 2023

I squashed all the commits, now waiting for the checks to finish.

let grant_enter_res = self.apps.enter(appid, |app, _| {
app.subscribed = true;
});

Copy link
Contributor

Choose a reason for hiding this comment

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

Wait how does this work? If an app calls get time while a different app calls set time, how does the second app actually get the time?

@Remus7
Copy link
Contributor Author
Remus7 commented Sep 27, 2023

The way it is meant to work, anytime an app calls to the capsule, its command is registered as subscribed. When the capsule ends the current task, it checks for any apps that have subscribed for a get or set operation. When a get operation is finished, the same result is passed to all apps that have subscribed for a get set (as they are the same values). Afterwards one of the queued set operations will be started. And then another get operation would queue if that is the case.

parent 9264cbe
author irina-b-dev <irina.bradu@stud.fils.upb.ro> 1626776251 +0300
committer Remus7 <remus.rughinis.007@gmail.com> 1695578584 +0300

parent 9264cbe
author irina-b-dev <irina.bradu@stud.fils.upb.ro> 1626776251 +0300
committer Remus7 <remus.rughinis.007@gmail.com> 1695578576 +0300

parent 9264cbe
author irina-b-dev <irina.bradu@stud.fils.upb.ro> 1626776251 +0300
committer Remus7 <remus.rughinis.007@gmail.com> 1695578566 +0300

added rtc ll driver and modified main for rp pico

modified date_time capsule

updated date_time capsules and pico main

update for date_time capsule

cleaned up warnings date_time capsule and rtc driver

fixed bitshifting

changed enter in grant from date time capsule

tried async for rtc

added setup for rtc

modified rtc setup in main for pi pico

updated date time capsule

deleted unnecessary functions from rtc hil

fixed rtc frequency and added   date time settup handler

added date time component and cleaned up code

format

rtc asynchronous interface

removed rtc from time hil added date date_time hil

fixed in_progressed flag setting, added comment for date_as_tuple function

Update kernel/src/lib.rs

Co-authored-by: Alexandru Radovici <msg4alex@gmail.com>

deleted commented code

rebase

added rtc ll driver and modified main for rp pico

updated date_time capsules and pico main

update for date_time capsule

changed enter in grant from date time capsule

tried async for rtc

updated date time capsule

deleted unnecessary functions from rtc hil

fixed rtc frequency and added   date time settup handler

added date time component and cleaned up code

format

rtc asynchronous interface

removed rtc from time hil added date date_time hil

fixed in_progressed flag setting, added comment for date_as_tuple function

Update kernel/src/lib.rs

Co-authored-by: Alexandru Radovici <msg4alex@gmail.com>

deleted commented code

rebase

Rebased code to main and solved compilation errors

Added RTC suppport on nucleo-stm32f429 board

Changed date_time Capsule and date_time component

Added documentation and support for rtc example

Update boards/components/src/date_time.rs

Co-authored-by: Alexandru Radovici <msg4alex@gmail.com>

Update boards/components/src/date_time.rs

Co-authored-by: Alexandru Radovici <msg4alex@gmail.com>

Update boards/nucleo_f429zi/src/main.rs

Co-authored-by: Alexandru Radovici <msg4alex@gmail.com>

Added licence, minor change to date_time component

Update boards/raspberry_pi_pico/src/main.rs

Co-authored-by: Alexandru Radovici <msg4alex@gmail.com>

Update boards/raspberry_pi_pico/src/main.rs

Co-authored-by: Alexandru Radovici <msg4alex@gmail.com>

Added license headers

Updated nucleo board Cargo.toml

Format

License headers

HIL Licence Header

Update capsules/extra/src/date_time.rs

Co-authored-by: Brad Campbell <bradjc5@gmail.com>

Update kernel/src/hil/date_time.rs

Change callback_set_date name to set_date_time_done

Co-authored-by: Brad Campbell <bradjc5@gmail.com>

Update kernel/src/hil/date_time.rs

Updated comments

Co-authored-by: Brad Campbell <bradjc5@gmail.com>

Renamed funcitons

Renamed date_time HIL functions and changed stm32f4xx PWR registers

Changed capsule documentation

Renamed struct Date to DateTimeValues

Update chips/stm32f429zi/src/rtc.rs

Co-authored-by: Brad Campbell <bradjc5@gmail.com>

Added some comments in rtc code

Update chips/stm32f429zi/src/lib.rs

Co-authored-by: Brad Campbell <bradjc5@gmail.com>

Update boards/raspberry_pi_pico/src/main.rs

Co-authored-by: Brad Campbell <bradjc5@gmail.com>

Update boards/raspberry_pi_pico/src/main.rs

Co-authored-by: Brad Campbell <bradjc5@gmail.com>

Update boards/raspberry_pi_pico/src/main.rs

Co-authored-by: Brad Campbell <bradjc5@gmail.com>

Update boards/raspberry_pi_pico/src/main.rs

Co-authored-by: Brad Campbell <bradjc5@gmail.com>

Update boards/raspberry_pi_pico/src/main.rs

Co-authored-by: Brad Campbell <bradjc5@gmail.com>

Update boards/raspberry_pi_pico/src/main.rs

Co-authored-by: Brad Campbell <bradjc5@gmail.com>

Update boards/nucleo_f429zi/src/main.rs

Co-authored-by: Brad Campbell <bradjc5@gmail.com>

Update boards/nucleo_f429zi/src/main.rs

Co-authored-by: Brad Campbell <bradjc5@gmail.com>

Moved pwr script from stm32f4xx to stm32f429zi

Update chips/stm32f429zi/src/pwr.rs

Co-authored-by: Brad Campbell <bradjc5@gmail.com>

Update chips/stm32f429zi/src/pwr.rs

Co-authored-by: Brad Campbell <bradjc5@gmail.com>

Update chips/stm32f429zi/src/pwr.rs

Co-authored-by: Brad Campbell <bradjc5@gmail.com>

Update chips/stm32f429zi/src/pwr.rs

Co-authored-by: Brad Campbell <bradjc5@gmail.com>

Deleted endline

Ran make format

Minor changes

Commend indents

Ran git checkout origin/master boards/nucleo_f429zi/openocd.cfg

Deleted unnecessary type casts

Minor changes

Repaired problems with rebase

Deleted extra endlines
@Remus7 Remus7 force-pushed the raspberry_pi_pico_rtc branch from 1269893 to 17098c3 Compare September 27, 2023 12:49
@bradjc
Copy link
Contributor
bradjc commented Sep 27, 2023

What happens in the case that:

  1. App1 calls get()
  2. While the get is being gotten, App2 calls set()

Won't App2 be issued a callback once the get finishes? Then App2 will continue execution as though the time was set, even though the set hasn't completed? Worse, the set will never actually happen, right?

@Remus7
Copy link
Contributor Author
Remus7 commented Sep 28, 2023

I seem to have uploaded an older, unfinished version of the capsule when I solved the rebase. Changing it now.
I'll try to finish it today or tomorrow.

bradjc
bradjc previously approved these changes Sep 28, 2023
@bradjc bradjc added the last-call Final review period for a pull request. label Sep 28, 2023
@Remus7
Copy link
Contributor Author
Remus7 commented Oct 2, 2023

Would you happen to know why 5 of the tests take still haven't reported any status?

@bradjc bradjc enabled auto-merge October 4, 2023 18:05
auto-merge was automatically disabled October 5, 2023 09:32

Head branch was pushed to by a user without write access

bradjc
bradjc previously approved these changes Oct 9, 2023
@bradjc
Copy link
Contributor
bradjc commented Oct 9, 2023

Need to fix CI errors.

@bradjc bradjc removed the last-call Final review period for a pull request. label Oct 10, 2023
auto-merge was automatically disabled October 11, 2023 07:53

Head branch was pushed to by a user without write access

@bradjc bradjc enabled auto-merge October 11, 2023 14:40
@bradjc bradjc added this pull request to the merge queue Oct 11, 2023
Merged via the queue into tock:master with commit 73ba59c Oct 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component HIL This affects a Tock HIL interface. stm32 Change pertains to the stm32 family of MCUSs waiting-on-author
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0