#tinyuf2

1 messages · Page 2 of 1

rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
#

Added my new OMGS3
Added my new RGB Touch Mini
Added my TinyWATCH S3

TinyWATCH S3 doesn't have a status LED or RGB LED, so I commented out the DATA and POWER pins, and set the number of RGB LEDs to 0.

I hope that is the correct way to handle this use case. It seems to work ok, but I am not sure if there's an alternate way to handle no status LED.

PIDs/VID supplied by Espressif

rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
#

Operating System

Others

INFO_UF2.TXT

n/a

What happened ?

when making a new release, build failed when trying to upload artifacts/binaries to aws with esp32 build.

https://github.com/adafruit/tinyuf2/actions/runs/10703503616/job/29674841712

I am not familiar with this @makermelissa since you fixed this a couple of time previously, could you please lease a hand whenever you have time. Thank you.

How to reproduce ?

make a new release

Debug Log

No response

#...

rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
#

Checklist

By completing this PR sufficiently, you help us to review this Pull Request quicker and also help improve the quality of Release Notes

  • [ ] Please provide specific title of the PR describing the change
  • [ ] Please provide related links (eg. Issue which will be closed by this Pull Request)
  • [ ] If you are adding an new boards, please make sure
    • [ ] Provide link to your allocated VID/PID if applicable
    • [ ] UF2_BOARD_ID in your board.h follow correct format ...
rocky ridgeBOT
rocky ridgeBOT
#

Checklist

By completing this PR sufficiently, you help us to review this Pull Request quicker and also help improve the quality of Release Notes

rocky ridgeBOT
hasty juniper
#

Ok, so tinyuf2 stm32f4 port: I'm seeing conflicting information about the sectors used by tinyuf2 itself... One spot says first two 16K sectors are tinyUF2, another says the first 4

#

I'm trying to do the following for an f401cb (128K total flash) keyboard device:

  • Fit tinyUF2 into the first 2x16K sectors
  • Use the next two 16K sectors for application settings storage
  • Keep application itself in the last large 64K sector.
#

I tweaked the stm32f4_boot.ld file to specify FLASH and CONFIG to squeeze into the first 32K and that seems fine.

#

Any reason the above won't work?

#

