Skip to content

[WIP] nrf: Change Xenon board to use built-in bootloader. #5158

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

Closed

Conversation

dpgeorge
Copy link
Member

This PR is a WIP to support the built-in bootloader on the nrf Xenon board (currently the entire flash is overwritten with MicroPython firmware using an external programmer; using this PR allows to use the built-in USB DFU to download firmware).

@glennrub
Copy link
Contributor

@dpgeorge , we used to have something similar for Feather52, but removed it before we merged with mainline (Link) as i wanted all targets to be aligned with S132v6 and it was a bit hard to get in a new SoftDevice with larger size using the onboard bootloader and available tools at that time.

Do you know the location of the bootloader? Is this the reason why _app_start is a bit unfamiliar? or would it be at the end of flash?

@dpgeorge
Copy link
Member Author

@glennrub from my (limited) understanding the SoftDevice from Nordic actually includes a small bootloader in the first 4k (8k?). And it looks like Particle just replaces this with their own USB-DFU-based bootloader. So the flash memory footprint is the same using their bootloader with SD, or just using the standard SD.

Do you know the location of the bootloader?

It's at 0x00000000.

Is this the reason why _app_start is a bit unfamiliar?

The start of the app is at 192k = 0x30000.

@mzdaniel
Copy link
Contributor

Thank you glennrub and dpgeorge for working on this.

As #5041 was merged and Micropython can be compiled, flashed (in my case with Particle's debugger and OpenOCD) and run in a pca10059, I assumed the xenon board would work. It is not clear what else is missing...

I tried compiling with "make BOARD=particle_xenon" (generating a firmware.hex of 467176 bytes) and "make BOARD=particle_xenon SD=s140" (generating a firmware.hex of 499917) and after flashing none of these firmwares made the xenon show as /dev/ttyACMx (no even messages on dmesg)

Will be great to run micropython in Xenons even with no bluetooth, SD or Particle's built-in bootloader, at least to start experimenting with them. I can help with testing.

@mzdaniel
Copy link
Contributor

Made an interesting and validating discovery. After successfully flashing a pca10059 with pyocd, I tried to flash the xenon with "pyocd flash -e chip -t nrf52840 pca10059.hex". For the first time, I am able to run micropython on the Xenon, which makes sense as both boards are based on underlying nrf52840

@dpgeorge
Copy link
Member Author

dpgeorge commented Dec 6, 2019

I assumed the xenon board would work. It is not clear what else is missing...

@mzdaniel the Xenon board does currently work. The point is that the MicroPython firmware will overwrite everything on the Xenon, starting at offset 0x00000000. This means you must use an external debugging device to load the firmware. Also the REPL is available only on a UART, not on the native USB of the Xenon.

This PR here aims to get the Xenon board working using its own bootloader, the one it ships with from Particle, so that it doesn't need an external debugging device.

@mzdaniel
Copy link
Contributor

mzdaniel commented Dec 6, 2019

Ah, it completely escaped me to test if UART was live on the boards.

And thank you again for the outstanding Micropython.

@dpgeorge
Copy link
Member Author

Closing. The Xenon board is deprecated https://blog.particle.io/mesh-deprecation/. Particle recommend using CircuitPython's bootloader https://docs.particle.io/tutorials/learn-more/xenon-circuit-python/. In the future we can support that bootloader instead (but the Xenon does still work with MicroPython, you just need to use an external debugger to flash it).

@dpgeorge dpgeorge closed this Aug 12, 2021
@dpgeorge dpgeorge deleted the nrf-xenon-with-bootloader branch August 12, 2021 01:49
@mzdaniel
Copy link
Contributor

That's a great idea to support CircuitPython bootloader and as a big plus run micropython in their boards! I attempted it before with mixed results, being able to boot micropython, but crashing the second I attempted to use the filesystem. That was before the merging of #7619 so things might be already better

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants