Skip to content

Reorganize kernel/ Crate#2659

Merged
bors[bot] merged 44 commits into
masterfrom
kernel-reorg
Jul 27, 2021
Merged

Reorganize kernel/ Crate#2659
bors[bot] merged 44 commits into
masterfrom
kernel-reorg

Conversation

@bradjc

@bradjc bradjc commented Jul 9, 2021

Copy link
Copy Markdown
Contributor

Pull Request Overview

This PR is the updated version of #2545 and #2551.

It does a holistic reorganization of the entire kernel crate.

Highlights:

  • Almost everything is now exported as kernel::module::Type rather than kernel::Type.
  • /common is split up into /utilities and /collections
  • trait Chip has been updated to only include operations that a hardware microcontroller chip crate should provide.
  • Things that were in trait Chip or passed ad-hoc are now part of trait KernelResources. This new trait is now the de-facto way that a board configures the kernel.
  • Driver is now SyscallDriver.

Testing Strategy

todo

TODO or Help Wanted

  • A whole lot of other code has to change (in largely mechanical ways) to work with these changes. But it would be easier to make sure this looks good to everyone first.

  • Decide on a filename for mem.rs. It was going to be appslice.rs, but now it would ostensibly be process_buffer.rs. However, that somewhat collides with the process_*.rs family of files, which are all about processes themselves.

  • Rebase after Support aliasing of process-allowed memory #2632 is merged.

Documentation Updated

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

Formatting

  • Ran make prepush.

@github-actions github-actions Bot added HIL This affects a Tock HIL interface. kernel labels Jul 9, 2021
@bradjc bradjc added the tock-2.0 Issues and PRs related to Tock version 2.0. label Jul 9, 2021
Comment thread kernel/src/syscall_driver.rs
Comment thread kernel/src/platform/platform.rs
Comment thread kernel/src/platform/platform.rs Outdated
@bradjc

bradjc commented Jul 13, 2021

Copy link
Copy Markdown
Contributor Author
* Decide on a filename for `mem.rs`. It was going to be `appslice.rs`, but now it would ostensibly be `process_buffer.rs`. However, that somewhat collides with the `process_*.rs` family of files, which are all about processes themselves.

We were going to have "appslice.rs", and we have "errorcode.rs", so I propose we use "processbuffer.rs" instead of "mem.rs".

@lschuermann

Copy link
Copy Markdown
Member

I propose we use "processbuffer.rs" instead of "mem.rs".

I'm in favor. mem is really vague when talking about a kernel.

@bradjc bradjc changed the base branch from pr/2632 to master July 14, 2021 13:49
@bradjc

bradjc commented Jul 14, 2021

Copy link
Copy Markdown
Contributor Author

Updates:

  1. mem.rs is now processbuffer.rs
  2. SyscallDriver and CommandReturn are now exported through kernel::syscall::. This mirrors how process_X.rs works.
  3. Capsules have been largely updated.

@hudson-ayers

Copy link
Copy Markdown
Contributor

Chiming in to say all the changes so far look good to me.

Looks like the remaining work is mostly porting stuff in chips/ and arch/ to use the new organization / names?

@github-actions github-actions Bot added chips/nrf Change pertains to the nRF5x family of MCUs. arch/risc-v RISC-V architecture chips/sam4l Change pertains to the SAM4L MCU. chips/stm32 Change pertains to the stm32 family of MCUSs WG-OpenTitan In the purview of the OpenTitan working group. labels Jul 15, 2021
@bradjc

bradjc commented Jul 15, 2021

Copy link
Copy Markdown
Contributor Author

Hail, nano33ble, and artye21 now compile.

This is going to take a while to do all of the boards. If you want to help, please add commits to this PR and I will rebase them. See 47eca24, 7ef79ea, or f982756 as a template for what needs to change for boards, and c5737e3, c4f5dc1, and 81098da for chips.

@alexandruradovici

Copy link
Copy Markdown
Contributor

I will update raspberry, stms and microbit today.

@alexandruradovici

alexandruradovici commented Jul 16, 2021

Copy link
Copy Markdown
Contributor

As I don't think I can push to this branch, I opened PRs for:

@hudson-ayers hudson-ayers linked an issue Jul 26, 2021 that may be closed by this pull request
@bradjc

bradjc commented Jul 26, 2021

Copy link
Copy Markdown
Contributor Author

Ok all boards compile and I changed SyscallDispatch to SyscallDriverLookup.

hudson-ayers
hudson-ayers previously approved these changes Jul 26, 2021

@hudson-ayers hudson-ayers left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I reviewed all the changes to the kernel crate and am happy with them. I then reviewed changes to a few random capsules, chip, and arch files and they were all straightforward changes where the compiler would catch any breakages. So I am pretty happy with this as-is!

Thanks for taking this on, it was clearly a huge undertaking but I think it makes Tock a lot more approachable.

@phil-levis

Copy link
Copy Markdown
Contributor

bors r+

@hudson-ayers

Copy link
Copy Markdown
Contributor

I rebased this on master to minimize the diff in #2696 , but now #2696 needs to be rebased as well and I cannot push to it.

Changes will need to be made to the esp-32 chip and board now as well, since that was also merged.

@alexandruradovici

alexandruradovici commented Jul 27, 2021

Copy link
Copy Markdown
Contributor

I rebased this on master to minimize the diff in #2696 , but now #2696 needs to be rebased as well and I cannot push to it.

I rebased it.

Changes will need to be made to the esp-32 chip and board now as well, since that was also merged.

Update in #2700

@bradjc

bradjc commented Jul 27, 2021

Copy link
Copy Markdown
Contributor Author

I forgot to change the function name in KernelResources so I did that as well.

@hudson-ayers

Copy link
Copy Markdown
Contributor

lets try this again:

bors r+

@bors

bors Bot commented Jul 27, 2021

Copy link
Copy Markdown
Contributor

@bors bors Bot merged commit 823d235 into master Jul 27, 2021
@bors bors Bot deleted the kernel-reorg branch July 27, 2021 15:11
jrvanwhy pushed a commit to jrvanwhy/libtock-rs that referenced this pull request Dec 23, 2021
tock/tock#2659 renamed the Tock kernel's `Driver` trait to `SyscallDriver`, because the term "driver" has too many different meanings in Tock. This change does the same, but `libtock_unittest`'s fake version of the trait.
bors Bot added a commit to tock/libtock-rs that referenced this pull request Dec 28, 2021
352: Rename `fake::driver` to `fake::SyscallDriver`. r=jrvanwhy a=jrvanwhy

tock/tock#2659 renamed the Tock kernel's `Driver` trait to `SyscallDriver`, because the term "driver" has too many different meanings in Tock. This change does the same, but `libtock_unittest`'s fake version of the trait.

Co-authored-by: Johnathan Van Why <jrvanwhy@google.com>
sirchnik pushed a commit to sirchnik/tock that referenced this pull request May 12, 2026
2659: Reorganize kernel/ Crate r=hudson-ayers a=bradjc

### Pull Request Overview

This PR is the updated version of tock#2545 and tock#2551.

It does a holistic reorganization of the entire kernel crate.

Highlights:

- Almost everything is now exported as `kernel::module::Type` rather than `kernel::Type`.
- /common is split up into /utilities and /collections
- `trait Chip` has been updated to only include operations that a hardware microcontroller chip crate should provide.
- Things that were in `trait Chip` or passed ad-hoc are now part of `trait KernelResources`. This new trait is now the de-facto way that a board configures the kernel.
- `Driver` is now `SyscallDriver`.

### Testing Strategy

todo


### TODO or Help Wanted

- A whole lot of other code has to change (in largely mechanical ways) to work with these changes. But it would be easier to make sure this looks good to everyone first.

- [x] Decide on a filename for `mem.rs`. It was going to be `appslice.rs`, but now it would ostensibly be `process_buffer.rs`. However, that somewhat collides with the `process_*.rs` family of files, which are all about processes themselves.
- [x] Rebase after tock#2632 is merged.

### Documentation Updated

- [x] Updated the relevant files in `/docs`, or no updates are required.

### Formatting

- [x] Ran `make prepush`.


Co-authored-by: Brad Campbell <bradjc5@gmail.com>
Co-authored-by: Alexandru Radovici <alexandru.radovici@wyliodrin.com>
Co-authored-by: Alexandru Radovici <msg4alex@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arch/risc-v RISC-V architecture chips/nrf Change pertains to the nRF5x family of MCUs. chips/sam4l Change pertains to the SAM4L MCU. chips/stm32 Change pertains to the stm32 family of MCUSs HIL This affects a Tock HIL interface. kernel tock-2.0 Issues and PRs related to Tock version 2.0. WG-OpenTitan In the purview of the OpenTitan working group.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow SysTick trait to be configured from boards crate

5 participants