GNU social JP
  • FAQ
  • Login
GNU social JPは日本のGNU socialサーバーです。
Usage/ToS/admin/test/Pleroma FE
  • Public

    • Public
    • Network
    • Groups
    • Featured
    • Popular
    • People

Conversation

Notices

  1. Embed this notice
    Greg Steiert (steieio@qoto.org)'s status on Monday, 09-Dec-2024 02:38:46 JST Greg Steiert Greg Steiert

    UF2 works for data too.

    The USB Flashing Format (UF2) was developed as a way to update firmware on microcontrollers, but it works equally well for data. Let’s look at how and why you might want to do that using the real world application of loading an FPGA.

    The great thing about UF2 is that it emulates a USB thumb drive so images can be transferred by dragging and dropping the properly formatted file using the drivers that are standard in every operating system. The key is the specially formulated packets that you can read about in this blog:
    https://makecode.com/blog/one-chip-to-flash-them-all
    I also spoke about it at Crowd Supply Teardown 2023:
    https://www.youtube.com/watch?v=AdoWZkSSaoA

    While primarily created for firmware updates, it can transfer data just as easily. In the case of loading an FPGA, the firmware that loads the image into the FPGA does not need to change for each new image. One way to transfer the data is to convert the image to a C array and build it with the firmware, but that would require rebuilding the firmware for every new image which is not necessary. Instead of converting the image to a C array, you can convert it to UF2 packets so that it can be loaded directly into flash without rebuilding.

    I did just this when I ported Altera’s JBC player code to the Raspberry Pi Pico board. The RP2040 implements a UF2 bootloader in its ROM, and the SDK produces a UF2 file when building the code. The same bootloader can be used to load an FPGA JBC image into the flash by converting the file to UF2 packets with the uf2conv utility.

    The JBC player firmware needs to know where the JBC FPGA image is located, and the size. To make sure the firmware is compatible with the image, and make it easier to use, I decided to combine the firmware UF2 image with the JBC UF2 image. I created a custom UF2 converter that would take the firmware output from the RP2040 SDK, add a 256byte header with the JBC image size, and append the JBC image.

    The header is 256 bytes to fill one UF2 block, so I added some additional information such as a description of the image. The output is a combined file similar to if you had included the JBC file as a C array, but in this case, to replace the JBC image, you do not need to have the RP2040 SDK installed, you only need to run a Python script.

    You can learn more about the process and some quirks with the RP2040 ROM UF2 implementation in this Crowd Supply Teardown Session:
    https://www.youtube.com/watch?v=Ns5RiT4F2Mw

    The code is available on GitHub:
    https://github.com/steieio/jbcuf2
    And I used it in a workshop at Crowd Supply Teardown 2024:
    https://github.com/gsteiert/pico-dirty-blaster-workshop

    In conversation about 6 months ago from qoto.org permalink

    Attachments


    1. https://media.social.qoto.org/media_attachments/files/113/612/352/275/994/282/original/c5946f81f751b058.png
    2. Domain not in remote thumbnail source whitelist: pxt.azureedge.net
      One chip to flash them all
    3. TEARDOWN 2023 - Adventures in Flashloaders with Greg Steiert
      from Crowd Supply
      TEARDOWN 2023 - Adventures in Flashloaders with Greg SteiertA quick look at the evolution of USB mass storage, drag-n-drop bootloaders and some learnings fro...
    4. Teardown Session 50: Greg Steiert, Technical Marketing Manager at Altera
      from Crowd Supply
      **Shout Out to This Week's Sponsor, Altera!**In this Teardown Session, Crowd Supply's Helen Leigh talks with Greg Steiert from Altera. Greg has figured out h...
    5. No result found on File_thumbnail lookup.
      GitHub - steieio/jbcuf2: JBC player with UF2 converter
      JBC player with UF2 converter. Contribute to steieio/jbcuf2 development by creating an account on GitHub.
    6. Domain not in remote thumbnail source whitelist: opengraph.githubassets.com
      GitHub - gsteiert/pico-dirty-blaster-workshop: Files and documentation for Pico-Dirty-Blaster Workshop
      Files and documentation for Pico-Dirty-Blaster Workshop - gsteiert/pico-dirty-blaster-workshop
    • Embed this notice
      Marcus Müller (funkylab@mastodon.social)'s status on Monday, 09-Dec-2024 02:38:32 JST Marcus Müller Marcus Müller
      in reply to
      • LaF0rge
      • Open Source Mobile Comms

      @steieio @osmocom @LaF0rge I mean, you should be able to do DFU via WebUSB even, so I really am having a hard time agreeing, especially since "copy a file to an emulated storage device, but relay on the OS don't doing out-of-order things or simultaneous file accesses, or checking what it wrote" is honestly just a terrible idea, as simple as it sounds to the user.

      In conversation about 6 months ago permalink
    • Embed this notice
      Marcus Müller (funkylab@mastodon.social)'s status on Monday, 09-Dec-2024 02:38:42 JST Marcus Müller Marcus Müller
      in reply to
      • LaF0rge
      • Open Source Mobile Comms

      @steieio it does make a lot of sense from a Microsoft perspective, where software distribution still seems to be hard, indeed, and they for some reason don't like generic bulk device drivers. I've not had the worst experiences with dfu-util myself (thanks, openmoko/ @LaF0rge / @osmocom), and would honestly just have wished for more self- descriptor functionality bolted onto that protocol.

      In conversation about 6 months ago permalink
    • Embed this notice
      Greg Steiert (steieio@qoto.org)'s status on Monday, 09-Dec-2024 02:38:42 JST Greg Steiert Greg Steiert
      in reply to
      • LaF0rge
      • Open Source Mobile Comms
      • Marcus Müller

      @funkylab @osmocom @LaF0rge I would argue that macOS and Android are even worse than Microsoft (iOS is fundamentally broken). It is very difficult to build an accessible platform agnostic solution with DFU. USB MSC can even work with Android or ChromeOS. That opens up cheap hardware that you could put in a middle school classroom.

      In conversation about 6 months ago permalink
      LaF0rge repeated this.
    • Embed this notice
      Greg Steiert (steieio@qoto.org)'s status on Monday, 09-Dec-2024 02:38:44 JST Greg Steiert Greg Steiert
      in reply to
      • Marcus Müller

      @funkylab Great question. DFU was intended for this but everyone implements it differently and the drivers are not built into operating systems by default, so you need to write a custom application and build it for every operating system you want to support. MSC (Mass Storage Class) used by USB drives is supported in everything (even Android) without a custom app. The blog post I linked to explains why they developed UF2 at Microsoft

      In conversation about 6 months ago permalink
    • Embed this notice
      Marcus Müller (funkylab@mastodon.social)'s status on Monday, 09-Dec-2024 02:38:45 JST Marcus Müller Marcus Müller
      in reply to

      @steieio bit confused; isn't dfu the time-proven USB standard in that space?

      In conversation about 6 months ago permalink

Feeds

  • Activity Streams
  • RSS 2.0
  • Atom
  • Help
  • About
  • FAQ
  • TOS
  • Privacy
  • Source
  • Version
  • Contact

GNU social JP is a social network, courtesy of GNU social JP管理人. It runs on GNU social, version 2.0.2-dev, available under the GNU Affero General Public License.

Creative Commons Attribution 3.0 All GNU social JP content and data are available under the Creative Commons Attribution 3.0 license.