(I don't have the hardware on hand to test, trying to set this up for someone else to test)

rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
#

The VID/PID are set on best knowdledge.
Olimex RT1011: PID and VID have been supplied by the vendor and are set by the APP as well.
Makerdiary RT1010 Nano Kit: The VID/PID are the values shown in their bootstrap loader. So I use the same here, even if the VID is one of Seeed Technologies.
Seeed Arch Mix: 0x2886 is tve VID of Seeed. No specific PID was supplied by the vendor. But I can ask.

rocky ridgeBOT
#

The VID/PID are set on best knowdledge. Olimex RT1011: PID and VID have been supplied by the vendor and are set by the APP as well. Makerdiary RT1010 Nano Kit: The VID/PID are the values shown in their bootstrap loader. So I use the same here, even if the VID is one of Seeed Technologies. Seeed Arch Mix: 0x2886 is tve VID of Seeed. No specific PID was supplied by the vendor. But I can ask.

I guess olimex and makerdiary is OK, for Seed Arch, maybe if you could just ask to see if they allo...

#

I requested NXP set aside a VID/PID that could be used for generically for
UF2. I would suggest using that for UF2 on NXP based boards. Otherwise you
always need two PID if your application has a different USB configuration
than UF2.

Greg

On Fri, Oct 11, 2024, 7:01 AM Ha Thach @.***> wrote:

The VID/PID are set on best knowdledge. Olimex RT1011: PID and VID have
been supplied by the vendor and are set by the APP as well. Makerdiary
RT1010 Nano Kit: The VID/PID are the...

#

I guess olimex and makerdiary is OK, for Seed Arch, maybe if you could just ask to see if they allocated any PID for the board (you can @ their developer here know one).

I asked both Makerdiary and Seeed. Makerdiary swiftly responded that 0x2886/0xf00f is the right one. The have an agreement with Seeed. Seeed did not respond yet about the Arch Mix board. Maybe on Monday,

rocky ridgeBOT
rocky ridgeBOT
#

I requested NXP set aside a VID/PID that could be used for generically for UF2. I would suggest using that for UF2 on NXP based boards. Otherwise you always need two PID if your application has a different USB configuration than UF2. Greg

That sounds great, do you think that makes sense to ask for a PID per mcu since they are a bit different from each other. Though I think a general one for imxrt is OK as well for board that does not has a private PID. Btw, @gsteiert since you are here, ...

rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
#

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
Is there any plan to add STM32F072 tinyuf2 bootloader supports?
Even tho stm32f072 has usb-dfu directly, but i will be very helpful if tinyuf2 can add supports for this specific mcu, since user can just drag and drop the firwmare for update.
This is mainly to achieve qmk keyboard firmware with tinyuf2 supports
**Describe the solut...

rocky ridgeBOT
#

Hi everyone,

I am working on support for STM32H503RB on STM32H503 Nucleo board. I used F4 code as a template. I have a working code that can update application on the microcontroller.

I noticed that despite VTOR being set to BOARD_FLASH_APP_START in board_app_jump(), it is restored to default value by SystemInit() in startup code delivered by ST. I have to manually set VTOR to BOARD_FLASH_APP_START on the beginning of my main() in the app. I did not find any workaround for it without m...

rocky ridgeBOT
rocky ridgeBOT
#

In order to free up sectors 2 and 3 for the application, limit the bootloader to the first 16K sector, config to the next 16K. We keep the application still starting at 0x10000 so that 0x8000 and 0xC000 sectors can be used by the application for settings/config storage.

Checklist

By completing this PR sufficiently, you help us to review this Pull Request quicker and also help improve the quality of Release Notes

  • [ ] Please provide specific title of the PR describing the change...
rocky ridgeBOT
#

So, based on the CI failure... A few things are clear:

  • tinyuf2 only fits with bare minimum features enabled. Feather build fails, for example, when the neopixel code gets built too. Setting the number of pixels to 0 for that board makes the build pass again here locally.
  • I realize that changing this also means the config location would change for a lot of boards, probably breaking things for existing devices.

Thoughts on making this an optional different linker file/set of offsets ...

rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
#

Checklist

By completing this PR sufficiently, you help us to review this Pull Request quicker and also help improve the quality of Release Notes

  • [x] Please provide specific title of the PR describing the change
  • [x] Please provide related links (eg. Issue which will be closed by this Pull Request)
  • [x] If you are adding an new boards, please make sure
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
#

Operating System

Windows 11

INFO_UF2.TXT

Build time issue. No INFO_UF2.txt

What happened ?

The readme specific that the ESP IDF 5.1.4 should be used.

However https://github.com/adafruit/tinyuf2/blob/4858e9071e05827efa9b27e9472e4c46cfc5a65c/ports/espressif/boards/boards.c#L348 uses "hal/usb_fsls_phy_ll.h" which is already removed in ESP IDF 5.1.4 in this commit https://github.com/espressif/esp-idf/commit/a77e5cc718de7c582f29e8fde5e8019e24046f4e

How to reproduce ?

Clon...

rocky ridgeBOT
rocky ridgeBOT
#

Perfect, thank you very much for the PR. I made some changes, but mostly refactor and abstract thing. This is a great PR, I settle with 24KB for H503, and 32KB for the rest due to how the flash protect bit work. Let me know if this work for you, and/or you want to make any further changes. For the self-update, we can do it later on as follow-up PR.

PS: Sorry for the delay, I got into issue when adding/testing blinky app, which is caused by system_stm32h5xx.c reset the VTOR table --> caus...

rocky ridgeBOT
rocky ridgeBOT
#

Thanks for all work that you have done on this PR. I gave TinyUF2 entire 64kB of flash because I thought it is unified across families. I also had this problem with VTOR and I even mentioned it in PR description.

Yeah, I overlook that, and thank to your comment, I am able to fix that. I am having issue with flash protect I think. Since for h563 (what I am testing), 1 bit is a group of 4 sectors, 0x03 is 8 sectors and that is tinyuf2 trying to write to protected flash.

What about VI...

rocky ridgeBOT
rocky ridgeBOT
#

Hi, I checked bootloader and it works for STM32H305. I also flashed blinky app and self update.

Thank you for testing it out, will merge it

I noticed that stm32h5_app.ld does not utilize entire flash memory available for STM32H503 but I assume end user will modify this anyway for their specific project.

Yeah, I skip the flash_size define since most app here is simple, mostly faactory reset, self-update and blinky for testing. User should write their own code/linker.

The on...

rocky ridgeBOT
rocky ridgeBOT
#

VID/PID allocation: https://github.com/espressif/usb-pids/blob/388e9af066ac0b88342a397c208b0a6c05043a2e/allocated-pids.txt#L328

Display

The display uses a Parallel Bus instead of SPI, so I was not able to get that working with this build. However, I defined the pins and can re-test if support for Parallel Bus is added in the future.

Testing

Build was compiled and flashed using ESP-IDF v5.1.4

Output from INFO_UF2.TXT

TinyUF2 Bootloader 0.20.1-25-g46de518 - tinyusb ...
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
#

This pull request includes several changes to the ESP32 build configuration, updates to dependencies, and improvements to USB handling. The most important changes are summarized below:

Build Configuration Updates:

  • Renamed the esp job to espressif and updated the toolchain version from v5.1.4 to v5.3.2 in the .github/workflows/build.yml file. [1] [[2]](diffhunk://#diff-5c3fa597431e...
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
#

Operating System

Linux

INFO_UF2.TXT

TinyUF2 Bootloader 0.20.1-25-g46de518-dirty - tinyusb (0.16.0-1090-g3eea46056)
Model: NXP RT1020 EVK
Board-ID: MIMXRT1020-EVK-revA
Date: Jan 27 2025
Flash Size: 0x00800000 bytes

What happened ?

The bootloader changes the flash clock frequency for the imxrt10xx boards. For most boards it is lowered from 100Mhz to 60Mhz or 30MHz. For the Teensy it it raised from 100Mhz to 133Mhz. Is is possible either

  • not to lower the frequency? I made tri...
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
#

Operating System

Windows 10

INFO_UF2.TXT

Not yet uploaded

What happened ?

Hi, I'm a beginner. My hardware board is based on STM32F405RGT6 + USB3300. The STM32F405RGT6 uses an 8 MHz crystal, and the USB3300 uses a 24 MHz crystal. Only the ULPI-related pins are connected between the USB3300 and STM32F405RGT6, with the USB_HS interface exposed via the USB3300. I have flashed other firmware and confirmed that USB High-Speed is recognized, proving the hardware is functional. I a...

rocky ridgeBOT
#

Thank you for both merging the PR and the hint for changing the frequency change. I have another question:
In the memconfig structure there are elements around deviceModeCfgEnable, which are configured to enable quad mode. It is configured to send a Write Status command (hex 01), with argument 0x40; LUT entry 4. So far that's ok. But writing to the status register requires to send the write Enable command before. But that's missing. So I wonder how this enabling happens. Actually, the...

rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
#

Description of Change

The settings for the initialization sequence of my last PR were not the right ones. Instead of the W25Q16 flash listed initially in the first Olimex documentation, the production boards now use an EN25Q16B-104HIP chip, which needs different arguments to enable quad mode. With the existing arguments, the flash may get write locked.

Tested with an Olimex RT1010Py board.

P.S.: In case the flash got write locked can then be unlocked using the flash-sfdp mode for ...

rocky ridgeBOT
rocky ridgeBOT
#

About changing the flash clock at runtime. I used the code from your link as template. As an element of pedantic, I add a mechanism to change the clock to any of the possible frequencies by modifying both the pfd_480 and the flexspi PODF dividers, using the values below which give the closest match.

typedef struct _ps_div_t {
    uint8_t pfd480_div;
    uint8_t podf_div;
} ps_div_t;

static ps_div_t div_table_mhz[] = {
    { 35, 8 }, // Index 0 is not valid, map it to 30 MHz
    ...
rocky ridgeBOT
#

Hi @hathach -- Our plan for CircuitPython 10 is to change the partition table for ESP32-S3 4MB flash boards from partitions-4MB.csv to partitions-4MB-noota.csv. Currently there is not enough room in the ota_0 partition to include BLE support.

These are the boards that would be affected:

`
adafruit_feather_esp32s3_reverse_tft
adafruit_feather_esp32s3_tft
adafruit_qtpy_esp32s3_n4r2
deneyap_kart_1a_v2
lolin_s3_mini
magiclick_s3_n4r2
waveshare_esp32_s3_zero

We will warn CircuitPyth...

rocky ridgeBOT
rocky ridgeBOT
#

@dhalbert I think it is better to just produce 2 zip/uf2, it is much easier to maintain than duplicate every boards. Defult build script will use the noota partiion, ci will produce both with/without_ota. For naming, it is up to you, but I think we can add _with_ota for dual banks and keep the default (no ota) which user will tend to download.

We can make the change with version 0.30.0 (or even 1.0.0 if you like) we can keep producing dual uf2/zip for a few version in the future and can dro...

rocky ridgeBOT
rocky ridgeBOT
#

Per email from github, the 20.04 runners will soon be removed. switch up to the latest github ubuntu version instead.

Checklist

By completing this PR sufficiently, you help us to review this Pull Request quicker and also help improve the quality of Release Notes

  • [ ] Please provide specific title of the PR describing the change
  • [ ] Please provide related links (eg. Issue which will be closed by this Pull Request)
  • [ ] If you are adding an new boards, please make sure
    ...
rocky ridgeBOT
rocky ridgeBOT
#

Checklist

By completing this PR sufficiently, you help us to review this Pull Request quicker and also help improve the quality of Release Notes

  • [X ] Please provide specific title of the PR describing the change
  • [X ] Please provide related links (eg. Issue which will be closed by this Pull Request)
  • [X ] If you are adding an new boards, please make sure
    • [ X] Provide link to your allocated VID/PID if applicable
    • [X ] UF2_BOARD_ID in your board.h follow correct fo...
rocky ridgeBOT
#

1d9515a Added support* for Waveshare ESP32-S3-Matrix - SomeSpaceNerd
e94350a Changed neopxel brightness - SomeSpaceNerd
9066ba1 Update board.h to not invert the neopixel's RG - SomeSpaceNerd
da7f58e Reduce neopixel brightness and fix RG inversion - SomeSpaceNerd
f22457e Merge pull request #436 from SomeSpaceNerd/master - hathach

rocky ridgeBOT
#

Checklist

By completing this PR sufficiently, you help us to review this Pull Request quicker and also help improve the quality of Release Notes

  • [ ] Please provide specific title of the PR describing the change
  • [ ] Please provide related links (eg. Issue which will be closed by this Pull Request)
  • [x] If you are adding an new boards, please make sure
    • [x] Provide link to your allocated VID/PID if applicable
    • [x] UF2_BOARD_ID in your board.h follow correct format ...
rocky ridgeBOT
rocky ridgeBOT
#

Currently Circuitpython is supported on the lolin S3 mini pro
https://circuitpython.org/board/lolin_s3_mini_pro/

I installed it successfully using the bootloader from the S3 mini, but since the onboard neopixel is wired differently the LED in not signaling the boot.
on this board neopixel data is on IO8
and the LED gets power form IO7 that need to be high to enable the LED

the board also has 3 built in buttons, on IO0 IO47 and IO48 but I'm not sure they can be usefull to the bootloader.

I...

rocky ridgeBOT
rocky ridgeBOT
#

There are two variants of the Lilygo T-QT Pro. I only own one but the difference is the ram/flash setup (N8 and N4R2 version). I used the VID/PID requested by @tyeth who didn't get to adding the board at the time.
It has a display, and no status LED.

PID: https://github.com/espressif/usb-pids/pull/80
Product page: https://lilygo.cc/products/t-qt-pro
Github page: https://github.com/Xinyuan-LilyGO/T-QT

Note that the non-pro are no longer available on Lilygo's site, but should be compat...

rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
#

I see the action exists, but does not appear to ever get executed. The point of these tests was to address the very high cost of manual validation of the file system generation ... by ensuring those same inputs give identical outputs ... and thus avoid unintentional changes in what's generated.

I imagine some changes have been intentional since this was written. If I get this action running again, would you consider running it weekly?

rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
#

Description of Change

Board configuration updates:

  • Updated the partition table filenames from partitions-4MB.csv to partitions-4MB-noota.csv for multiple boards, including adafruit_feather_esp32s3, adafruit_feather_esp32s3_reverse_tft, adafruit_feather_esp32s3_tft, adafruit_qtpy_esp32s3_n4r2, deneyap_kart_1a_v2, lilygo_tqt_pro_psram, lolin_s3_mini, magiclick_s3_n4r2, waveshare_esp32_s3_matrix, and waveshare_esp32_s3_zero. [[1]](diffhunk://#diff-62166c16d...
rocky ridgeBOT
rocky ridgeBOT
#

Checklist

By completing this PR sufficiently, you help us to review this Pull Request quicker and also help improve the quality of Release Notes

  • [x] Please provide specific title of the PR describing the change

This checklist items that are not applicable to your PR can be deleted.


Description of Change

Updated the USB Descriptors to accommodate MCUs where the endpoint number can only be used in a single direction. These devices are identified in Tin...

rocky ridgeBOT
#

@hathach We decided that we want to remove the second OTA partition now for all 4MB boards, both S2 and S3. Should I make a new issue for that?

We are also going to do that for the non-UF2 boards, like ESP32, C3, etc.

Could you make that release 1.0.0? Maybe let's drop the 0.30.0 release, since it is partial. I was thinking of renumbering that release anyway. Thanks.

rocky ridgeBOT
rocky ridgeBOT
#

Checklist

By completing this PR sufficiently, you help us to review this Pull Request quicker and also help improve the quality of Release Notes

  • [ ] Please provide specific title of the PR describing the change
  • [ ] Please provide related links (eg. Issue which will be closed by this Pull Request)
  • [ ] If you are adding an new boards, please make sure
    • [ ] Provide link to your allocated VID/PID if applicable
    • [ ] UF2_BOARD_ID in your board.h follow correct format ...
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
#

This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests wi...

rocky ridgeBOT
#

Checklist

By completing this PR sufficiently, you help us to review this Pull Request quicker and also help improve the quality of Release Notes

  • [X] Please provide specific title of the PR describing the change
  • [X] If you are adding an new boards, please make sure
    • [X] Provide link to your allocated VID/PID if applicable
    • [X] UF2_BOARD_ID in your board.h follow correct format from uf2 specs

*This che...

rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
#

implemented, in release 0.31.0 for board with 4MB flash (s2 and s3), there will be combined.bin and combined_ota.bin.

So combined_ota.bin includes ota_0 and ota_1, and combined.bin includes only a twice-as-large ota_0? That looks like what is happening.

I noticed the file list above only has one partititon-table.bin, but I would expect two, one with ota_0 and ota_1, and one with only ota_0. Which partition layout is in partition-table.bin?

rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
#

Merging the devices together also crossed my mind when doing the port. There are just enough nuances between the underlying API calls and operation between parts that I worry having some pre-processor conditional blocks for the variations will make things unreadable and hard to follow. Diff'ing the board.c and board_flash.c files between parts will give you an idea of what I mean by nuances.

I am open to any suggestions you have to combine things together. Let me know, as well as if you...

rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
#

hi @BrentK-ADI thank you for the great PR, the code work super well, I have tested the blinky app and update-tinyuf2 (self_update), both are working well on my feather max32666 and max32690evkit. Furthermore, I have merged all the maxim mcu into common ports/maxim in this branch https://github.com/adafruit/tinyuf2/tree/add-max32-support, but I have only done that with cmake, which I found much easier to manage and is primarily using. To build you need

cd ports/maxim
mkdir build
cd...
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
#

@hathach, Had a chance to run through all this. Thanks for putting all this extra work in!

The cmake build system is fine with me. I was able to use the tools that come with our MSDK installer, no need to have an independent Make wrapper. I like how you were able to combine the different MCUs into a single port, that all looks good.

One issue:
Not sure the root cause of this, whether it be the cmake optimization rules, or something else, but the bootloader executable ends up linki...

rocky ridgeBOT
#

@hathach, Had a chance to run through all this. Thanks for putting all this extra work in!

The cmake build system is fine with me. I was able to use the tools that come with our MSDK installer, no need to have an independent Make wrapper. I like how you were able to combine the different MCUs into a single port, that all looks good.

Great, I am plannig to do only cmake for future ports.

One issue: Not sure the root cause of this, whether it be the cmake optimization rules, or...

rocky ridgeBOT
#

also update README for cmake build instruction and removed make-related files. Please pull and try again (it is rebased to master, you may need a clean checkout). Feel free push any update to readme or any files. Also I am only able to test with max32666fthr and max32690ekit (I bricked the maax32650 when mistakenig flashing 32666 firmware on it), so please test with other board in the maxim. If everything is good, we can merge this

rocky ridgeBOT
#

also update README for cmake build instruction and removed make-related files. Please pull and try again (it is rebased to master, you may need a clean checkout). Feel free push any update to readme or any files. Also I am only able to test with max32666fthr and max32690ekit (I bricked the maax32650 when mistakenig flashing 32666 firmware on it), so please test with other board in the maxim. If everything is good, we can merge this

I made an update to family_support.cmake for OpenOCD fla...

rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
#

In Learn Guides, we sometimes want to point to the combined.bin for a particular board, for use with esptool.py or the Adafruit ESPTool. Right now we have to describe downloading the .zip and, unzipping it, and choosing the combined.bin, which is unlabeled. (Keeping track of anonymous combined.bin files is not easy. I often rename them or keep them in folders.)

The combined.bin is referenced far more often than anything else in the zip file. What would you think about uploading it sep...

rocky ridgeBOT
rocky ridgeBOT
#

I consulted with the the Learn developers, and there is no existing feature to do this dynamically. They suggested uploading the combined.bin separately, and organizing https://adafruit-circuit-python.s3.amazonaws.com/index.html?prefix=bootloaders/esp32/ better, which was also on my mind. So I wrote a script to break out the combined.bin and combined-ota.bin files, and also copy the current .zip and .uf2 files into board-specific directories. I've now done this on S3, which a structur...

rocky ridgeBOT
rocky ridgeBOT
#
  • Fixes #452

During a release

  • Upload the tinyuf2*.zip and update-tinyuf2*.bin to, in a board-specific directory. The upload path used to be, for example:
    s3://adafruit-circuit-python/bootloaders/esp32/tinyuf2-adafruit_feather_esp32s3-0.32.0.zip
    and now it is
    s3://adafruit-circuit-python/bootloaders/esp32/adafruit_feather_esp32s3/tinyuf2-adafruit_feather_esp32s3-0.32.0.zip
    This groups by board name, and reduces the large number of files at one level in S3.
  • Also upl...
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
#

Thanks for coming bacjk

have you followed my above linked to action run from yesterday build ?

Of course! I do read your messages and follow links to check the information you provide. I don't know you as a person but I can value you enough to show some respect. Also ignoring your content would make this discussion pointless. You shouldn't have asked that.

Obviously, whatever you have done or whatever action you have run it did not clear the CI build error flag from the STM32L4 port., wh...

rocky ridgeBOT
#

oh, I just read your 1st post again, and I see what you mean by "CI build error". You misunderstand ci check displayed in the folder by github. Let me sum up

  • the latest changes to L4 port is 6 month ago and that commit has a failed build. the failed build can be any run/port as long as it is trigger by that commit. That does not means the folder itself has something failed.
  • the issue no longer exist at the momemnt

Please try to get familliar with github action status and how github web d...

#

Please try to get familliar with github action status and how github web display status for the last commit in a folder view.

Yeah, I think I understand it. In my original post I asked "Can you please validate the STM32L4 port to check whether these errors are relevant or need to be fixed?". The whole idea of contacting you was to ensure that these errors are not relevant. I don't have time to waste like configuring a custom board just to find out ((probably late in the development proce...

rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
#

Hello, I would like to ask about using TinyUF2 on ESP32. During my research, I found that "TinyUSB must rely on USB device mode." I want to know if this is a correct understanding. Furthermore, in the ESP32-S3 and ESP32-S2 chips, there is a peripheral called "USB-OTG," which supports "USB device mode." However, in the data sheets for the ESP32-C3 and ESP32-C6, they use "USB Serial/JTAG," so from what I read in the issues on your GitHub (https://github.com/adafruit/tinyuf2/issues/378 and https...

rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
#

CircuitPython version and board name

n/a; M5Stack Dial

Code/REPL

n/a

Behavior

file note found at https://adafruit-circuit-python.s3.amazonaws.com/bootloaders/esp32/m5stack_dial/tinyuf2-m5stack_dial-0.35.0-combined.bin


NoSuchKey
The specified key does not exist.
bootloaders/esp32/m5stack_dial/tinyuf2-m5stack_dial-0.35.0-combined.bin
72H3P2CEBHJY9JF6
x0dDo+1+LIr0f8PEepejXh+yu2500mFsxVpT+5+L5mFoUQC5zzpY2ohUj+omVr/Q8PokZIQHUQU=

Descr...

rocky ridgeBOT
rocky ridgeBOT
#

Checklist

By completing this PR sufficiently, you help us to review this Pull Request quicker and also help improve the quality of Release Notes

  • [x] Please provide specific title of the PR describing the change
  • [x] Please provide related links (eg. Issue which will be closed by this Pull Request)
  • [x] If you are adding an new boards, please make sure
    • [x] Provide link to your allocated VID/PID if applicable
    • [x] UF2_BOARD_ID in your board.h follow correct format ...
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
#

Checklist

By completing this PR sufficiently, you help us to review this Pull Request quicker and also help improve the quality of Release Notes

  • [x] Please provide specific title of the PR describing the change
  • [x] Please provide related links (eg. Issue which will be closed by this Pull Request)
  • [ ] If you are adding an new boards, please make sure
    • [ ] Provide link to your allocated VID/PID if applicable
    • [x] UF2_BOARD_ID in your board.h follow correct format ...
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
#

Pull request overview

This PR adds support for the MIMXRT1176 (i.MX RT1170) microcontroller with flash boot capability (XIP - Execute In Place). The implementation differs from other RT10xx chips by supporting both RAM-based SDP loading and direct flash boot, using a two-stage flashloader approach with blhost instead of sdphost. The PR includes support for the MIMXRT1170-EVKB evaluation board and fixes a cache invalidation bug affecting all IMXRT boards.

Key Changes:

  • Added MIMX...
rocky ridgeBOT
#

I have been getting a lot of reports with issues using TinyUF2 with Mac OS, but I'm unsure if they can be fixed.

A lot of time copy into the drive returns Unexpected Error (100093)
I also gotten some reports that the firmware isn't working correctly if the uf2 is >6mb.

I have no idea how to debug those, but I'm pretty sure other facing the same issue?

After copying, mac OS always complains about the disk not ejected properly. But I don't know if there are ways to fix this.

rocky ridgeBOT
#

The big issue with UF2 in general right now with macOS Tahoe (26.0 / 26.1 as of this writing) is that it refuses to mount and show these small "suspicious" drives at all in the Finder, so a casual user will not be able to do an update.

you can see the UF2 disk waiting to be mounted at:

diskutil list

but you have to explicitly mount it to see it in the Finder:

diskutil mountDisk /dev/diskN

alternatively, you can not mount it and send the firmware directly:

sudo dd if=firmware.uf2...
rocky ridgeBOT
#

The big issue with UF2 in general right now with macOS Tahoe (26.0 / 26.1 as of this writing) is that it refuses to mount and show these small "suspicious" drives at all in the Finder, so a casual user will not be able to do an update.

you can see the UF2 disk waiting to be mounted at:

diskutil list

but you have to explicitly mount it to see it in the Finder:

diskutil mountDisk /dev/diskN

alternatively, you can not mount it and send the firmware directly:

`...

rocky ridgeBOT
#

The big issue with UF2 in general right now with macOS Tahoe (26.0 / 26.1 as of this writing) is that it refuses to mount and show these small "suspicious" drives at all in the Finder, so a casual user will not be able to do an update.

you can see the UF2 disk waiting to be mounted at:

diskutil list

but you have to explicitly mount it to see it in the Finder:

diskutil mountDisk /dev/diskN

alternatively, you can not mount it and send the firmware directly:

`...

rocky ridgeBOT
rocky ridgeBOT
#

@APIUM exellent work, thank you very much of the PR. I refactor and update PR to get SRAM version working as well. Binary is flashable via either jlink and/or sdp using blhost. For BLhost we need to create image with ivt at zero address there for need to cook the ivt header (boot start + size). Also when loaded by blhost, fcfb is not part of the image, therefore I added an fcfb copy and ivt/boot copy so that we can re-create those section.

I think we should only keep the flash-store ram-exe...

rocky ridgeBOT
#

@APIUM exellent work, thank you very much of the PR. I refactor and update PR to get SRAM version working as well. Binary is flashable via either jlink and/or sdp using blhost. For BLhost we need to create image with ivt at zero address there for need to cook the ivt header (boot start + size). Also when loaded by blhost, fcfb is not part of the image, therefore I added an fcfb copy and ivt/boot copy so that we can re-create those section.

Thanks for the changes and explanation, I’m on p...

rocky ridgeBOT
rocky ridgeBOT
#

thank you very much for your PR. I have wrap up the rt117x support with flash stored, ram executed like other rt10xx. blhost and cooked ivt0 give me a bit of troubleshooting, but it is on running OK now. I would expect newer imxrt would use blhost instead of sdphost, so it is great to get it supported. @APIUM should there is any issue when you get back to your pc. Let me know, we can fix it with follow up pr.

rocky ridgeBOT
#

thank you very much for your PR. I have wrap up the rt117x support with flash stored, ram executed like other rt10xx. blhost and cooked ivt0 give me a bit of troubleshooting, but it is on running OK now. I would expect newer imxrt would use blhost instead of sdphost, so it is great to get it supported. @APIUM should there is any issue when you get back to your pc. Let me know, we can fix it with follow up pr.

Great to have this merged, thanks for your help and follow up work @hathach. I ...

rocky ridgeBOT
rocky ridgeBOT
#

This pull request introduces several improvements and refactorings across documentation, build scripts, and board support for multiple MCU families. The main themes are: moving board lists from individual family READMEs to a centralized supported_boards.md, improving build and flash processes for NXP iMXRT (MIMXRT10xx), adding new erase functionality for J-Link, and updating formatting and toolchain settings for consistency.

Documentation and Board List Refactoring

  • Updated fam...
rocky ridgeBOT
#

@APIUM I made an follow up PR to fix rt1170 evk LED and also refactor to use the .mex (mcux pinconfig tool) to make it easier to config pin/clock. Though I found that rt1170 run with very low cpu frequency i.e. 24MH comparing to other smaller chip with 600Mhz. I tried to tweak it to its nominal freq at 900mhz, although tinyuf2 can boot, but jumping to app e.g blinky does not work. Not sure what is wrong but If you could find time to fix it, it would be great thank you.

rocky ridgeBOT
#

Checklist

By completing this PR sufficiently, you help us to review this Pull Request quicker and also help improve the quality of Release Notes

  • [x ] Please provide specific title of the PR describing the change
  • [x ] Please provide related links (eg. Issue which will be closed by this Pull Request)

This checklist items that are not applicable to your PR can be deleted.


Description of Change

Clean and disable caches before jumping to application. ...

rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
#

Checklist

By completing this PR sufficiently, you help us to review this Pull Request quicker and also help improve the quality of Release Notes

  • [X] Please provide specific title of the PR describing the change
  • [X] Please provide related links (eg. Issue which will be closed by this Pull Request)
  • [ ] If you are adding an new boards, please make sure
    • [X] Provide link to your allocated VID/PID if applicable
    • [X] UF2_BOARD_ID in your board.h follow correct format ...
rocky ridgeBOT
rocky ridgeBOT
#

Checklist

By completing this PR sufficiently, you help us to review this Pull Request quicker and also help improve the quality of Release Notes

  • [ ] Please provide specific title of the PR describing the change
  • [ ] Please provide related links (eg. Issue which will be closed by this Pull Request)
  • [ ] If you are adding an new boards, please make sure
    • [ ] Provide link to your allocated VID/PID if applicable
    • [ ] UF2_BOARD_ID in your board.h follow correct format ...
rocky ridgeBOT
rocky ridgeBOT
#

Checklist

By completing this PR sufficiently, you help us to review this Pull Request quicker and also help improve the quality of Release Notes

  • [x] Please provide specific title of the PR describing the change

This checklist items that are not applicable to your PR can be deleted.


Description of Change

On testing a performance critical application I found I was getting slow LVGL performance compared to just flashing the hex files. Turns out the FlexS...

rocky ridgeBOT
#

Pull request overview

Adjusts the i.MX RT1170/1176 (FlexSPI1) initialization so the external flash clock is restored to a higher speed after boot clock setup, avoiding leaving the system at a slow FlexSPI clock when jumping to an application.

Changes:

  • Restore FlexSPI1 root clock to a higher frequency for MIMXRT117x in board_init().
  • Issue a FlexSPI1 software reset after changing the root clock to re-sync the peripheral.

💡 Add Copilot custom instructions for smarter, mo...

rocky ridgeBOT
rocky ridgeBOT
#

Summary

Add tinyuf2 bootloader support for the Waveshare ESP32-S3-Tiny board.

The circuitpython.org board page references a tinyuf2 bootloader file (tinyuf2-waveshare_esp32_s3_tiny-0.35.0.zip) that doesn't exist because this board hasn't been added to the tinyuf2 build system yet.

Board Specs

  • Chip: ESP32-S3FH4R2 (dual-core Xtensa LX7, up to 240MHz)
  • Flash: 4MB
  • PSRAM: 2MB
  • Neopixel: GPIO38 (GRB co...
rocky ridgeBOT
high quest
#

First.

earnest sentinel
#

Hi 👋

whole horizon
#

uf.

mint gyro
#

Fourth

errant plover
#

but what about #uf2-samdx1 ?

dark hawk
#

Sixth.

coral wind
#

w00p!

paper sluice
#

last

mint gyro
#

Wrong

#

8 messages in and it’s already off to a great start

vagrant onyx
#

lol

#

More stuff since then.

errant plover
vagrant onyx
errant plover
#

ah thanks, so that's how it's done

vagrant onyx
#

And thinking about it there are only two different flash layouts, one for 4MB flash (almost everything) and one for 16MB flash (UM FeatherS2)

errant plover
#

yes, for the ESP32S2 there's partitions-4MB.csv partitions-8MB.csv and partitions-16MB.csv but a text search returns 0 occurences of 8 in the source

#

(16 is the FeatherS2 and microdev's micro S2)

vagrant onyx
earnest sentinel
#

Can we have GitHub bot setup for the TinyUF2 repo here like it is for CircuitPython.

deep prairie
#

@earnest sentinel I don't see why not. I'll mention it today.

sinful patrol
#

ok, bot should be connected up

deep prairie
#

Thanks, Scott!

sinful patrol
#

np

rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
#

The issue with the mcp9600 https://github.com/adafruit/circuitpython/issues/3894
occurs on my metro-esp32s2 even without the UF2 bootloader so does not appear to be related.

Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.

Press any key to enter the REPL. Use CTRL-D to reload.

Adafruit CircuitPython 6.2.0-beta.2 on 2021-02-11; Adafruit Metro ESP32S2 with ESP32S2
>>> import mcp9600_simpletest
Traceback (most recent call last):
  File "<stdin>...
#

the test code in https://github.com/adafruit/circuitpython/issues/4046 also causes a crash - drop USB and resets

import board
import busio
print(dir(board))
i2c = busio.I2C(board.SCL, board.SDA)

def printdevices():
    i2c.try_lock()
    # Find the I2C devices available.
    devices = i2c.scan()
    print("I2C devices:", len(devices))
    for device in devices:
        print(hex(device))
    i2c.unlock()
    print("I2C unlocked! ")

printdevices()
rocky ridgeBOT
rocky ridgeBOT
#

I have created a new stm32f411ce_blackpill board using the stm32f401ce_blackpill board files as a template. I have updated the board.mk and board.h to use the proper device name, and after flashing the board it boots properly (usb hid device). When I drag-n-drop the new uf2 file to flash it to the board I am not getting the expected result.

I don't know if this is related but... I have found that in board.mk I need to keep -DHSE_VALUE=25000000U or the new uf2 bootloader will not appear a...

rocky ridgeBOT
#

This is from dmesg when I see the hid device.

[ 6459.105034] usb 1-1.4: new full-speed USB device number 10 using xhci_hcd
[ 6459.254544] usb 1-1.4: New USB device found, idVendor=239a, idProduct=005d, bcdDevice= 1.00
[ 6459.254558] usb 1-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 6459.254569] usb 1-1.4: Product: STM32F411CxUx
[ 6459.254580] usb 1-1.4: Manufacturer: STM32
[ 6459.254590] usb 1-1.4: SerialNumber: 2B002C000351303033343331
[ 6459.260507] usb-sto...
rocky ridgeBOT
rocky ridgeBOT
#

This corrects the FCFB address on RT1060.
The RT1060 expects the FCFB at 0x0. The existing code places it at 0x400, but does not overwrite 0x0 - 0x400, so if an image was loaded there previously with a valid FCFB it would work anyway.
This also moves the double tap to LPGPR which works better with the POR button SW3 on the RT1060 EVK, but the timing for the POR button is sensitive because the delay after releasing the button is longer than SW9.

rocky ridgeBOT
#

In looking at the stm32f411ce datasheet, there are 7 flash sectors.

Sector 0 0x0800 0000 - 0x0800 3FFF 16 Kbytes
Sector 1 0x0800 4000 - 0x0800 7FFF 16 Kbytes
Sector 2 0x0800 8000 - 0x0800 BFFF 16 Kbytes
Sector 3 0x0800 C000 - 0x0800 FFFF 16 Kbytes
Sector 4 0x0801 0000 - 0x0801 FFFF 64 Kbytes
Sector 5 0x0802 0000 - 0x0803 FFFF 128 Kbytes
Sector 6 0x0804 0000 - 0x0805 FFFF 128 Kbytes
Sector 7 0x0806 0000 - 0x0807 FFFF 128 Kbytes

I updated the board.h file and re-ran but no improvem...

rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
#

I programmed various values into 0x8010000, and then did a drag-n-drop of the new uf2 file to see if the bootloader would at least erase the 0x8010000 sector... it did not get erased. I am certain that this is a valid uf2 file (it was created using the python tool, and that same tool has made successful uf2 files for the samd21). Is there a jlink logger that I can enable to help see where the first problem is occuring?

rocky ridgeBOT
rocky ridgeBOT
#

With LOG=1 no errors are reported. With LOG=2 I am definitely seeing the logfile reacting to the new UF2 file drag-n-drop. As no errors are being reported, I am assuming that the flash erase is the issue (as I can have random values at 0x8010000 and they are never erased). If the UF2 file had a problem with size or formatting, I would hope that with LOG=1 something would have been indicated.

rocky ridgeBOT
rocky ridgeBOT
#

Hello, I think I figured out something in regards to this. I hooked up a project that used a bme280 and pm25 sensor (to a MagTag). It always worked fine when I initialized the pm25 sensor first, but failed as described when I did the bme280 sensor. I noticed in the library that the main difference between the init of the drivers is the pm25 is attempted to be probed multiple times and the bme280 is attempted to only be probed once. I made a local change in my bme280 lib to attempt multiple ti...

rocky ridgeBOT
rocky ridgeBOT
jolly fulcrum
#

Hi all. I'm running into a weird problem with a custom board with an ESP32-S2-WROVER-I on it, with 4MB flash and 2MB PSRAM. I'm able to put the ESP into DFU mode (holding down Boot0 button while plugging it in, as well as get it to flash with firmware using esptool.py as per the instructions provided in the README, but whenever I click the reboot pin to load it, nothing happens - no boot drive shows up, and even the /dev/tty.usbmodem01 in my devices list goes away, until I reset it with Boot0 held down again.

I mostly used the Metro ESP32-S2 board as a reference, so there's nothing too funky going on with pin assignments. I'm wondering if I'm just missing a step somewhere.

Has anyone else experienced this before?

sinful patrol
#

@jolly fulcrum it can be very helpful to have a serial to usb converter on the uart. the bootrom will spit out messages about what it's doing there

jolly fulcrum
#

Ah, I did actually split out the UART pins, thankfully. I'll try that, thank you!

jolly fulcrum
#

Solved it. Turned out to be an analog problem. I was using the wrong reverse-protection diode for my VBUS which was severely undervolting the ESP32-S2. Apparently, the bootrom will turn on and even let you flash it at +2V, but will cut out once it tries to load the stage 2 bootloader.

#

Replaced it and everything works great now.

rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
#

Affects the size of the FAT table (each entry points to a cluster, not to a sector), so the FAT table is smaller with a larger sector per cluster value. Affects the generation of FAT table entries (clusters instead of sectors.)

Affects the size of the text files. Each file takes a cluster at minimum, not a sector. This affects the offset of the current.uf2 file.

Writing is not affected.

rocky ridgeBOT
#

to be honest, I am not FAT expert. This file is single handed by @henrygab to increase the capacity from 8MB to 32MB. Which is already large enough for bootloader. The changes look great to me and it shouldn't affect existing port with CFG_UF2_SECTORS_PER_CLUSTER =1 Therefore it is good for a merge.

Out of curiosity, what is your setup/platform that requires a much larger storage for firmware ?

#

FAT16 is relatively simple.

  • Header (the struct with all the size values)
  • FAT (just a big array of uint16, one for each cluster - a cluster is just a combined bunch of physical sectors to reduce the size of this array (and speed up allocation) - the value of the uint16 is either empty, EOF, or pointing to the next cluster of the file)
  • Root directory (just an array of file entries, one or more sectors, can be smaller than a cluster)
  • Data (the clusters, may also contain directories, ...
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
#

@kaetemi ... I listed the wrong PR... mine WIP PR is #84. Would appreciate if you could try out the changes from my PR. The changes pass the automated builds.

FYI, I think your changes had some unexpected results, including effectively duplicating the small files' data (first sector per cluster) on all the other sectors of that same cluster. Not visible from the file system, but visible from a dump of the volume.

I think my PR addresses all the above items. Let me know if you agree....

#

Clarifies various sections of code.
Fixes a few bugs.
Enhanced long-term maintainability.

Most significantly, this enhances the consistent use of terms "sector" vs. "Cluster Number" vs. "Cluster Index".

  • Sector refers to the sector, relative to the BPB.
    • If the media is partitioned, this is the sector offset within the partition.
    • For unpartitioned media, the sector is equivalent to the logical block address (LBA).
  • Cluster Number is what FAT defines as the same term....
rocky ridgeBOT
#

I lost that wrapper code. Maybe, if @hathach agrees, I can create a proper stub that generates well-defined patterns of data via board_flash_read() and dumps the full volume... with the goal of allowing automated testing of this ghostfat code (by generating images and running custom comparison that excludes directory entry date/time stamp changes).

Thank you @henrygab for taking a deep look at this PR, I am totally clueless. For the stub, sure, you could just put it somewhere in the ghos...

rocky ridgeBOT
#

Thanks for the great PR as usual. The rename make everything clearer. I have tried it on esp32s2, however, seem like the v value at line 282 is mis-computed at bit. Here is what I got in the dmesg

[337632.000452] sd 6:0:0:0: [sda] Attached SCSI removable disk
[337632.553736] FAT-fs (sda): error, fat_bmap_cluster: request beyond EOF (i_pos 8275)
[337632.553741] FAT-fs (sda): Filesystem has been set read-only
[337632.553748] FAT-fs (sda): error, fat_bmap_cluster: request beyond EOF...
rocky ridgeBOT
rocky ridgeBOT
#

Seems to work with the following patches applied.

@@ -171,8 +171,8 @@ STATIC_ASSERT( CLUSTER_COUNT >= 0x1015 && CLUSTER_COUNT < 0xFFD5 );
                             ((UF2_SECTOR_COUNT % BPB_SECTORS_PER_CLUSTER) ? 1 : 0))
 #define UF2_BYTE_COUNT     (UF2_SECTOR_COUNT * BPB_SECTOR_SIZE) // always a multiple of sector size, per UF2 spec
 
-#define UF2_FIRST_CLUSTER_NUMBER ((NUM_FILES + 1 + 2))
-#define UF2_LAST_CLUSTER_NUMBER  (UF2_FIRST_CLUSTER_NUMBER + UF2_CLUSTER_COUNT - 1...
rocky ridgeBOT
#

@kaetemi , Wow! Thank you for finding a workaround and code that appears to work.

I am confused by the use of the UF2_FIRST_CLUSTER_INDEX macros causing this to work here. I am therefore not entirely comfortable with this first part of the patch (yet).

The first for setting uint32_t v = (sectionRelativeSector * FAT_ENTRIES_PER_SECTOR) + i; is 100% spot-on. This was my error, and both yourself and @hathach noted the correct fix for this line.

I think I will have to rewrite the wr...

rocky ridgeBOT
rocky ridgeBOT
#
  • Esp32s2 increase flash cache from 4K to 64KB. This allow esp to use block erase instead of sector erase and gain 2x
    speed flashing
  • Also skip erase & write if contents already matches.
Before PR

written 1249536 bytes in 19.38 seconds.
Speed : 64.48 KB/s

After PR

written 1249536 bytes in 9.69 seconds.
Speed : 128.95 KB/s
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
#

Oh.

((NUM_FILES + 1))

NUM_FILES is 3, it includes the UF2 file. Then the +1 already makes this the cluster number.

So patch should just be...

                             ((UF2_SECTOR_COUNT % BPB_SECTORS_PER_CLUSTER) ? 1 : 0))
 #define UF2_BYTE_COUNT     (UF2_SECTOR_COUNT * BPB_SECTOR_SIZE) // always a multiple of sector size, per UF2 spec
 
-#define UF2_FIRST_CLUSTER_NUMBER ((NUM_FILES + 1 + 2))
+#define UF2_FIRST_CLUSTER_NUMBER ((NUM_FILES + 1))
 #define...
rocky ridgeBOT
#

@kaetemi -- well done, well done indeed! Yes, the issue was that NUM_FILES included the UF2 file, and thus the calculation of v was off ... by exactly two. It was simply coincidence that it matched FAT's cluster number offset.

Text files are repeating themselves through the whole cluster, but it's not really an issue.

Really? I thought I already included a fix for that. If any file was more than 512 bytes, it would cause ghostfat to crash when reading that file's sector, so th...

rocky ridgeBOT
#

@kaetemi / @hathach -- I've marked this PR as ready for review. I must rely on your testing for now (I don't have any testing setup currently), but based on early results, it seems now fully functional.

TODO: Would be good to have a few "fake" boards that exercise multi-cluster and some additional options (e.g., a non-UF2 file that is > 512 bytes in size).

rocky ridgeBOT
#

Currently (at least, for me) the reset of the board is always causing Windows to report a write error (which is not very user friendly) when the file is finished uploading.

Deferring the reset, until after tud_task has completed, appears to solve this.

(It does not fix the write error case when multiple firmware families are concatenated in a single file, though. Is there any mechanism to request a safe eject from the OS?)

rocky ridgeBOT
#

hmm that is weird, the while(1) {} I added in recent commit is to solve this issue. Look like it indeed cause the issue. Without the while(1) at tud_msc_write10_complete_cb(). Will the issue occur with your setup ?

My reason is that tud_msc_write10_complete_cb() is invoked after WRITE10 is complete, returned from that function will allow tinyusb stack to queue and receive more SCSI command, and board reset could occur before device response and cause the error. Maybe OS expect device...

rocky ridgeBOT
#

TODO: Would be good to have a few "fake" boards that exercise multi-cluster and some additional options (e.g., a non-UF2 file that is > 512 bytes in size).

To be honest, I am not sure what is best way to make fake boards/ports, for non-UF2 may be @kaetemi can help with that by filling the info file with bunch of texts as long as its contents is less than 1 cluster :)

rocky ridgeBOT
#

@hathach -- I have confirmed from @kaetemi 's dump files the following:

  1. FAT generated for both appears accurate.
  2. Large clusters (32k) no longer causes duplicated data in entire cluster.

@hathach -- I think this is ready to be merged. However, as I submitted this PR, I will wait for you (or another contributor) to approve and merge.

#

My reason is that tud_msc_write10_complete_cb() is invoked after WRITE10 is complete, returned from that function will allow tinyusb stack to queue and receive more SCSI command, and board reset could occur before device response and cause the error. Maybe OS expect device to also response with TEST UNIT READY after WRITE10 or something. I will do more in-depth test.

Hmmm. Perhaps even deferring the reset until the main loop has cycled at least once without any commands received, could i...

rocky ridgeBOT
#

Do you have a USB bus trace (or even storage command block level trace), as viewed from the host PC?
(e.g., http://www.bustrace.com/, or other form that can be readily viewed)

There may be interactions caused by deeply rooted architectural decisions in both ghostfat and windows. (note: my windows knowledge is from >10 years ago, so it might be dated).

<details><summary>Random thoughts on potential examples</summary><P/>

<hr>

GhostFAT sets the BPB to indicate it has a uniqu...

#

Is there any mechanism to request a safe eject from the OS?

@kaetemi -- that's an excellent question. you would think that some USB storage device somewhere exposed an "eject button", but my search skills couldn't find any suggestion that this was the case.

It would be fairly useful for storage devices. Expose an "eject button" (e.g., via HID), and then get notified by the OS in some way that the OS is ready for the device's departure. Of course, the device could disappear at any t...

rocky ridgeBOT
#

@kaetemi ... maybe I'm missing something, but I think there needs to be a way to enable the use of the new >1 sector per cluster support.

For example, shouldn't the following:

https://github.com/adafruit/tinyuf2/blob/15fa707341df119583e5241e3acf91320859be82/src/uf2.h#L45-L47

Be changed to:

#ifndef CFG_UF2_FLASH_SIZE
    #define CFG_UF2_FLASH_SIZE          (4*1024*1024)    // TODO absolute max flash size
#endif
#ifndef CFG_UF2_NUM_BLOCKS
    #define CFG_UF2_NUM_BLOCKS    ...
rocky ridgeBOT
rocky ridgeBOT
#

Does ghostfat (or another part of this stack) ensure that the entirety of the UF2 file has been sent to the device, before it considers the write as being complete?

UF2 contains an ID in each block and the total number of blocks in the "file". When the device got all the blocks it's interested in, it'll happily reset. From the device POV, everything's OK.

But, that block numbering does not actually apply to the whole file either, it only applies to each portion of the UF2 file respect...

rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
#

One option to consider:
After all the needed writes are received, wait until no writes occur for a time (e.g., 1 second?).

We're well into "hack" territory here.

As to prevent/allow medium removal ... that command only applies to devices with removable media. CDROMs, Iomega ZIP / JAZZ drives, etc. Here, the UF2 device is removable, not the media in the device, so it doesn't apply.

rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
#

@kaetemi please try to use the tinyusb that is included with this repo, that's way we are testing the same software. There are lots of improvement for rp2040 in latest release https://github.com/hathach/tinyusb/releases/tag/0.9.0 . I will also bump up tinyusb version for this repo soon as well.

To be honest, this walk-around isn't look good to me. It delay the reset a bit (probably enough to response with TEST_UNIT ready) and could have timing/race condition. We should reset at the right ...

rocky ridgeBOT
#

Here's the logs I'm getting, two variations. (With this workaround enabled, and some extra prints added.)

tud_msc_write10_cb 0, 66181, 0, 2000f7d4, 4096
Write firmware addr 0x0
Write firmware addr 0x100
Write firmware addr 0x200
Write firmware addr 0x300
Write firmware addr 0x400
Write firmware addr 0x500
Write firmware addr 0x600
Write firmware addr 0x700
  Queue EP 01 with 4096 bytes ... OK
USBD Xfer Complete on EP 01 with 4096 bytes 
  MSC xfer callback
  SCSI Data
tud...
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
#
#define CFG_UF2_FLASH_SIZE          (256*1024*1024)
#define CFG_UF2_NUM_BLOCKS          (0x300000)       // 1.5 GB
#define CFG_UF2_SECTORS_PER_CLUSTER (64)

That's for 256MB flash, so 2x a 512MB UF2 file, and plenty for space remaining for the two text files (or for the remainder of a UF2 file with non-flash content).

Tested on RP2040, for flashing BT815-series graphics chip. (Maybe add a note on the memory required for the buffer that keeps the written block flags... `CFG_UF...

rocky ridgeBOT
#
#define CFG_UF2_FLASH_SIZE          (256*1024*1024)
#define CFG_UF2_NUM_BLOCKS          (0x300000)       // 1.5 GB
#define CFG_UF2_SECTORS_PER_CLUSTER (64)

That's for 256MB flash, so 2x a 512MB UF2 file, and plenty for space remaining for the two text files (or for the remainder of a UF2 file with non-flash content).

Tested on RP2040, for flashing BT815-series graphics chip. (Maybe add a note on the memory required for the buffer that keeps the written bloc...

rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
#

GhostFAT requires unit tests

GhostFAT is quite complex (file systems are inherently complex), and is critical functionality relied upon for updating devices. As seen with the RPi Pico, sometimes it even gets burned into ROM.

The need to validate GhostFAT is thus critical. However, today this is an extremely manual process.

For example, validation that it generates a correct file system:

  • Build bootloader with all substantial variations (base, >1 sector per cluster, various siz...
rocky ridgeBOT
#

I researched the "why" a bit and found:

POSIX doesn't define -p or -i. In GNU coreutils they are marked as non-portable, as you indicate; the default implementation relies on two optional operating system features, the three-argument form of sysinfo(2) (from SunOS) and the six-argument form of sysctl(3) (from the BSDs; neither of which are available on Linux).

Thus on Debian and derived distributions (apart from Ubuntu and its derivatives), you simply get unknown.

O...

rocky ridgeBOT
rocky ridgeBOT
#

The goal of this branch is to enable, as part of the normal build process, validation of GhostFat image generation.

  • [x] Create framework to execute own custom test_main() function, using existing code
  • [x] Ensure ghostfat initialization completes prior to calling test_main()
  • [x] Generate disk image file from test_main()
  • [ ] Validate bit-for-bit accuracy of disk image file from test_main()
  • [x] Use common framework code for variations of desired file system image
  • [ ] ...
rocky ridgeBOT
#

@hathach -- Can you help with two things?

  1. Getting this to compile in the CI builds
  2. Getting the compiled , and ensuring CI will execute the resulting binary.

Compilation:

On my Ubuntu system, to make the test ports compile requires removing two options from make.mk and rules.mk:

https://github.com/adafruit/tinyuf2/blob/54cff8b6a2c84f2ea944d5df27fd5099763d3674/ports/make.mk#L136-L137

https://github.com/adafruit/tinyuf2/blob/54cff8b6a2c84f2ea944d5df27fd5099763d3674/p...

rocky ridgeBOT
#

See PR #94 for file system validation solution.

At time of writing, code is written that:

  1. Defines a "port" called test_ghostfat
  2. Defines various boards under that port which exercise different ghostfat configuration (clusters per sectors, flash size)
  3. Compiles executable that is native to the build environment
  4. Each build outputs a file "ghostfat.img"
  5. Each build attempts to validate "ghostfat.img" against "knowngood.img"

In short, it's essentially written, except for th...

rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
#

thanks @henrygab very comprehensive, I always admire your passionate and effort put into PRs. This is a great idea, we can also include this test in the CI to make sure we won't break it while refactoring. Normally I would use Ceedling/CMock/Unity for testing since mocking/faking hardware make it easier to test with. Though please continue with your great work, later on I will try to see if I could use part of them as unit test :)

rocky ridgeBOT
#

Use bootmode from SRC->SBMR2 to determine whether we are in Serial Download mode. If so write the tinyuf2 image to flash. So basically everytime SDPHost is uesd, it will write contents to flash. This works better as

  • recovery method or when reworking components swapping mcu and/or flash chip.
  • prototyping/simulate other boards e.g using evk board without actually drag & drop uf2 once loaded via SDP
  • At worse, user load SDP with the same image on flash, the write caching will compare w...
rocky ridgeBOT
#

various modification to optimize ci

  • local copy of CMSIS_5 mostly for header
  • local copy of micro_cc in IDF bootloader
  • cache toolchain for arm gcc
  • optimize submodule fetch for esp32s2 ci

There is still more to optimize such as only fetch needed submodule i.e nxp submodule for imxrt build, st for stm32f4 build etc... but that is for another PR. It is good enough for now.

rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
#

I've been noodling on this and I think we can add this function to the same standard bootloader image so that you can make it erase or force an overwrite when you load it. We can add a tiny image that sets a flag and then jumps to the main image so you can pick the behavior by the jump address. Or, has anyone considered adding USB CDC commands for erasing? That would be more cross platform.

rocky ridgeBOT
#

@nxf58843 thanks, regardless, I have added the PR for this https://github.com/adafruit/tinyuf2/pull/101 . Although it is technically not bootloader, but it is nice to have. I plan to generalize it so basically we will have 3 buidable binaries in this repo

  • tinyuf2 bootloader (itself)
  • self-udpate: for iMX RT it is actually the tinyuf2 itself. For other ports, it is an application than update the bootloader
  • erase-app / nuke: to erase application firmware flash (factory reset), or even b...
#

sdphost also has a write register command. We could use that to set flags that configure the behavior before jumping. That would be simpler and save generating multiple images. We could also specify what to erase (bl, app, everything) that way. Only check the flags for sdp mode.

Yeah, I just think of this before seeing your reply. Therefore both app and sdphost can "execute" it. Also I was thinking for all other ports as well :)

rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
#

This PR add

  • ground work for erase_firmware-BOARD.uf2 for all ports
  • new board API: board_reset() and board_flash_erase_app()
  • add erase_firmware as std application that reset board with MAGIC ERASE_APP
  • IMXRT implement board_flash_erase_app() add makefile to support erase_firmware. For iMXRT it is much quicker to perform chip erase and re-write bootloader from sram to flash. (sector/block erase probably takes longer).
  • erase_firmware-BOARD.uf2 is also uploaded as ci artifact/r...
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
#

Collapsing to reduce thread length
@hathach -- Can you help with two things?

  1. Getting this to compile in the CI builds
  2. Getting the compiled , and ensuring CI will execute the resulting binary.

Compilation:

On my Ubuntu system, to make the test ports compile requires removing two options from make.mk and rules.mk:

https://github.com/adafruit/tinyuf2/blob/54cff8b6a2c84f2ea944d5df27fd5099763d3674/ports/make.mk#L136-L137

https://github.com/adaf...

rocky ridgeBOT
rocky ridgeBOT
#

OK, this is ready for review. See success in checks from commit deae8ca ... listing the four GhostFAT code compiling, comparing against known-good images, and even ignoring the two very narrow exceptions required.

<details><summary>Two exceptions detailed</summary><P/>

Two variations allowed from the known good file system:

  1. Contents of UF2_INFO.TXT file will have a variable-length s...
rocky ridgeBOT
#

follow up to #94 to separate native build tests from cross-compile (for target hardware). NO_TINYUF2_BUILD is used for this purpose (along with SKIP_NANOLIB, some later ports especially non-ARM may skip this lib later on). NO_TINYUF2_BUILD introduced in recent PR to allow make.mk and rule.mk to build other executable image such as erase_firmware (will also migrate self_update later on).

Eventually, test_ghostfat/main.c run on its own and interact with a small subset of board_api, thos...

rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
#

I'm trying to create a custom bootloader for my board but when I run the make script I keep getting an error that the esp_rom_gpio.h is not found.

Am I missing something?

I saw a similar ticket from @UnexpectedMaker related to this that was closed but his issue was resolved by rebooting his machine, I tried that, and is not helping.

Any help will be greatly appreciated.

FAILED: esp-idf/boards/CMakeFiles/__idf_boards.dir/board...
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
#
  • Refactor build system to allow building useful applications such as erase_firmware, self-update, esp32programmer. Although they are not considered as part of bootloader, they are useful for production/recovery purpose. Put it in this repo allow to use the current board_api abstraction easily. These should not be used for complicated application though.
  • Separate NO_TINYUF2_BUILD into BUILD_APPLICATION and BUILD_NO_TINYUSB` (some app may still use tinyusb)
  • Add esp32programmer app f...
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
sonic vortex
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
#

Hi, I am attempting to integrate TinyUF2 into an existing bootloader on custom SAME54 board. Here are my issues,
A) I want to add 2 channels of CDC, and although I can get them to run when only using TinyUSB, I cant make them function as part of TinyUF2 despite the config option to include CDC. I believe its a config/enumeration issue.
B) The board will be enclosed in a box so I need the CDC channels to communicate with the board, as it does not have any user buttons, to start the upgrade p...

rocky ridgeBOT
#

Hi, I am attempting to integrate TinyUF2 into an existing bootloader on custom SAME54 board. Here are my issues,
A) I want to add 2 channels of CDC, and although I can get them to run when only using TinyUSB, I cant make them function as part of TinyUF2 despite the config option to include CDC. I believe its a config/enumeration issue.

It is hard to comment without the actual code, could you make an PR to add SAME54 port. That would make it easier to analyze problem. Also that would s...

rocky ridgeBOT
#

A Discord discussion led me to want the ability to have something like CURRENT.UF2, but contained both the current version of CircuitPython and the contents of the CP filesystem (code.py, lib, etc)

Would it even be possible for this hypothetical EVERYTHING.UF2 virtual file to be created? I know this is outside of the purview of the bootloader, but if the bootloader takes an entire snapshot of all known flashes and restores them, would it work?

rocky ridgeBOT
rocky ridgeBOT
#

Platform-independent still need port specific implementation to pull this off.

  • SAMD is not supported by this repo, you should check out its implementation at https://github.com/adafruit/uf2-samdx1 and/or https://github.com/microsoft/uf2-samdx1
  • ESP32S2 currently only support the actual firmware since its flash is partitioned, and the filesystem is placed on a separated parition. Having EVERYTHING.UF2 is possible, though current implementation limit the flash write to only 1 app partition...
rocky ridgeBOT
rocky ridgeBOT
#

While the increased speed of copying is a really welcome change in 4.0, I am experiencing boards (FeatherS2 and TinyS2) that don't copy properly and don't re-mount afterwards - both flashing/copying on macOS and on raspberrypi os.

Often a board that fails multiple times in a row with v4 can be fixed by erasing it's flash and then a re-flash with v3 UF2, and then it works ok again. Note, erasing the flash and re-installing v4 doesn't work on these boards, but going back to v3 does.

So fa...

rocky ridgeBOT
#

to be honest, I am not entirely sure, I only test it on the module wroom/wrover, It is probably issue with block erase command. Here is the pr https://github.com/adafruit/tinyuf2/pull/86/files . maybe your flash device need a bit of delay or something. I think the solution for now is adding an flag in your board to skip the block erase and keep using sector erase command so that it could move along with other feature. Feel free to tag me for review when making PR for thi.

rocky ridgeBOT
#

I had a chance to look at this again. I manually programmed data to 0x8010000 so that it was not blank. Ran the RTTViewer with LOG=2 and did a drag-n-drop of the uf2 file. The drag-n-drop now shows a message box that says it is waiting for the write to complete (but hangs). The last RTT log message is "Erase: 08004000 size = 16384". I will insert some more log messages in "board_flash.c" to see if I can identify the code which causes the hang. I did check the HAL_FLASH_Unlock() routine and...

rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
#

After looking at my original uf2 file that I was testing with, it was created with a base address of 0x08000000, which conflicts with the bootloader... I believe this is why sectors below 0x080100000 were getting erased. I manually run the uf2conv.py script now and specify the 0x08010000 as the base address (as confirmed in the following screen capture). There still is no flash write.
Would it not be better/safer to use the APP_LOAD_ADDRESS defined in board_flash.c and ignore the address in ...

rocky ridgeBOT
#

I checked my testing uf2 file again for the expected stm32f4 family_id (as defined in the Makefile) UF2_FAMILY_ID = 0x57755a57... and it was not matching... which explains why no flash writes were happening. I am seeing my expected writes at 0x08010000 now.
Here is my manual uf2 conversion script:
uf2conv.py -o stm32f411blackpill_app.uf2 -b 0x08010000 -f 0x57755a57 stm32f411blackpill_app.bin

Now my issue is that the bootloader is not passing execution to the app at 0x08010000. It is alwa...

rocky ridgeBOT
#

After looking at my app's bin file and the values at 0x08010000, they appear identical (hooray!). I was expecting that the tinyuf2 bootloader would look at the first couple of values at APP_LOAD_ADDRESS to see if it was programmed... and then transfer execution.
Without the double press method, I guess it would be impossible to restart the bootloader and skip the transfer of execution to the app (so that the app could be over-written with a new app).
Does new code need to be written before ...

rocky ridgeBOT
rocky ridgeBOT
#

OK, so sum up, the DFU process is complete, all the binary data is written to correct address. However, bootloader just does not perform jump to app. This is probably easier to fix. Btw, I don't see the f411ce blackpill in the board list, could you make PR to add it, so that I could try to see if there is any issue with the configuration in compare with f411 discovery.

rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
#

block erase

I'd had a look through that PR, but really don't understand it. Def not something I can see my self reverting, sorry.

Can I just change the FLASH_CACHE_SIZE back to 4096?

I don't see how using an ESP32-S2 WROOM/WROVER would be any different to the chips I'm using... My FeatherS2 uses the same S2 & Flash as the WROVER.

How many modules have you tested on? As I mentioned It's failing on around 20-30% - so unless you've tested this on enough modules you could easily be...

rocky ridgeBOT
#

I also just tried creating a branch of release 0.3.0 - to build my TinyS2 UF2 boot loader from that, but I couldn't complete the submodule - keeps failing on nxp, and my git fu is just not good enough to solve why.

So basically I cant deploy CircuitPython on my TinyS2 boards via UF2 - super sad :(

Any guidance you can give me to how to specifically revert the 0.4.0 changes for ESP32-S2 so I can make a working UF2 boot loader, I'd really appreciate it.

rocky ridgeBOT
zealous plover
#

Can we built a fido2 u2f key using rp2040 ie. QtPy or rp pico

rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
#
/mnt/c/workspace/tinyuf2/ports/stm32f4/board_flash.c: In function 'flash_write':
/mnt/c/workspace/tinyuf2/ports/stm32f4/board_flash.c:158:71: warning: cast increases required alignment of target type [-Wcast-align]
  158 |   if (HAL_FLASH_Program(FLASH_TYPEPROGRAM_WORD, dst + i, (uint64_t) (*(uint32_t*)(src + i)) ) != HAL_OK) {
      |                                                                       ^
/mnt/c/workspace/tinyuf2/lib/st/stm32f4xx_hal_driver/Src/stm32f4xx_hal_flash_...
rocky ridgeBOT
rocky ridgeBOT
#

board ID has been corrected in both board.h files, also website has this comment now (// TODO update link)
build.yml abc order has been corrected
VID/PID are from pid.codes but the pull requested has not been made yet

Can you give link to the PR, we will merge once that PR is merged.

ok thanks I will update the pull request with PID.CODES PR link

#

board ID has been corrected in both board.h files, also website has this comment now (// TODO update link)
build.yml abc order has been corrected
VID/PID are from pid.codes but the pull requested has not been made yet

Can you give link to the PR, we will merge once that PR is merged.

ok thanks I will update the pull request with PID.CODES PR link

I mean can you give the link to the PID.CODES PR link here in the comment section, adding it to the c...

rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
#

This PR refactor and clean up romapi for nor flash.

tested and should not ...

rocky ridgeBOT
rocky ridgeBOT
#

Since esp_reset_reason_set_hint() is not working/supported anymore (see: https://github.com/espressif/esp-idf/issues/7230) I decided to rewrite the corresponding code using NVS storage instead.

Please note that this pull request does not work at the moment. There is still a compilation error:

tinyuf2/lib/esp-idf/components/nvs_flash/src/nvs_platform.hpp:31:10: fatal error: freertos/FreeRTOS.h: No such file or directory
 #include "freertos/FreeRTOS.h"
          ^~~~~~~~~~~~~~~~~~~...
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
#

I started porting tinyuf2 (great project!) to the RISC-V GigaDevice GD32VF103 on the Sipeed Longan Nano Board, which has supposedly the same USB OTG peripheral as the STM32F105/107 or STM32F4s. Flash writing and jumping to the application is not possible ATM, but that should be easy to implement. Now to my problem:

So far I got it to boot and enumerate successfully. But it crashes the moment that it tries to mount the ghost fast partition, already the first READ10 command of the boot block...

rocky ridgeBOT
#

you should try to get the stack debug log with LOG=2 to see at which command it failed. Since GD32Vf is a new port, it would be easier if you test it with https://github.com/hathach/tinyusb first to see if all stock example work to verify it is not the tinyusb stack issue. I think I have this GD32VF103 somewhere in my drawer as well, if you submit an PR to add BSP for it and, I could help to troubleshoot if it is indeed usb stack issue.

rocky ridgeBOT
civic wyvern
#

Is the weact blackpill port for this project in a state where it's possible to compile a CP image to UF2 and flash it yet?

rocky ridgeBOT
#

Hi folks, I realised I never reported back here - super sorry.
So I did have to set my cache size back to 4096 - but that wasn't enough, It was still failing 1 out of every 6-7 times on both my FeatherS2 and TinyS2 and what I found was that I also had to wait 3-5 second's after I copied the CPY.uf2 firmware on, even after it finished copying before I could allow it to remount and that brought me back to 100% reliability.

Because of this pause that I have to do on my test jigs, and no on...

rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
haughty estuary
#

Hello,

I would like some advice for using the tinyuf2 bootloader on a STM32F401CCU6 Blackpill module.
I flashed the tinyuf2-stm32f401_blackpill-0.5.0 firmware on the module, once plugged in I have a "BlackPill" drive which contains "current.uf2", "index.html" and "info_uf2.txt", so everything looks good.

I tried to convert a bin file to UF2 format (the orginal bin works fine when it is flashed directly to address 0x08000000 without the bootlader), for that I used the following command (uf2conv is a Rust crate):
uf2conv firmware.bin -b 0x08010000 -f 0x57755a57
I also tried with the uf2conv.py script provided by Microsoft on the microsoft/uf2 repo:
uf2conv.py firmware.bin -c -b 0x08010000 -f 0x57755a57

I got the chip family id and base address directly from the tinyuf2 port code to be (a bit more) sure of what values ​​to use.

When I copy the generated uf2 file into the bootloader drive, the drive disconnects (looks normal) but instead of booting on my program the bootloader restarts.
I have tried several base address values ​​and the only difference is that sometimes the bootloader cannot be restarted (not surprisingly in case I overwrite the bootloader).

For information I use the same method without problem on Adafruit SAMD21/51 modules.

Do you have any advice or is there an error in my approach?

Thanks a lot for your help !

civic wyvern
#

<never mind, I was commenting about the port of that board with the F411 chip (which is currently known to be nonfunctional). I don't know the status on the F401 version>

rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
#

Just started all over again with following steps:

  • git clone --recurse-submodules https://github.com/adafruit/tinyuf2
  • install.sh
  • cd tinyuf2/ports/esp32s2
  • get_idf
  • idf.py -p /dev/ttyUSB0 -DBOARD=espressif_saola_1_wroom flash
    After this last step I have the UF2 bootloader correctly burned to the module.

Then I created the update-tinyuf2.uf2 for backup:

  • make BOARD=espressif_saola_1_wroom all self-update

To check wheter self-update works or not I created a new...

rocky ridgeBOT
rocky ridgeBOT
#

We now applied all the changes we made before. Unfortunately it still does not work. It gets confusing even more.

One bootloader is the original without changes. The second one should enter UF2 stage when hard resetting the board.

update-tinyuf2-factory.uf2

  • UF2_VOLUME_LABEL: FACTORY
  • tinyuf2 codebase without changes

update-tinyuf2-failover.uf2

  • UF2_VOLUME_LABEL: FOVER
  • tinyuf2 codebase with changes:
    added
if (reset_reason == POWERON_RESET) {
  boot_i...
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
#

I tried to update the boot2 binary with update-uf2, there is a couple of issue

  1. There is a macro check to validate the address, though it is easily by passed by enabling unsafed write https://github.com/espressif/esp-idf/blob/master/components/spi_flash/esp_flash_api.c#L51
  2. There is some meta data required for boot2 bin
Invalid image block, can't boot.
ets_main.c 386 

Digging to esptool.py https://github.com/espressif/esptool/blob/master/esptool.py#L3488, look like it does ...

rocky ridgeBOT
rocky ridgeBOT
#

after giving a bit more thought, I think it is still worth updating, since ROM loader is there to unbrick. However, I don't quite feel comfortable following the esptool code, maybe if someone know where is the specs for the layout. We could get this done. I push my interim work to the branch here https://github.com/adafruit/tinyuf2/tree/esp32s2-update-boot2 . If anyone could help with meta data part, that would nail it.

rocky ridgeBOT
#

Operating System

MacOS

Board

Feather STM32F405 Express

Firmware/Software/Tool Version

TinyUF2 (0.5.0 release): https://github.com/adafruit/tinyuf2/releases/download/0.5.0/tinyuf2-feather_stm32f405_express-0.5.0.zip
CircuitPython (main branch): adafruit/circuitpython@b9fa06cf6bb3c45eaf57724d351a04564d562b6a

What happened ?

I am trying to install CircuitPython on a Feather STM32F405 Express using the TinyUF2 bootloader. When I try to install the CircuitPython firmware...

#

FYI, if I program the UF2 bootloader and the CircuitPython firmware.bin firmware images manually via DFU, the board boots the CircuitPython image without issues:

dfu-util -a 0 --dfuse-address 0x08000000 -D ~/Downloads/tinyuf2-feather_stm32f405_express-0.5.0/tinyuf2-feather_stm32f405_express-0.5.0.bin

dfu-util -a 0 --dfuse-address 0x8010000 -D ports/stm/build-feather_stm32f405_express/firmware.bin

![image](https://user-images.githubusercontent.com/14631/127022022-31fe20ba-...

rocky ridgeBOT
#

hmm, how did you build the circuitpython for f4, You will need to run make and specify UF2_BOOTLAODER=1 to select the linker with bootloader in mind. default linker is no bootloader. The main reason for this, is tinyuf2 project started much later than the circuittpython port of stm. Let me know if you still have issue with it.

make BOARD=feather_stm32f405_express UF2_BOOTLOADER=1
rocky ridgeBOT
rocky ridgeBOT
#

I'm not sure if this will help but here is a copy/paste of my [recent message on adafuit/tinyuf2 discord channel](#tinyuf2 message), the behavior might be related.

I would like some advice for using the tinyuf2 bootloader on a STM32F401CCU6 Blackpill module.
I flashed the tinyuf2-stm32f401_blackpill-0.5.0 firmware on the module, once plugged in I have a "BlackPill" drive which contains "current.uf2", "index.html" and...

rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
#

Thanks for letting me know. I pulled the latest changes and built stm32f411ce_blackpill. I did a chip erase and programmed the new bin file. It booted as a flash drive as expected and I then copied over the uf2 file. I disconnected the USB and connected it again. It booted as a flash drive... so branch execution to the app did not occur. I checked the flash memory in stm32 cube programmer and saw that location 0x08010000 was programmed properly. I am not sure if any STM32 control registers ne...

rocky ridgeBOT
#
  1. @charkster could tell me more about the application you are compiling, please make sure you compile with linker script starting from 0x08010000 (instead of 0x08000000 then shift it with uf2, I am not so sure, it may not be the same).
  2. Also please try with a super simple app such as blinky just for verification first.
  3. Could you provide your uf2, I will try to test to see if I could spot something unusual. Note: preferably an simply blinky with correct address as mention in 1 and 2
rocky ridgeBOT
#

@hathach 1. I am using the TINYUSB example (USBTMC device). I had been using the uf2 make option, but it is reporting that it is using 0x08000000. I updated STM32F411CEUx_FLASH.ld to use 0x08010000.
FLASH (rx) : ORIGIN = 0x08010000, LENGTH = 512K
After using this file, it appears that execution was transferred to the app. The app did not work correctly, but it did not appear as a flash drive any more.
I believe I can close this issue, as the bootloader is working. Maybe my apps are ...

rocky ridgeBOT
rocky ridgeBOT
#

Draft PR to allow boot2 stage update for esp32s2. I have tried to update the boot2 binary with update-uf2, there is a couple of issue

  1. There is a macro check to validate the address, though it is easily by passed by enabling unsafed write https://github.com/espressif/esp-idf/blob/master/components/spi_flash/esp_flash_api.c#L51
  2. There is some meta data required for boot2 bin
Invalid image block, can't boot.
ets_main.c 386 

Digging to esptool.py https://github.com/espressif/e...

rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT
rocky ridgeBOT