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
Update nordic board documentation [was: Rename nrf52dk_base to nrf52_base] #1784
Conversation
82549fc
to
b1400b8
Compare
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 generally like the idea. Also appreciate the source branch name. :)
However when we're deciding to makes this a common base for all things nRF52
we could run into problems in the long run. For instance, the nRF52840DK
already contains a few things that the others don't have, like the SPI flash.
tock/boards/nordic/nrf52_base/src/lib.rs
Lines 323 to 329 in b1400b8
let nonvolatile_storage: Option< | |
&'static capsules::nonvolatile_storage_driver::NonvolatileStorage<'static>, | |
> = if let Some(driver) = mx25r6435f { | |
// Create a SPI device for the mx25r6435f flash chip. | |
let mx25r6435f_spi = static_init!( | |
capsules::virtual_spi::VirtualSpiMasterDevice<'static, nrf52::spi::SPIM>, | |
capsules::virtual_spi::VirtualSpiMasterDevice::new( |
Adding more boards could make this additional complexity an issue. The setup_board()
argument list and function is already really long. I'd appreciate if we found a way to call back into the board specific crate for further HW initialization (for instance bus peripherals). Think an array of components, getting passed all of the base peripherals. I'm not sure whether that's possible currently.
That's a good point but I don't think it is possible current because the |
I think the right way of solving this would be to refactor the relevant code into components, so that the I'm also curious why the Nordic boards are the only ones to share such a base module. Aren't there other Tock boards that share a chip (or have a similar chip)? |
I think the answer is that the nordic family happened to be the first with a lot of overlap, and so it was the first way we experimented with some way of sharing code. I don't think we were ever totally satisfied with the ergonomics, so it didn't propagate to other boards. I agree we should consider other approaches moving forward, but I would also like to pull this in (post-1.5) still, as I think it clarifies the current state of things. A more substantial refactor of sharing board code should likely begin with an RFC. |
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 looks good to me, the current naming is confusing. I think its funny this saves 12 bytes of flash on the nrf52dk (presumably because paths are stored in the binary and are now slightly shorter).
Yes, see #1668. The paths are stored for panic messages. Incidentally, the |
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 don't think we should rename the crate (but the readme is a nice addition). The crate is a nrf52_dk base platform, and will not reasonably support all nrf52 boards. Naming it nrf52_base suggests that it is a base for any nrf52 board, and that is not something we can realistically support.
But then you keep the confusion that one of the 3 boards that currently uses the base is not a development kit (the nrf52840 dongle) 😕 |
Yeah, naming it |
It's a development board sold by Nordic. Doesn't seem that odd that it would use a dk base crate. I think the name reflecting its purpose is more useful than one reflecting how it is being used. It does seem like components would be a better option than _base, but we didn't have them when i created _base. |
I think a name reflecting what it is is more useful than either its purpose or use. |
I say we follow:
And then if there is anything left over it would be nrf52_components. |
The crate is also a base for It's like the |
It is not a base for acd52832, the ACD just uses the components from the crate. |
But, if someone added support for nRF53 to the nrf5x that would be perfectly acceptable. However, if someone added support for the ardiuno nano ble sense (for example) to nrf52dk_base, I think that would be very difficult to maintain. But if it is called nrf52_base, I don't know why we would say no and not merge it. |
I definitely agree on this one. I've seen the same reasoning of "what it is" vs. "what it's used for" in other pull requests, and I think the former is more meaningful. The use cases of something (speaking of a module, a type, or a function) can and do definitely change over time. And when you're at a call site, you know the purpose (the call site is the purpose/use case), so IMO the goal of the module/type/function's name is to be easy for the reader to understand what the thing is/does, without having to look for implementation details of the thing in the source code. It's a bit like naming a "Vec" a "Stack" because it's used once as a stack ( |
I'm not familiar with the specifics of the ardiuno nano ble sense, but if it can use the And ultimately, components are probably the right level of code factoring, neither too coarse nor too fine-grained. |
At the risk of not progressing this PR at all: I would think that someone looking to develop tock and who sees an nRF52_base crate can reasonably expect that that crate is the base for any nrf52-based board. Then if the Arduino Nano BLE, which uses an nrf52840, can't use
Perhaps this rename is actually appropriate (which I am not sure about), but I don't think it is the fix that we want. |
Now that I want to plumb the CryptoCell-310 into the relevant boards, I'm actually facing the limits of this How about the following:
This would allow us to have the USB and the CryptoCell (and potentially the NFC too if we end up using it in OpenSK) in the nrf52840* boards without making |
Let's just delete nrf52dk_base and use components instead. I will try to help. |
b1400b8
to
01db3c7
Compare
I've updated this to be just the README changes. |
9f75416
to
51fec3f
Compare
cd9ed30
to
b6b6576
Compare
1892: Remove nrf52dk_base, initialize nordic boards independently. r=bradjc a=hudson-ayers ### Pull Request Overview This pull request removes `nrf52dk_base`, such that nrf52dk, nrf52840dk, and nrf52840_dongle now have independent initialization. The motivation for this change is discussed in detail in #1784. Components have substantially cut down on repeated code anyway, and this change makes it much easier to add a capsule to just one of these boards. It also adds a component for UartChannel initialization on nrf52 boards. Closes #1839. ### Testing Strategy This pull request was tested by `make ci`, and by flashing the 15.4 example apps on a pair of nrf52840dk's. Testing on the nrf52840_dongle and nrf52dk would be appreciated, but is hopefully not necessary. ### TODO or Help Wanted Based on Brad's arguments, I went ahead and left these in the nordic folder. But I do have another branch where these reside in the top level of the boards directory instead. ### Documentation Updated - [x] No updates required, beyond the README updates I made. ### Formatting - [x] Ran `make format`. - [x] Fixed errors surfaced by `make clippy`. Co-authored-by: Hudson Ayers <hayers@stanford.edu>
Pull Request Overview
The base isn't just for things that are DK-like, it's really for anything in the nrf52 family.
This also adds a README to the nordic directory in the boards file, because I mix these names up all the time.
Testing Strategy
Compiling.
TODO or Help Wanted
Re-read the names to make sure I wrote all of this correctly.
Documentation Updated
/docs
, or no updates are required.Formatting
make formatall
.