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

add new board - nRF52840 MDK USB Dongle #6

Closed
wants to merge 4 commits into from

Conversation

xiongyihui
Copy link

support a new nRF52840 board - nRF52840 MDK USB Dongle #3

The board has a builtin bootloader, so the start address of Tock OS is changed to 0x1000

It's a good idea to open an issue first for discussion.

  • Tests pass
  • Appropriate changes to README are included in PR

@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@xiongyihui
Copy link
Author

@googlebot I signed it!

@googlebot
Copy link

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

Copy link
Collaborator

@gendx gendx left a comment

Choose a reason for hiding this comment

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

Thanks @xiongyihui for this pull-request, and glad to hear that you're porting OpenSK to another board :) I left a few technical comments on the code.

However, our goal is to upstream as much as possible of the patches/ directory to Tock itself (we already have pull-requests in review - tock/tock#1556 & tock/tock#1467), so the best to move forward would be for you to send a pull-request to add support for the nRF52840 MDK directly in https://github.com/tock/tock. That way we can make sure that this board is properly supported by Tock.

Once that is merged on upstream Tock, we can update the git submodule in third_party/tock to get support for it.

In the meantime, let's keep this pull-request open so that people can experiment with OpenSK on the nRF52840 MDK.

Comment on lines 10 to 13
+/// Software reset using the ARM System Control Block
+pub unsafe fn set_vector_table_offset(offset: u32) {
+ SCB.vtor.set(offset);
+}
Copy link
Collaborator

Choose a reason for hiding this comment

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

This will definitely need to be discussed upstream.

patches/tock/05-nrf52840-mdk-usb-dongle.patch Outdated Show resolved Hide resolved
patches/tock/05-nrf52840-mdk-usb-dongle.patch Outdated Show resolved Hide resolved
patches/tock/05-nrf52840-mdk-usb-dongle.patch Outdated Show resolved Hide resolved
@xiongyihui
Copy link
Author

@gendx Thanks for the comments. I also think adding the board to tock is better, will try that.

@xiongyihui
Copy link
Author

To experiment with OpenSK on the nRF52840 MDK USB Dongle with a builtin bootloader , some changes are required:

  • change the start address of tock os to 0x1000 at OpenSK/third_party/tock/boards/nordic/nrf52840_dongle/layout.ld
  • relocate interrupt vector table (SCB->VTOR = 0x1000)
  • change the pins of LEDs and buttons

@markushx
Copy link

markushx commented Feb 8, 2020

I have applied the SCB.vtor as well as the linker script change for the original nordic nrf52840-dongle, because i wanted to install without Segger JLink, but with nRF Connect programmer.

Thus I created a hex file, out of the elf file:
arm-none-eabi-objcopy -O ihex ./third_party/tock/boards/nordic/nrf52840_dongle/target/thumbv7em-none-eabi/release/nrf52840_dongle.elf ./third_party/tock/boards/nordic/nrf52840_dongle/target/thumbv7em-none-eabi/release/nrf52840_dongle.hex.

Unfortunately it seems the device does not boot-up.

What is the expected behaviour after boot-up? Should the device show up as a ttyUSB?

@dennisg dennisg mentioned this pull request Feb 14, 2020
@gendx
Copy link
Collaborator

gendx commented Feb 14, 2020

I have applied the SCB.vtor as well as the linker script change for the original nordic nrf52840-dongle, because i wanted to install without Segger JLink, but with nRF Connect programmer.

Thus I created a hex file, out of the elf file:
arm-none-eabi-objcopy -O ihex ./third_party/tock/boards/nordic/nrf52840_dongle/target/thumbv7em-none-eabi/release/nrf52840_dongle.elf ./third_party/tock/boards/nordic/nrf52840_dongle/target/thumbv7em-none-eabi/release/nrf52840_dongle.hex.

Unfortunately it seems the device does not boot-up.

I'd recommend discussing kernel support for more boards directly on Tock's repository (https://github.com/tock/tock) for greater visibility.

That said, another way to check whether your flashing method works would be to:

  1. Flash the kernel.
  2. Compile the blink example from libtock-rs (https://github.com/tock/libtock-rs/blob/master/examples/blink.rs). With this blink app flashed, you should see LEDs blinking as soon as your board boots.

Can you confirm that this works? That'd be helpful to know whether your issue is due to your flashing method (or your board), or specific to OpenSK.

What is the expected behaviour after boot-up? Should the device show up as a ttyUSB?

When plugged on a Linux machine, the OpenSK key should show up in lsusb and you should also see entries in dmesg (example: #3 (comment)). There should also be a /dev/hidrawN device file created for OpenSK.

@jmichelp
Copy link
Collaborator

jmichelp commented Mar 11, 2020

Closing this pull-request as I integrated all your changes as part of a bigger effort to support nordicdfu, locally defined boards, etc. in #78

Thanks a lot @xiongyihui for having done the work of upstreaming the required change and thanks Denis for your work on prototyping flashing over DFU. This made #78 possible and clearly helped improving OpenSK!

@jmichelp jmichelp closed this Mar 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants