Skip to content

samd/ports/SAMD21_XPLAINED_PRO: Update the deploy instructions and use the external flash for the file system. #15942

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

Merged
merged 4 commits into from
Nov 18, 2024

Conversation

robert-hh
Copy link
Contributor

Summary

The SAMD21 Xplained Pro board is delivered without a bootloader, making it impossible to run MicroPython. This PR tells, how to install a .uf2 bootloader and provides samples of bootloaders, which can be used for the board. In addition it
adapts and fixes MicroPython to use the on-board 1MByte flash for the file system. Commits in this PR:

  • Update the deploy instructions
  • Proved two bootloaders as Intel Hex files. One of the is a generic SAMD21 bootloader, that should work on any SAMD21 board. The other has the Volume labels and USB identifiers changed to reflect the Xplained Pro board, but is besides that identical to the generic bootloader.
  • Use the 1 MByte flash for the file system.

Testing

  • Building the firmware.
  • Updating the bootloader following the steps of the instructions.
  • Updating the Firmware using all methods to activate the bootloader.
  • Creating the file system at the 1MB flash (done automatically at the first boot)
  • Creating files , storing data and deleting files with a stress test.

Copy link

github-actions bot commented Oct 1, 2024

Code size report:

   bare-arm:    +0 +0.000% 
minimal x86:    +0 +0.000% 
   unix x64:    +0 +0.000% standard
      stm32:    +0 +0.000% PYBV10
     mimxrt:    +0 +0.000% TEENSY40
        rp2:    +0 +0.000% RPI_PICO_W
       samd:    +0 +0.000% ADAFRUIT_ITSYBITSY_M4_EXPRESS
  qemu rv32:    +0 +0.000% VIRT_RV32

@dpgeorge
Copy link
Member

Would it be better to instead change the linker script for this board so that the firmware is placed at the beginning of flash, so that a bootloader is not needed at all?

For a dev board like this one, I would assume that someone using it would perhaps want to use MicroPython on it as-is, without a bootloader. After all, you need to use the debug port to program the bootloader initially. So why not just program MicroPython using the debug port?

@robert-hh
Copy link
Contributor Author

so that the firmware is placed at the beginning of flash, so that a bootloader is not needed at all

That's possible, but then this board would behave different than all other SAMD ports, and it would need the .hex version of the firmware. At the moment there are only .uf2 versions available for the SAMD port. So either the build process has to be changed and .hex version must be provided at the download site, or users have to convert .uf2 to .hex. uf2conv.py allows to convert .uf2 to .bin, and then objcopy can be used for .bin to .hex. So it's not just changing the loader script.
If in turn the bootloader is installed, updating the firmware needs no other steps, and the build process does not have to be changed.

@dpgeorge
Copy link
Member

That's possible, but then this board would behave different than all other SAMD ports, and it would need the .hex version of the firmware. At the moment there are only .uf2 versions available for the SAMD port.

OK, that's a good point. So it would be easier to make this board behave like all other samd boards.

In that case it would be good to provide a bootloader. But, I don't think it's appropriate to check it into this repo. Instead can we just host it at micropython.org/resources/firmware? I can copy it there and we can link to it in the deploy.md file.

@robert-hh
Copy link
Contributor Author

Instead can we just host it at micropython.org/resources/firmware? I

That's good. I was wondering if there is a place to host support files likes this one. Should I keep the file in the PR?

@robert-hh
Copy link
Contributor Author

@dpgeorge The file deploy.md is updated to point to micropython.org/resources/firmware. And since it's a .hex files already, the step of converting a .bin file to Intel hex is not needed any more.

Add instructions to install a bootloader to the board.  The SAMD21 XPLAINED
PRO board is shipped without a bootloader, which therefore has to be
installed once before it can be used with MicroPython.

Signed-off-by: robert-hh <robert@hammelrath.com>
A bootloader labelled for the SAMD21 XPLAINED PRO board.  The only
difference to a generic bootloader are the names and ID of the USB port and
the label of the drive that is opened.

Signed-off-by: robert-hh <robert@hammelrath.com>
The initial settings did not support it.  The change required to add a
dedicated handling of the Adesto 1MByte flash of the XPLAINED PRO board,
which does not support the sfdp feature.

Fixes the ID check of the Adesto/Renesas 1MByte flash.

Signed-off-by: robert-hh <robert@hammelrath.com>
Use `self` (the first argument) instead of the global `samd_flash_obj` when
accessing the `flash_base` parameter.  This allows there to be multiple
flash objects for various types of filesystem.

Signed-off-by: robert-hh <robert@hammelrath.com>
@dpgeorge dpgeorge merged commit ceae0e1 into micropython:master Nov 18, 2024
8 checks passed
@dpgeorge
Copy link
Member

@robert-hh I have merged this and the .hex file for the bootloader is copied across to the micropython.org URL.

Actually, I think it would be good to add a README.md to the new ports/samd/mboot/ directory which describes how that .hex file is generated (which repository it comes from), and also giving the license of that file (which would probably just be the license of the source code it was generated from). Would you mind making a PR for that README?

@robert-hh
Copy link
Contributor Author

robert-hh commented Nov 18, 2024

Sure. I will do that,

Edit: Done.

@robert-hh robert-hh deleted the samd_sp11 branch November 19, 2024 07:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy