Skip to content
This repository was archived by the owner on Apr 12, 2021. It is now read-only.

Conversation

maxekman
Copy link

Hey!

I wanted to test this repo using the cortex-m-rt crate, here is what I came up with to make the blinky example work.

If I clean up all examples and update the readme/instructions, is this something you would like to have contributed?

/Max

(BTW, I'm super new to the Rust world, this is basically the first real changes I have made after reading a lot...)

@jamesmunns
Copy link
Owner

Hey @maxekman, thanks for the contribution! I think this should be okay, the only concern that I have is that the Nordic Softdevice makes certain assumptions, like which interrupts/interrupt levels are reserved for use by the softdevice, and I am not sure if there is a way to prevent the cortex-m-rt and the nordic softdevice from interfering with eachother.

Here is what I found after a quick search: http://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.s132.sds%2Fdita%2Fsoftdevices%2Fs130%2Fprocessor_avail_interrupt_latency%2Fexception_mgmt_sd.html.

I am actually not too familiar with exactly what/how cortex-m-rt works. It would be nice to see these invariants covered either by code, or by documentation.

@maxekman
Copy link
Author

Thanks for the info, I’ll look into how the interrupts works. It may be possible to do something along these lines: https://github.com/japaric/cortex-m-rt/blob/master/examples/device.rs

Another option could be a custom device.x file: https://github.com/japaric/cortex-m-rt/blob/master/device.x

I’m also new to cortex-m-rt, but the library seems minimal enough to have as a dependency.

@maxekman
Copy link
Author

When reading more about the interrupts, it seems like only certain priorities are reserved, not the actual interrupt vectors. Does that seem correct?

Cortex-m-rt only seems to deal with the interrupt vectors not the priorities, which would put that level of protection in a HAL for the nrf52. I would guess it would affect implementing the embedded-hal timer traits for example.

@jamesmunns
Copy link
Owner

Sounds good! I agree that a comment/note in the -sys crate is good enough, and adding the checked restriction (or being careful when implementing) to the hal crate should work.

👍 from me, let me know when you are ready to merge.

@kamathba
Copy link

I'm continuing development on this here: https://github.com/kamathba/nrf52dk-sys/tree/crate-updates

Have some experience with the nordic parts and using this as an exercise to learn some embedded rust. Might try having configs for softdevice / no-softdevice, and extend the example a bit. I actually still need to test on hardware.

@maxekman
Copy link
Author

Sounds good! I’ll close this as soon you open a (WIP) PR here.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants