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

Make nrf52* based boards compatible with bootloader. #1681

Merged
merged 2 commits into from
Mar 25, 2020

Conversation

jmichelp
Copy link
Contributor

Pull Request Overview

This pull request makes Tock OS compatible with a bootloader on all boards that are based on nrf52 chip family.
The offset is determined by the linker. This way the board layout defines the offset.

Testing Strategy

This pull request was tested by flashing OpenSK on a nRF52840DK board using JLink, flashing it on a nRF52840 USB dongle using nordicdfu tool as well as flashing OpenSK firmware on a nRF52840-MDK USB dongle over DFU.

TODO or Help Wanted

N/A

Documentation Updated

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

Formatting

  • Ran make formatall.

jmichelp added a commit to jmichelp/OpenSK that referenced this pull request Mar 11, 2020
Now the script supports more flashing methods:
- JLink (with tockloader)
- OpenOCD (with tockloader)
- pyOCD
- Nordic DFU
- none (will produce an IntelHex file)

Also merged the contributions from:
- Yihui Xiong to support the Makerdiary USB dongle board
- Dennis Geurts to support Nordic DFU

Doc updated accordingly.

Imported 2 patches for Tock kernel:
- 06-add-set_vector_table_offset.patch (upstream tock/tock#1579)
- 07-nrf52-bootloader.patch (upstream tock/tock#1681)
jmichelp added a commit to jmichelp/OpenSK that referenced this pull request Mar 11, 2020
Now the script supports more flashing methods:
- JLink (with tockloader)
- OpenOCD (with tockloader)
- pyOCD
- Nordic DFU
- none (will produce an IntelHex file)

Also merged the contributions from:
- Yihui Xiong to support the Makerdiary USB dongle board
- Dennis Geurts to support Nordic DFU

Doc updated accordingly.

Imported 2 patches for Tock kernel:
- 06-add-set_vector_table_offset.patch (upstream tock/tock#1579)
- 07-nrf52-bootloader.patch (upstream tock/tock#1681)
@jmichelp jmichelp mentioned this pull request Mar 11, 2020
2 tasks
@bradjc
Copy link
Contributor

bradjc commented Mar 11, 2020

The bootloader doesn't do this?

jmichelp added a commit to jmichelp/OpenSK that referenced this pull request Mar 11, 2020
Now the script supports more flashing methods:
- JLink (with tockloader)
- OpenOCD (with tockloader)
- pyOCD
- Nordic DFU
- none (will produce an IntelHex file)

Also merged the contributions from:
- Yihui Xiong to support the Makerdiary USB dongle board
- Dennis Geurts to support Nordic DFU

Doc updated accordingly.

Imported 2 patches for Tock kernel:
- 06-add-set_vector_table_offset.patch (upstream tock/tock#1579)
- 07-nrf52-bootloader.patch (upstream tock/tock#1681)
@jmichelp
Copy link
Contributor Author

It can't. The bootloader comes with its own interrupt vectors and jumps to the app (in our case Tock). This way, if the app is faulty, it can stay in the bootloader and you can recover your board.

This means that Tock need to set the offset to be able to use its own interrupt vector. If there's no bootloader, this will be equivalent to a no-op as we're setting the vectors to 0x0 which is the value at reset.
It also allows theoretically to "reboot into DFU" by calling scb::set_vector_table_offset(0) and jumping back to it.

@bradjc
Copy link
Contributor

bradjc commented Mar 11, 2020

Well it can, since the Tock bootloader does, but I see your point.

chips/nrf52/src/crt1.rs Outdated Show resolved Hide resolved
Co-Authored-By: Brad Campbell <bradjc5@gmail.com>
kaczmarczyck pushed a commit to kaczmarczyck/OpenSK that referenced this pull request Mar 12, 2020
Now the script supports more flashing methods:
- JLink (with tockloader)
- OpenOCD (with tockloader)
- pyOCD
- Nordic DFU
- none (will produce an IntelHex file)

Also merged the contributions from:
- Yihui Xiong to support the Makerdiary USB dongle board
- Dennis Geurts to support Nordic DFU

Doc updated accordingly.

Imported 2 patches for Tock kernel:
- 06-add-set_vector_table_offset.patch (upstream tock/tock#1579)
- 07-nrf52-bootloader.patch (upstream tock/tock#1681)
@bradjc bradjc added release-blocker Issue or PR that must be resolved before the next release last-call Final review period for a pull request. labels Mar 13, 2020
@bradjc
Copy link
Contributor

bradjc commented Mar 25, 2020

bors r+

@bors
Copy link
Contributor

bors bot commented Mar 25, 2020

Timed out

@bradjc
Copy link
Contributor

bradjc commented Mar 25, 2020

That's cool, bors, that's cool.

@bradjc bradjc merged commit 446df4a into tock:master Mar 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
last-call Final review period for a pull request. release-blocker Issue or PR that must be resolved before the next release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants