#tinyuf2
1 messages · Page 3 of 1
Any guidance for debugging MSC configuration issues? I'm working on a new port and the drive does not appear. Looks like some MSC control transfers are stalling based on the logs
The code is here https://github.com/nxf58843/tinyuf2/tree/feature-k32l2
Log level 1:
TinyUF2
Start DFU mode
DCD XFER fail 0 0 40 80088
usbd_control_xfer_cb 216: ASSERT FAILED
Log level 2 is busy, but here is where it looks suspicious
USBD Setup Received 80 06 05 03 09 04 10 00
Get Descriptor String[5]
Queue EP 80 with 16 bytes ...
USBD Xfer Complete on EP 80 with 16 bytes
Queue EP 00 with 0 bytes ...
USBD Xfer Complete on EP 00 with 0 bytes
USBD Setup Received A1 21 00 00 00 00 07 00
MSC control request
Stall EP0
USBD Setup Received 21 22 00 00 00 00 00 00
MSC control request
Stall EP0
USBD Setup Received 21 20 00 00 00 00 07 00
MSC control request
Stall EP0
USBD Setup Received A1 21 00 00 00 00 07 00
MSC control request
Stall EP0
USBD Setup Received 21 0A 00 00 01 00 00 00
HID control request
Queue EP 80 with 0 bytes ...
USBD Xfer Complete on EP 80 with 0 bytes
@nocturne trench my guess is that the stall occurs because the data read in is wrong
(I highly recommend having a beagle usb sniffer when debugging usb)
I've got a Luna on order. I'll take another look at the reads.
Includes Espressif-assigned PID for "Lolin S2 Mini - UF2 Bootloader".
Apologies for not running a test build to catch the ifndef/endif; test build has been run on these changes.
While we're testing firmware bring-up on this board (CircuitPython), it will be very handy to use a wired-up NeoPixel. I can later remove it from board.h.
Apologies for not running a test build to catch the ifndef/endif; test build has been run on these changes.
While we're testing firmware bring-up on this board (CircuitPython), it will be very handy to use a wired-up NeoPixel. I can later remove it from board.h.
Sounds fine. You should probably add the LED that is on the board to the board.h file. It does provide feedback when in UF2 mode (a breathing/pulsing)
I have built and tested tinyuf2 and circuitpython and both w...
Nice catch. Made that change.
include guard is required for all header files (check out review)
Apologies for not running a test build to catch the ifndef/endif; test build has been run on these changes.
While we're testing firmware bring-up on this board (CircuitPython), it will be very handy to use a wired-up NeoPixel. I can later remove it from board.h.
If the board does not come with neopixel in production, please comment out these line, you could keep an local modified copy for testing.
look great, thank you for your PR
f60d484 Add board Lolin S2 Mini - durapensa
d595df0 Add board Lolin S2 Mini - fix compile error in ... - durapensa
4c1b934 Add board Lolin S2 Mini - fix for onboard LED i... - durapensa
0eb4dac Add board Lolin S2 Mini - add pragma in board.h - durapensa
56d34a4 Add board Lolin S2 Mini - comment out NeoPixel ... - durapensa
Can verify the S2 Mini tinyuf2 build works on actual hardware (which is just now starting to arrive for early orders, @jade solar and @obtuse wraith still haven't gotten theirs yet as far as I'm aware)
still waiting on my board to arrive. do you know the process for the s2mini-built tinyuf2 to be incorporated into the .BIN download at https://circuitpython.org/board/lolin_s2_mini/ ? (makermelissa added the board today in a big pr. And flashing instructions?
I came across the Adafruit Funhouse guide at https://learn.adafruit.com/adafruit-funhouse/install-uf2-bootloader which includes a link to an Adafruit-hosted WebSerial tool; if we can make a lolin_s2_mini_tinyuf2_combo.bin file, it should ease flashing & instruction writing considerably.
Found the answer in https://github.com/adafruit/tinyuf2/blob/0.5.1/.github/workflows/build_esp32.yml
I'm trying to add support for WeAct MiniSTM32H7xx
The device has 128K internal flash and 8MB QSPI flash and I cannot figure out how to implement flash routines to accommodate all the flash memories.
Pending
- [ ] board_self_update
- [ ] board_flash_erase_app
- [ ] board_flash_write
- [ ] board_flash_read
- [ ] board_flash_flush
- [ ] board_flash_init
- [ ] board_flash_size
- [ ] board_app_valid
tinyusb enumeration and display works but...
thank you for your effort along with the pending list. For external flash partition make sure you follow the circuitpython stm32 partition scheme https://github.com/adafruit/circuitpython/tree/main/ports/stm/boards . It will require qspi driver to flash external flash, a new port may take quite a bit of time. I will try to help whenever I could
I would appreciate any help I can get.
For external flash partition make sure you follow the circuitpython stm32 partition scheme https://github.com/adafruit/circuitpython/tree/main/ports/stm/boards
Looking at the circuitpython repo, I am still quite unsure of what the stm32 partition scheme is and how it would affect tinyuf2. I'm going to try and get the QSPI and SPI memories working first and then continue with the backlog. Ideally I would want all of the memory devices to be avai...
@petejohanson when I copy a zephyr generated uf2 file to blackpill 401 flashed with tinyuf2 bootloader it seems to somehow overwrite the bootloader as the copied uf2 nor the bootloader seems to work anymore until I flash the bootloader again with stlink.
Any idea what might be going on?
@petejohanson when I copy a zephyr generated uf2 file to blackpill 401 flashed with tinyuf2 bootloader it seems to somehow overwrite the bootloader as the copied uf2 nor the bootloader seems to work anymore until I flash the bootloader again with stlink.
Any idea what might be going on?
The key thing is to update the board definition (or add an overlay to do so), that adds the right flash partition layout to account for the bootloader. Example here: https://github.com/petejohanson/zmk...
@petejohanson many thanks for the detailed steps. I am using the latest Zephyr and made the changes you have suggested and build it after deleting the build folder. The uf2 bootloader is not getting overwritten anymore, which is a step forward.
However the code also does not seem to be running - I am building the sample/basic/blinky from the zephyr.
Will a new release for TinyUF2 happen before CircuitPython 7.0.0? Asking because of the new ESP32-S2 boards.
@petejohanson many thanks for the detailed steps. I am using the latest Zephyr and made the changes you have suggested and build it after deleting the build folder. The uf2 bootloader is not getting overwritten anymore, which is a step forward.
However the code also does not seem to be running - I am building the sample/basic/blinky from the zephyr.
Very odd. Can you post a gist w/ the final .config you end up with?
@jade solar is there a reason to do it? I thought they were separate
for users of the ESP32-S2 boards released since July 30, there's no available TinyUF2 firmware (for some it was factory installed)
having it available makes first-time use easier (i.e. need to use esptool, command line or web, only once, then all other CircuitPython upgrades are via UF2)
I can make an issue if that would help
ya, I think so. thach would do the release
okay, will do.
Disussed with @tannewt on Discord, would be useful to have precompiled TinyUF2 binaries for the new boards since TinyUF2 0.5.1 (Morph esp240, Lolin S2 Mini, & Espressif HMI devkit), to coincide with the upcoming CircuitPython 7.0.0 release.
Same could be done for uf2-samdx1 for the Proximity Trinkey (for the case of repairing a damaged/overwritten UF2 bootloader, like the in the MagTag & FunHouse guides)
I am not sure if this is technically possible but it would be very useful since it is a very popular board.
Are you aware of this project? tinyuf2 on an f103 probably wouldn't leave enough user space to be useful for anything.
@petejohanson here is the config https://gist.github.com/pathnirvana/9a9d2f7ac6432b8b4b43d6865397a000
Many thanks for helping me with this.
Operating System
Linux
INFO_UF2.TXT
TinyUF2 Bootloader 0.5.2 - tinyusb (0.10.1-109-g9b3ec69b)
Model: Lolin S2 Mini
Board-ID: ESP32S2FN4R2-S2Mini-1-0-0
Date: Sep 8 2021
What happened ?
When writing update-tinyuf2-lolin_s2_mini-0.5.2.uf2, OS reports WRITE I/O error, seemingly because of USB disconnect.
Board resets back to UF2 bootloader mode, with previously flashed firmware gone (user_fs FAT partitions seems okay).
Related #138 ?
How to reproduce ...
Regardless of the os error, was the upgrade complete successfully ?
Added support for onboard neopixel that has its power control via the TCA9554
thank you for your PR, I don't have this board to test with, but it looks good. IR_RGB_CTRL is connected to P6 of TCA9554. Though i have a question during the boot2 stage, it will try to turn on the neopixel purple to indicate double reset, would that work as well (I guess not).

True, the PERI_POWER is not enabled during boot2. I may look at that but am more interested in getting the display working. My test board display has actually stopped working so NEOPIXEL came to the front. Thanks for looking at this.
I have added SPI and QSPI W25Qx drivers from the MiniSTM32H7xx repository. Still in early stages but you can somewhat load code into the QSPI memory and jump to it. I tried loading a simply blinky program to the QSPI flash. The interrupts seem to break after jumping to the QSPI code.
- Implemented:
board_flash_initwhich initializes the SPI flash and disables memory mapped mode on the QSPI flash to allow writes - Implemented:
board_flash_sizereturns 8MB. (Even though the total flas...
True, the PERI_POWER is not enabled during boot2. I may look at that but am more interested in getting the display working. My test board display has actually stopped working so NEOPIXEL came to the front. Thanks for looking at this.
thank for confirmation with boot2, this is still good to merge.
thank you for your PR, look good
Having an issue on a ESP32S2 with CircuitPython not flashing properly, can anyone familiar with TinyUF2 lend a hand?
update.uf2 files are not currently working on ESP32-S2 boards. Oh.
CircuitPython /should/ flash okay, it's tinyuf2-update.uf2 that warning's about. What steps do you take to flash CircuitPython?
I'm using esptool 3.1 on windows @ 115200 baudrate
Is that to flash a circuitpython.bin or a TinyUF2 combined.bin?
"adafruit-circuitpython-lilygo_ttgo_t8_s2_st7789-en_US-6.3.0.bin" not the UF2 combined.bin
And what's the error or fail mode?
note that CircuitPython expects a fat partition to store files, including code.py & any added libraries. TinyUF2's combined.bin provides that fat partition.
The flash command should be something like
Where COMn is whatever your board comes up as.
Board should be put in bootloader mode first
Hi @hathach :)
I'm working on ESP32-S3 support for CPY and that means we'll also need support for S3 in TinyUF2 and that requires being on the latest master IDF branch - 4.4.bleeeeeeeeeding edge, and we'll also need to stay updated often.
I'm happy to do the work on this, but I wanted to check it's ok before I start as it may need a substantial change like CPY needed - where we seperate esp32s2 and esp32s3 stuff into partitioned folders.
So can you all let me know if there is a pre...
Hi @hathach :)
I'm working on ESP32-S3 support for CPY and that means we'll also need support for S3 in TinyUF2 and that requires being on the latest master IDF branch - 4.4.bleeeeeeeeeding edge, and we'll also need to stay updated often.
That is great to hear, which branch/tag IDF you plan to make an upgrade, there is an new 4.3.1 which is released just a week ago. Once tested locally, please make PR to update IDF as standalone, it help to get it merged quickly.
I'm happy to...
That is great to hear, which branch/tag IDF you plan to make an upgrade, there is an new 4.3.1 which is released just a week ago. Once tested locally, please make PR to update IDF as standalone, it help to get it merged quickly.
It has to be latest master (4.4-dev), and it will need to kept updated constantly as work on the S3 IDF stuff continues.
S2 is also working fine in 4.4-dev - The CPY work I've done moved S2 to IDF 4.4-dev as well.
For folder changed, there is 2 ways w...
It has to be latest master (4.4-dev), and it will need to kept updated constantly as work on the S3 IDF stuff continues.
S2 is also working fine in 4.4-dev - The CPY work I've done moved S2 to IDF 4.4-dev as well.
I have no issue with latest maser, though I still prefer to stick with tag/release since bootloader doesn't use much from IDF, mostly its peripherals and soc driver only. Anyway, please do update to whatever version that would work, eventual we will have an release/tag that wo...
Added support for I2C TCA9554 peripheral power control during the boot2 phase.
Uses software I2C.
Made a small change to the neopixel reset timing (increased to 1000usec) as it seems to be needed on this board.
I tested this timing with another neopixel equipped board (Gravitech Cucumber) and it worked.

Initializing the TCA9554 using software I2C
Is your feature request related to a problem? Please describe.
Similar to https://github.com/adafruit/Adafruit_nRF52_Bootloader/issues/218 For MCU that support reset reason, we should only wait of double tap when reset reason is nRST.
I have made some changes to the PR, but couldn't push it to your fork to update this PR due to permission. Please set your fork to allow maintainer to have write permission, or simply grant me write permission
I have made some changes to the PR, but couldn't push it to your fork to update this PR due to permission. Please set your fork to allow maintainer to have write permission, or simply grant me write permission
I have invited you as a collaborator on my fork. Hopefully this is what you are asking for. Thanks for looking at the PR
I have made some changes to the PR, but couldn't push it to your fork to update this PR due to permission. Please set your fork to allow maintainer to have write permission, or simply grant me write permission
I have invited you as a collaborator on my fork. Hopefully this is what you are asking for. Thanks for looking at the PR
thanks for the invitation, actually, I just fiugred out I made an typo in the push command previously. Anyway, I pushed the changes, mostly some format ...
Thank you for your PR, everything look perfect now. Will merge when ci is passed.
Tested and is working but will need more thorough testing.
Known issues
-
Unsure what family ID we should use. Currently using the same ID as the F4 port.
-
Self updates not supported
-
The user button is currently unused, but could be used to trigger different modes.
-
corrupt application firmware is not detected. I'll address this, both in application binary files and in application firmware stored on device memory.
Didn't intend to create the PR here! We do want to make a PR eventually, but not on the initial commit! I'll re-create the PR in our own fork.
no problem at all, for the L3 uf2 family id, it can be found in uf2 repo
https://github.com/microsoft/uf2/blob/master/utils/uf2families.json#L168
Thanks for the pointer! I'll update the ID.
This is the TinyUF2 bootloader for the Lolin/Wemos ESP32-S2 S2-Pico board
Currently supports the onboard LED for boot state indication.
Onboard I2C display is currently NOT implemented.
USB VID is Espressif, PID allocated by Espressif for this board and purpose
Well, that saves me the bother of doing a pull request for my pico bringup.
Hey @hathach
Could you check if I'm creating uf2 files right? The code is here
yeah, I think your command is correct, you could try to enable the logging and print out the received address and contents and compare against the bin file to see if it matches. Just fake the actual flashing for testing.
e.g https://github.com/adafruit/tinyuf2/blob/master/ports/stm32f4/board_flash...
It was ready two weeks ago. Just waiting for the USB PID 🙂
Same actually, I was waiting to apply for the PID until the hardware arrived.
And it seems like every one I've seen has a crooked OLED
Including the ones on Lolin's wiki and product page on Aliexpress
Thanks! I finally figured out why the interrupts were not working.
The default SystemInit restores the VTOR value when the application boots. I couldn't get interrupts to work by modifying SystemInit (maybe vector table in QSPI is a limitation?), so I modified the the application linker script to load the vector table into AXISRAM.
The bootloa...
I have most things working and implemented now, but there are a few things to test (writing data to SPI flash, self-update and uf2 read). I could test them out along with the review.
The flash driver code isn't very pretty but it works, so I will leave it as is till I can find a portable working replacement. Also the port doesn't handle PFLASH right now (since my board only has the single sector, single bank variant)
@coral wind So I'm trying to flash TinyUF2 on a FeatherS2, and it appears to flash successfully, but then when I reset I don't get a UF2 boot disk. Did I do something wrong?
esptool.py -p /dev/cu.usbmodem01 --after=no_reset write_flash 0x0 combined.bin
(combined.bin from tinyuf2-unexpectedmaker_feathers2-0.5.2.zip in the release page of tinyuf2)
UF2 files are a special format for dropping on the UF2 bootloader drive, not flashing with esptool
(UM has put instructions here https://feathers2.io/install_uf2.html but the combined.bin file has been added more recently, and simplifies the command. Note how the original command puts multiple bin files in different places)
Ahh, I feel dumb now XD somehow I missed that was the wrong file
combined.bin should give me CP after it finishes, right? I was able to get a drive to show up at least, but it looks like the TinyUF2 boot drive
no, it's just all the parts of tinyUF2
Ohh, ok. Well, I can use it now, thanks!
Thanks @errant plover 🙂
For some reason, I can't compile for ESP32 S2 but I managed to get it fixed by changing this.
Original error
Traceback (most recent call last):
File "C:\esp-idf\components\partition_table\check_sizes.py", line 148, in
main()
File "C:\esp-idf\components\partition_table\check_sizes.py", line 142, in main
check_bootloader(args.offset, int(args.bootloader_offset, 0), args.bootloader_binary)
ValueError: invalid literal for int() with base 0: 'CONFIG_BOOTLOADER_OFFSET_IN_F...
could you provide the git hash of your esp-idf, make sure it is the same as one pointed by submodule under lib/ https://github.com/adafruit/tinyuf2/tree/master/lib
could you provide the git hash of your esp-idf, make sure it is the same as one pointed by submodule under lib/ https://github.com/adafruit/tinyuf2/tree/master/lib
I was using the latest development branch because I was attempting port tinyuf2 to ESP32S3. I tried recompile with e9cf9e2978 but it won't even compile now.
I'm currently getting a lot of issues like those
/tinyuf2/lib/esp-idf/components/newlib/newlib_init.c:85:6: error: 'struct syscall_stub_table' has no member named '...
If I understand correctly, for esp32s2, tinyuf2 will always update ota_0 and won't touch ota_1. Is there any reason that I need to keep ota_1 partition?
no reason to keep it if you aren't doing ota firmware updates, on cp dualbank module is used for ota so it can also be tuned off
So I can just remove it from my partition table?
I haven't tried removing it but just editing the partition table should probably work.
Also is there a reason not to merge UF2 with second stage bootloader?
I assume for self update?
I've pulled the OTA1 out to make a larger partition for some debug builds. At that time (few months ago) I only changed the partition table. Memory being what it is i might be wrong
I see, the IDF latest move lots of stuffs around and introduce more breaking changes. I am in the middle of other works, will check this out later when possible.
in the CircuitPython documentation it says ESP32-C3 is in beta -
any chance that the tinyuf2 is also available for the C3 modules?
it also states:
Note: The USB connection cannot be used for a CIRCUITPY drive.
is this a memory / processor limitation or just not jet implemented ?
ok - i found the missing information:
Re: ESP32 with HID USB
Post by ESP_Sprite » Sun Oct 31, 2021 4:28 am
... the S2 and S3 have a software-configurable USB peripheral that could do the job.
The C3 has a simpler USB peripheral that is hardcoded to only act as a debugging tool, so you cannot emulate a keyboard with that.
So: It is not possible
i will happily wait for S3 ;-)
a little off-topic:
A boards I ordered 3 months ago from digikey is still "waiting for clearance" for more than 2 month. Hopefully the shipping will be better in the next couple of months.
i just checked stock at mouser and now they have ~380 ESP32-S3-DevKitC-1-N8 in stock.
thank you for your info. I already back-order an couple of s3 board from digikey. It will be delivered at the end of November if they estimate it correctly.
bd6e1e5 update idf to release/4.4 for XMC support, upda... - hathach
5570395 increase ci docker for esp32 to release 4.4 - hathach
- Update IDF to release/4.4 to better support flash device on esp32-s2 mini module
- update local 2nd stage bootloader to match one in the v4.4
61a107f update idf to match version used by circuitpython - hathach
4a20cd1 update 2nd stage bootloader to match idf one - hathach
bd6e1e5 update idf to release/4.4 for XMC support, upda... - hathach
5570395 increase ci docker for esp32 to release 4.4 - hathach
a80f348 add missing bootloader hook file - hathach
- #156 already implement changes by this PR, thank you for your PR.
Contains some minor updates for board microS2. 🙂🚀
I'm unable to build tinyuf2 (just grabbed latest) for esp32s2. Anyone else confirm this is really working with IDF4.4? @sinful patrol have you confirmed this builds?
getting stacks of usb hal compile errors
i've mad sure I've run submodule update --init --recursive and a submodule sync
i'm on the correct idf version (from lib/esp-idf)
I can build if I use my external idf (4.4) repo, but nothing I do to the included on in /lib allows me to build 😦
maybe something old/bad lingering in my tinyuf2 repo?
I did a reset --hard - but no help.
no, I haven't tried it
I've built it here (a few minutes ago) for the UM Neo. WSL2. I usually do a fullclean when changing IDF versions.
Also for the feathers2
Generated /home/bsegal/Projects/tinyuf2/ports/esp32s2/_build/unexpectedmaker_feathers2/tinyuf2.bin
[1063/1063] cd /home/bsegal/Projects/tinyuf2/ports/esp32s2...ports/esp32s2/_build/unexpectedmaker_feathers2/tinyuf2.bin
tinyuf2.bin binary size 0x22d40 bytes. Smallest app partition is 0x40000 bytes. 0x1d2c0 bytes (46%) free.
Bug symptom: if an image for stm32f4 begins with >=256 bytes that already match flash content then the image must be written twice.
Reason: if the first flash_write() into an erase block matches flash content, the erase is delayed and will destroy that matching content later.
Just some typos I stumbled while debugging stm32f4 for pull request #158
I had issues too earlier but I thought it’s prob just me and moved on
I'm still unable to build using the linked IDF from /lib - but can from an external IDF.
Oh
Yea I will try use my 4.4-release
Btw few days ago I saw adafruit posted a video with a featherS2 with a S3mini module swap and in the video mentioned you made a build of Micropython for S3. I don’t know anything about micropython but does that means you got tinyuf2 running on s3?
I don’t see anything about s3 in the repo yet
MicroPython doesn't use U2F bootloaders.
So it just have a MSC loader?
No, it just presents itself as a serial device. MP doesn't offer a USB drive like CP.
Still can't replicate your issue. Just built tinyuf2 for the UM FeatherS2 using the latest master. No issues building. Using a different machine/os (Arch Linux on random laptop) The submodule esp-idf version is
❯ git describe --tags --dirty
v4.4-dev-3608-gbbe2a1bf34
Once espressif idf issues are worked out are there plans to roll another release out? There's a few boards new since 7.0 that have dead links for tinyuf2 on their CP download pages.
Has some decision been made about changing the folder name to accommodate the esp32s3? Perhaps moving to espressif as circuitpyrhon has? Thanks
This branch has been tested successfully on a Nucleo F412ZG board (144 pins!) and on custom boards with F412CE (only 48 pins). It will also help to support boards with F413, F423, F446, F469 and F479.
A custom BOARD_DIR allows to use tinyuf2 for example as Git submodule in another project that has its own board.h and board.mk.
To set the (absolute or relative) path to your board directory just run:
make BOARD= BOARD_DIR= ...
A custom APP_START allows to use tinyuf2 for applications with other start vectors than the hard-coded default in tinyuf2.
To set the start vector of your application just run:
make APP_START=0x08020000 ...
or define it in your "board.h" with:
`#define BOA...
Thank you for your PR though
- tinyuf2's
internalmakefile will continue to change and may not work with other project. It would be better that your application have its own makefile (by duplicating and modifying tinyuf2) BOARD_FLASH_APP_STARTcan be defined per board within its board.h . We don't really need to introduce the APP_START, just wrap the BOARD_FLASH_APP_START with ifndef is good enough. This should be done in its own PR since (1) is not accepted.
thanks, it looks good. We probably need to move vbus setup to board.h since it is different from boards to boards.
you are right, stm32 flash doesn't implement sector caching like other port. I probably got mixed up with other ports. Thank you very much for your fix
Operating System
Windows 10
INFO_UF2.TXT
N/A
What happened ?
The "download bootloader zip" link from the circuitpython.org board page for the Lolin Pico S2 (https://circuitpython.org/board/lolin_s2_pico/) indicates there should be a bin file for the board in the latest release, but the bin file does not exist and the link is broken.
How to reproduce ?
Go to https://circuitpython.org/board/lolin_s2_pico/
Click the "Download Bootloader Zip" button
The bin file is "not f...
the board is added after latest release of 0.5.2. It will be available in the next release.
Operating System
Linux
INFO_UF2.TXT
There is no need of info_uf2.txt file.
What happened ?
I'm unable to build current release for stm32f4, also there is no update img in github release.
How to reproduce ?
- Make sure you are up to date with master branch and submodules
- Check if your gcc version is:
arm-none-eabi-gcc (Arch Repository) 11.2.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions....
Anyone know how I can fix the compile issue?
Could NOT find Perl (missing: PERL_EXECUTABLE)
Could this be the issue?
That seems unrelated
my own esp idf 4.4 works
This is a fix for issue #165
How much it will differ from this one
https://github.com/adafruit/tinyuf2/pull/144
Anyone knows what does flashing purple means for TinyUF2?
I uploaded a UF2 but it doesn't enter the program
I guess it is waiting if user wants to enter uf2
but it won't stop flashing
I'm pretty sure, purple is for during the double tap wait
uint8_t const RGB_DOUBLE_TAP[] = { 0x80, 0x00, 0xff }; // Purple
Did you configure the wait time to be something big?
No. it seems just the board I was using is having some issues
Switching to another board fixed the issue
Is there a reason tinyUF2 is compiling net_device.c from tinyUSB? This file gets replaced by two different files and breaks the build if you try to update tinyUSB. Can we remove it from the source list? https://github.com/adafruit/tinyuf2/blob/master/ports/make.mk
@nocturne trench it may be better to discuss in a PR to tinyuf2 where thach will see it
@DuMaM There won't be a lot of difference.
The erase range would change to 64K, the program function would change to something out of the F7 HAL library and the flash sector and page sizes need to be taken into account.
Adding support for two K32L2B3 based boards, the FRDM-K32L2B3 and the KUIIC board.
This required an update to TinyUSB to get support for the K32L2B and I had to make some edits to other ports to fix the build. One notable edit is that I removed net_device.c from the builds since this file has been replaced by two different files and it is not clear if it is required or which of the new files to use. The builds are working without this file included.
thank you very much for the PR, I couldn't find detail where NXP allocate the 0x0154 for TinyUF2 usage and it would cause pid conflict later in the future. Would you mind clarifying it a bit more.
Yes, that is the numbers they signed for this.
I can dm the message if that helps.
Thanks,
Greg
Get Outlook for iOShttps://aka.ms/o0ukef
From: Ha Thach @.***>
Sent: Monday, December 20, 2021 8:44 PM
To: adafruit/tinyuf2
Cc: Greg Steiert; Author
Subject: [EXT] Re: [adafruit/tinyuf2] Feature kuiic (PR #168)
Caution: EXT Email
@hathach commented on this pull request.
In ports/k32l2/boards/frdm-k32l2b/board.h<https://...
- add board.cmake to explicitly set IDF_TARGET (to s2 or s3)
- add s3 devkit c and devkit m
- update tinyusb
- fix net_device.c file changes
- rename dcd_transdimension to chipidea
- st synopsys to dwc2
Oh that's crazy - I was working on trying to get S3 going on Tuesday, and got close, but was not able to get past the last few compile errors... and then today I see this!
Gonna give it a whirl now!
Oh that's crazy - I was working on trying to get S3 going on Tuesday, and got close, but was not able to get past the last few compile errors... and then today I see this!
Gonna give it a whirl now!
Let me know if you spot any issue
Oh that's crazy - I was working on trying to get S3 going on Tuesday, and got close, but was not able to get past the last few compile errors... and then today I see this!
Gonna give it a whirl now!Let me know if you spot any issue
It's actually working great! I have created folders for my 3 new ESP32-S3 boards, and built all of them and they boot perfectly - except I've not been able to build CircuitPython for the S3, so I don't have anything to copy onto them to check th...
you could use the uf2 for s3 devkitc to test with https://github.com/adafruit/circuitpython/tree/main/ports/espressif/boards/espressif_esp32s3_devkitc_1 . I have tested it before switching the uf2 family for S3 to new ID. For now, you need to wait for the https://github.com/adafruit/circuitpython/pull/5771 to update the family id.
905ace7 rename ports/esp32s2 to ports/espressif - hathach
rename ports/esp32s2 to ports/espressif follow up to #171
I have resolved the conflict with latest main, and push update. PR look great, thank you for you update. Will merge when ci passed.
e67904f initial commit for K32L2 support, compiles - nxf58843
dd01e26 more debug messages in flash procedures. remove... - nxf58843
c2421d6 copied clock_config from SDK 2.9.0 template sin... - nxf58843
687d5df checking in updated libraries - nxf58843
4a33f84 disable interrupts while programming flash - nxf58843
26536ee extract SDP_WRITE_ADDR (_fcfb_origin) and SDP_J... - hathach
extract SDP_WRITE_ADDR (_fcfb_origin) and SDP_JUMP_ADDR (_ivt_origin) from linker file. This helps to reduce the amount of manual work and magic number should we make changes to linker file.
I couldn't reproduce the issue since latest release from ARM is only 10.3. We will leave this issue and pr pending until gcc11 is released. Thank you for the issue.
I couldn't reproduce the issue since latest release from ARM is only 10.3. We will leave this issue and pr pending until gcc11 is released. Thank you for the pr.
@hathach do you know why pin 42 might not be working for RC? its a JTAG pin, not sure if its special...
@hathach do you know why pin 42 might not be working for RC? its a JTAG pin, not sure if its special...
Yeah, I remembered testing this. JTAG pins couldn't be used for double tap RC. It is probably got special init on power/reset.
Operating System
MacOS
INFO_UF2.TXT
TinyUF2 Bootloader 0.6.2-29-g06a65c8 - esp-idf (v4.4-dev-3608-gbbe2a1bf34) tinyusb (0.12.0-203-ga4cfd1c6)
Model: Unexpected Maker TinyS3
Board-ID: ESP32S3-TinyS3-01
Date: Dec 27 2021
What happened ?
I'm using IO47 for my PIN_DOUBLE_RESET_RC and it's not working and I'm not sure why.
Datasheet shows that it's Reset mode is E1 (Input enabled) but it's default function is (F0) - SPICLK_P_DIFF which is O/T, not GPIO47 which is I/O/T - (F1...
the JTAG pins are special, they cannot be used for the RC double-click because the boot in JTAG mode, i think pins 38 and below are ok
the JTAG pins are special, they cannot be used for the RC double-click because the boot in JTAG mode, i think pins 38 and below are ok
Hmm, ok, but 47 and 48 are not JTAG pins. They are the new pins on the S3 that you can connect an external XTAL to for SPI clock sync, but maybe because they are connected to the VDD_SPI power domain, that's why it's not working.. though VDD_SPI is 3v3 on my boards, and a common GND, and I can see it's the correct voltage on the scope.
And VDD_SPI is b...
ok! thats something that has bit me before is all :)
when @hathach is back from holiday they can look in more detail
since we don't have your TinyS3, please try to test/confirm it with S3 devkitC
- Tell us what is your R and C value, I will try to reproduce it here
- confirm the issue occurred on S3 devkit
- With the same RC setup. move to other non-JTAG pin and confirm that it works.
- Screenshot with scope testing with (2) and (3) for reference would help
Oh... I need to take a dipper look on this package then.
https://archlinux.org/packages/community/x86_64/arm-none-eabi-gcc/
Oh... I need to take a dipper look on this package then. https://archlinux.org/packages/community/x86_64/arm-none-eabi-gcc/
yeah, Arch Linux always use latest software. I am sure it is part of gcc11 new feature, it will take a bit of time for ARM to release gcc11 for me to try it out. Since this warning is new to me, I would like to try it out to see if there is any other way to fix this.
Sorry for the delayed response. There are some issues with this update. The image runs after loaded but does not run from flash (RT1010 EVK). Let me try to clean this up. This PR should probably be reverted.
I think it would also be good to switch to spsdk (https://pypi.org/project/spsdk/) for loading, then we do not need to keep the sdphost binaries. They can load it separately like pyocd.
I also use Arch and have seen this too. There is a bug asking for the suggested fix here: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99578#c16
Here is how I did it in CP:
#pragma GCC diagnostic push
#if __GNUC__ >= 11
// TODO: Update this to a better workaround for GCC 11 when one is provided.
// See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99578#c2...
Sorry for the delayed response. There are some issues with this update. The image runs after loaded but does not run from flash (RT1010 EVK). Let me try to clean this up. This PR should probably be reverted.
I tested with rt1010 evk and seems to work well. This PR essentially does not make any changes in the compile binary. It only add the sed script to extract the _fcfb_origin and _ivt_origin from the linker file. Which OS you are using, I haven't tested on windows, maybe adding thi...
thanks @tannewt for more input, it still looks a bit odd to me. I will look more into this once ARM officially release gcc11.
Operating System
Others
INFO_UF2.TXT
NA
What happened ?
There is a board naming inconsistency between Circuitpython and tinyuf2 for the Lolin S2 Pico. This is causing the templating for the tinyuf2 download on circuitpython.org board page to be a dead link.
CP: lolin_s2_pico tinyuf2: lolin_s2-pico - I think tinyuf2 is the inconsistent one here in that other tinyuf2 board names use all underscores.
How to reproduce ?
I would try to fix this myself, but I don't know what the implications of changing a board name are.
I forgot that the RT1010 does not fit with debug logs enabled. I think that was my problem. It is working for me now. I will submit a pull request with the SPSDK update. It is mostly documentation, let me know if anything is unclear.
This pull request removes the OS checking for sdphost and instructs the user to install the NXP SPSDK from PyPI.
The directory with with sdphost binaries has a note that it is being depricated and where to find SPSDK.
Most of the edits are in mimxrt10xx/README.md
Let me know if anything is unclear.
@skieast what do you think, should we rename the board to match CP naming ?
@skieast what do you think, should we rename the board to match CP naming ?
Yes, I probably had some idea when i created the board but all the other ones use all underscores. Who knows. But should be changed for consistency.
renamed board to match CircuitPython. Hopefully done correctly.
look great, thank you for the update. We will leave the existing sdphost binaries/source for reference or just in case the spsdk has any compatible issue.
Sorry for the delay on replying here... I spent 2 full days on this, and the results are not good news.
I cannot get this to work on any final production silicon I have here, on any board of mine, on any IO - no matter if the components are onboard or connected externally on a breadboard or soldered directly to the header pins.
But... I can get it to work with any IO including IO47 on my S3-DevkitC on a breadboard... the thing is, my DevKitC is using pre-production silicon - not f...
Just some extra info on things I tried....
- I set the IO to Input instead of setting it to low at the end of the function, so try to prevent it from draining through the IO. Doesn't work as it seems resetting the S2 puts the IO into a specific starting state and it drains anyway.
- I've removed the discharge resistor completely, meaning the cap can only discharge back into the IO and I can confirm the cap stays charged until reset it pressed again, but instantly drops.
- Tried lots of ca...
Look good, you should also add ci for this new board as well for generating binaries in release tag https://github.com/adafruit/tinyuf2/blob/master/.github/workflows/build_esp32.yml#L22
I have re-tested with Adafruit S2 boards, all stills work well with latest code.

I will test this out on my S3 devkit. I have an working pair of through hole RC but it is hidden somewhere. Meanwhile, have you hooked up the scope to pin to see the state of the PIN_DOUBLE_RESET_RC. You could use that to adjust the RC value.
I think I have narrowed the issue, it is probably due to the latest code. Doing more tests with scope hooked up, will post update whenever I got one.
d238d1b fix double tap issue with verion 0.7.0 - hathach
fix double tap issue, fix #176 . Root cause: gpio_ll_set_level() is used in version 0.7.0 since S3 gpio rom does not have gpio_output_set_high(), unlike rom API, gpio_ll needs to explicitly enable output first.
@ladyada while working on thks issue, I figured out that esp_rom_gpio_pad_select_gpio() can also be used to get JTAG pin working as double tap pin. Therefore there is no restriction on JTAG pin after this got merged.
found the root cause, this will be fixed by #181 , please try it out. 181 also get the JTAG pin works as double tap as well, yah !!
Well done!!!! Can you wait on 0.8.0 for 10 mins while I do a PR for my new S3 boards please?
This is still not working for me - at least not on IO47 on any of my boards, using a 1uF cap and 442K resistor :(
Ok, I got it working on my FeatherS3 and TinyS3 by using a 2.2uF cap instead of the 1uF. Seems like the 1uF is still draining past the high voltage threshold too quickly. Wicked!
thanks for testing it out. I am glad it works for you. It needs a bit of tweaking :)
3d024d3 fix generating combined.bin to work with s3 - hathach
combined.bin for S3 has different bootloader.bin offset (0x0 vs 0x1000 in S2). This PR fixes combined.bin generation for S3.
@ladyada
- favicon icon + autorun only work with windows, but nice to have
- feature can be enable per board by adding
#define TINYUF2_FAVICON 1. Enabled on esp32s2 saola 1 wrover as example - add adafruit logo as
favicon.h(256x256 with only 7.5KB) as example for now. We could have a final per-project (tinyuf2 logo) or even per-board favicon later if needed.
@ladyada This PR took longer than expected since we need to update and extend the ghostfat to support static files with size larger tha...
At first glance, this looks good. Lots of nice abstractions to make the code more readable.
I am presuming that both info_index_of() and info_cluster_start() were unit-tested.
I have some recommendations and questions (see comments).
Should favicon.h be in the common source directory, or should it instead be created in each board's subdirectory?
I think since the icon should be customizable on a per-board basis, it should be placed into each board's directory. Or, at the minimum, provide a way to override the default favicon.
698ec09 add new self-test -- 4k w/favicon - henrygab
ed31aa3 always upload newly generated self-test image - henrygab
ced126b generate artifacts for 32k/512b w/favicon - henrygab
3da4f0e adjust downloadable artifact naming - henrygab
one more change will be necessary with this checkin:
Generation of the "known good" images for ghostfat self-tests. I am working on this in a branch. I have hand-validated test_base_with_favicon (I may change the names to be shorter).
- [x] test_base_with_favicon
- [ ] test_4k_cluster_with_favicon
- [ ] test_32k_cluster_with_favicon
86f9d76 shorter ghostfat selftest directory names - henrygab
0c1a44a fix 512b w/favicon known good image - henrygab
9802dcd can we put multiple jobs' files into one artifact? - henrygab
0e0762d Update volume labels (expect validation to fail) - henrygab
3207f87 Multiple features (squashed from dev branch): - henrygab
Because the new code allows for >1 sector per file, there is now higher risk of files having FAT chain beyond the first sector of each FAT.
I will look at either (1) adding necessary static_assert to ensure this is avoided, or (2) fixing the FAT chain code to work always.
19413c4 add static_assert() for fat chain creation - henrygab
d48d28c Simplify FAT generation (try #1) - henrygab
2f2264a move _flash_size to start of file - henrygab
425f143 no debugger ... abusing printf.... - henrygab
5ddaf05 off-by-one ... the bane of FAT32 - henrygab
7dc0e91 conditionally compile debug-only variables - henrygab
76508dc set unused FAT to 0 (not 0xFFFF) - henrygab
9ccf621 temporarily disable huge selftest - henrygab
085cdac ensure last bits of FAT are zero - henrygab
Should
favicon.hbe in the common source directory, or should it instead be created in each board's subdirectory?I think since the icon should be customizable on a per-board basis, it should be placed into each board's directory. Or, at the minimum, provide a way to override the default favicon.
This is just initial implementation. There would be an project-wide icon which is in the src directory. The board-specific icon will be supported as well. I am thinking to have TINYUF2_...
Because the new code allows for >1 sector per file, there is now higher risk of files having FAT chain beyond the first sector of each FAT.
I will look at either (1) adding necessary
static_assertto ensure this is avoided, or (2) fixing the FAT chain code to work always.
You are right, I will update PR to include the check/warning or fix the code if I could do it quickly. I am off until next week, will do this in the next week.
Btw if you are making changes to your branch, w...
I'm just working (slowly) through the last bugs in the new FAT generation.
I will make a PR when it's done. I am fighting (long?) COVID, so have fewer hours awake.
If I have time, I will add ability to override favorite icon also.
Operating System
MacOS
INFO_UF2.TXT
empty
What happened ?
just built latest from masterful my S3 boards, as a final test before I committed the to the repo, and though they work fine, the info_uf2.txt is empty.
How to reproduce ?
Not sure how you can repo this. I lent out my S3 devkit, so cant test it on that here, but it might also have the same issue.
Debug Log
No response
Screenshots
No response
ca15f5a fixed-width format string fixes - henrygab
9c9e956 fixed-width format string fixes - henrygab
912b843 Merge branch 'add-favicon-hg3' of https://githu... - henrygab
.github/workflows/...
- Moves self-test to new job runner (now ESP, ARM, self-test)
ports/test_ghostfat/boards/...
- updated known-good images (Note: This was done BEFORE updating how FAT was generated)
- add new boards to include a favorites icon
- slightly updated debug output
src/ghostfat.c
- Update macro
UF2_DIV_CEIL-- avoid undefined behavior from overflow with signed inputs - Change
TextContenttoFileContentto reflect ability to store binary...
@hathach -- Please see PR #187, which fixes things and adds additional test images.
Can you dump the full disk image (setor-by-sector ... on un*x-like systems, I think something like:
dd if=/dev/hdX of=~/ghostfat_empty_uf2.img, where you replace /dev/hdX with the ghostfat board device (different on each system).
If so, can you place in publicly accessible place? Note that this file will include the device firmware....
Also, if you could also load a build from the add-favicon-hg3 branch, and dump that full disk image, that'd be useful.
P.S. - love the Tiny Pico board you made.
For chips that use a partition, perhaps it would be possible to update to expose each of the partitions as UF2 binaries?
This would require:
- ability for boards to indicate, at initialization time (
uf2_init), at least:
a. the number of partitions to expose
b. the start and end address for each exposed partition
c. optionally, an 8.3 fat-compliant filename for each exposed partition - update ghostfat to:
a. use embedded-safe C++11
b. rework major portions to ...
The USB peripheral on the C3 is not usable for TinyUF2. From Espressif
"Note that, in contrast with the USB OTG peripheral in some Espressif chips, the USB Serial/JTAG Controller is a fixed function device, implemented entirely in hardware. This means it cannot be reconfigured to perform any function other than to provide a serial channel and JTAG debugging functionality."
yes it is not possible - its not a true USB native device.
it will crash to run any code after flashing CircuitPython 7.1.1 on my esp32C3 , I assumed the cause is no uf2 driver, there is no way to run python code on esp32-c3?
uf2 is separate from CircuitPython. You'll want the Absolute Newest version of CircuitPython because we've fixed some crashes last. Please note that it's for advanced users only right now because the CIRCUITPY drive cannot work without native USB. In the long term we want to support the BLE workflow but that isn't currently working.
@henrygab thank you for your informative input, though, I think bootloader should just focus on updating the firmware anything that relates to firmware usages such as its file system should be done by firmware itself. For embedded C++, I don’t think we need to migrate to it since not all MCUs have C++ compiler for it and we actually don’t have to do complicated thing within bootloader. I agree with defensive coding style, but it is best to write as little code as possible.
[adafruit/tinyuf2] Pull request review submitted: #187 Improve FAT generation, bugs, favicon support
the new FAT generation method is brilliant !! Thank you very much for vastly improving the ghostfat and the self-test. There is other thing I think we could tweak the code, but I will do it as following commits.
@hathach -- Please see PR #187, which fixes things and adds additional test images.
thank you very much, that PR is brilliant and merged. I will do a bit more tweak to the PR and we could wrap this up.
@henrygab I pushed more "enhancement" to ghostfat, please review if you have time and see if that makes sense to you https://github.com/adafruit/tinyuf2/pull/185/commits/252151a18e8e21c8f81ce4f1bd019aef1f84a3ae
Initial review of this commit
Overall, you've made the code better. I do think there are a couple errors with the new static assertions, but should be good, especially if the self-tests pass.
fb08374 fixing off-by-one bug in two static assertions - henrygab
74e7baa use new variable for file-relative sector offset - henrygab
fbddb68 Use new variable within the UF2 structure also - henrygab
Thank you @henrygab for actively helping with PRs. I really appreciate your review and inut, the ghostfat is getting better and better and could support pre-defined large file size. I think it gets to the point we could make an Adafruit_GhostFAT arduino library to help exposing data/log/variable (read-only) on board that have limited space or just don't want to deal with file system and/or partitioning.
@henrygab let me know if you have any pending changes on your side, otherwise, I think we are good to merge this by now :tada: :tada:
I agree, this is good to go. I was just waiting for the builds, and got distracted. :)
Congratulations! This will be a great, user-visible improvement!
- @UnexpectedMaker have you tried to plugged the board into other PC with other OS such as ubuntu/windows to make sure this is macOS specific issue ? I just checked with Ubuntu 20.04 and it still works.
- Which
BOARD=you are using, make sure it isespressif_esp32s3_devkitc_1to rule out any chances that it is not your board porting issue.
Driven by a remark that bootloader protection is still pending I implemented it for the STM32F4 family.
For broader use a new board level function is introduced board_flash_protect_bootloader(). All other ports are currently implemented as stubs.
On the STM32F4 family tinyuf2 occupies the first four flash sectors. The overwrite protection is enabled by setting the option bytes nWRP register in the flash peripheral. This is done when flashing has been finished and the app is about to b...
I have written a small program that is apply-able as a UF2 image that will unprotected the flash sectors again and jump to the built-in DFU bootloader of the STM32F411. This acts as unlocker key to update or overwrite the whole flash.
The project is called tinyuf2-unlocker https://github.com/KarlK90/tinyuf2-unlocker
I believe that SAMD's CURRENT.UF2 already includes the filesystem. nRF may as well. It is definitely a handy feature.
@tannewt SAMD & nRF52 CURRENT.UF2 includes all internal flash contents therefore also include internal file system e.g nvm if available but not the file system on external flash. The S2/S3 has different partitions for firmware, nvm, file system and they may not be continuous, You probably understand this better than me.
For S2/S3, currently tinyuf2 limit itself within the firmware(ota) partition to prevent overwriting to other partitions. Therefore the address in uf2 is starting from ...
Very good points @hathach. It'd probably be best to chat with the Microsoft UF2 folks about how we designate UF2s for different uses (aka partitions.) We wouldn't want to copy off the nvm partition data and then copy it over an ota section.
All PIDs are from Espressif.
[adafruit/tinyuf2] New comment on pull request #190: Added my new TinyS3, FeatherS3 and ProS3 boards
thach will return after Tet!
[adafruit/tinyuf2] New comment on pull request #190: Added my new TinyS3, FeatherS3 and ProS3 boards
thach will return after Tet!
Yup, that's cool :)
I just wanted to get this in as it's been sitting in my repo for a few weeks and I didn't want to forget!
FYI:
ESP32 appears to be hard-coded to only allow writes to the ota1 partition.
Moreover, the offset stored in existing .uf2 files is a relative offset for that ota partition.
Ghostfat has no concept of which file is being written to, and IO can be re-ordered by the time the device sees it (e.g., no guarantee that sector 0 will be seen as written by device before sector 10). Therefore, you cannot simply insert a "switch to partition X" (or any stateful) command into the he...
Hi thank you for your PR. I am currently on TET (Lunar New Year) holiday. Will check this out later on
Thanks, have a great holiday!
FYI:
ESP32 appears to be hard-coded to only allow writes to the
ota1partition.Moreover, the offset stored in existing
.uf2files is a relative offset for that ota partition.
Yup, currently tinyuf2 for esp32s2/s3 is writing as offset to ota0 to prevent overflow to other partition.
In combination, these factors make it challenging to support writing more than a single target partition in ghostfat. However, if you simply want to expose additional
.uf2...
Hi,
Please consider accepting this MR which adds support for SparkFun's Thing Plus STM32 board. The USB VID and PID values were provided by SparkFun and are already in CircuitPython's definition for this board.
Tested by using TinyUF2 to install CircuitPython 7.2.0 (alpha) to my own board.
Thanks!
[adafruit/tinyuf2] New comment on pull request #190: Added my new TinyS3, FeatherS3 and ProS3 boards
@UnexpectedMaker which board of yours have the issue #186 ?
Oh, I totally forgot to reply to this.... Issue went away when you (@hathach ) reverted the favicon stuff you were playing with. Cant remember what exact commit I was on, but latest (what I submitted my ESP32-S3 boards agains) works perfectly, so closing this issue. Sorry!
[adafruit/tinyuf2] New comment on pull request #190: Added my new TinyS3, FeatherS3 and ProS3 boards
@UnexpectedMaker which board of yours have the issue #186 ?
That issue is gone in this commit/PR. I totally forgot to update and close that issue, so I did now. Sorry!
Happy new year! I hope you had a nice break :)
I didn't reverted the favicon, it is already on the master branch, please double check it.
Yes I know it's in there, but there was a sequence of commits you did and then fixed or changed. I can't remember exactly now. I should not have said "reverted" - I meant "changed/fixed" - I think I was building against some non-quite-ready commits when the issue happened.
All of my boards I've shipped are flashed with UF2 bootloaders built again my PR and are all working great!
if it is not reproducible, it is not an issue anymore. Thanks for the udate
look great, thank you for the pr
bootloader shouldn't share PID with circuitpython application. Are you able to get an separated PID for tinyuf2 as bootloader ?
bootloader shouldn't share PID with circuitpython application.
Sorry @hathach, I was unaware of this. I can send an E-mail to SparkFun's technical support asking if they have another PID or re-use them for bootloaders.
I will mention helpful community member @brhoff720 in case he can offer some advice!
@NathanY3G @hathach
Let's use these PIDs:
SparkFun Thing Plus STM32 - Bootloader | 0x002C
SparkFun MicroMod STM32 Processor -Bootloader | 0x002D
I'll ask an engineer to update files as needed as well. Thanks for catching this.
great, @NathanY3G please update pr with the new PID. then it will be good to merge
Thank you again @brhoff720 - much appreciated :star2:
@hathach Updated!
Thanks for the review @hathach :-)
Hmm, is reserving the whole 64KB block for the bootloader intended? Some of these 16KB flash sectors could be useful for storing some firmware settings (unfortunately, on STM32F4 other flash sectors are much larger, therefore rewriting them at runtime is problematic). One of recent QMK PRs actually tried to add a board which uses tinyuf2, but assumes that only sectors 0 and 1 are occupied by the bootloader, and therefore uses sector 2 for EEPROM emulation. Setting the protection flags for sec...
for eeprom emulation they should use the last block in memory
@KarlK90 Thanks for this PR.
I thought, the linker uses only 32 KB of flash which is first 2 sectors and use the next 2 sectors for EEPROM emu.
https://github.com/adafruit/tinyuf2/blob/master/ports/stm32f4/linker/stm32f4.ld#L47
Am i missing something ?
@KarlK90 Thanks for this PR. I thought, the linker uses only 32 KB of flash which is first 2 sectors and use the next 2 sectors for EEPROM emu.
https://github.com/adafruit/tinyuf2/blob/master/ports/stm32f4/linker/stm32f4.ld#L47
Am i missing something ?
No you are completely right, I took the number from the [QMK linker file](https://github.com/qmk/qmk_firmware/blob/bc5d46aaadfdef5683d95e924e49ea6bc562c9f3/platforms/chibios/boards/BLACKPILL_STM32_F411/ld/STM32F411xE_tinyuf2....
Although the tinyuf2 bootloader assumes that the main app starts at a 64kb offset, so technically there is a 32kb gap...
https://github.com/adafruit/tinyuf2/blob/master/ports/stm32f4/boards.h#L38
Adding the Hiibot IOTS2.
PID from Espressif.
The IOTS2 board does not have a reset pin for the screen, it's pulled up.
So I set it to -1 and added #if DISPLAY_PIN_RST != -1 where appropriate so it compiles.
Don't know if it's the right way to do it.
everything look great, the DISPLAY_PIN_RST= -1 is good one. Only 1 request that BOARD_ID must follow uf2 format specs (check out other board for sample)
as many other features/issue, there is no plans at all. This is not high priority. I could only implement it when having time. which I don't know when.
Add LilyGo TTGO T8 ESP32-S2 which recently got CIrcuitPython support.
ESP-ROM:esp32s2-rc4-20191025
Build:Oct 25 2019
rst:0x1 (POWERON),boot:0x8 (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3ffe6100,len:0x162c
load:0x4004c000,len:0xd94
load:0x40050000,len:0x2f04
entry 0x4004c258
I (21) boot: ESP-IDF v4.4-dev-3608-gbbe2a1bf34 2nd stage bootloader
I (21) boot: compile time 10:31:57
...
Add LilyGo TTGO T8 ESP32-S2-WROOM which recently got CircuitPython support.
ESP-ROM:esp32s2-rc4-20191025
Build:Oct 25 2019
rst:0x1 (POWERON),boot:0x8 (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3ffe6100,len:0x162c
load:0x4004c000,len:0xd94
load:0x40050000,len:0x2f04
entry 0x4004c258
I (21) boot: ESP-IDF v4.4-dev-3608-gbbe2a1bf34 2nd stage bootloader
I (21) boot: compile time 11:3...
Added board IDs: BPI-BIT-S2, BPI-Leaf-S2, BPI-Leaf-S3
All PIDs are from Espressif
Thanks in advance.
...by defining NEOPIXEL_ NUMBER which now acts on values bigger than 1. Furthermore users can define a custom pin mode for the output pin, e.g. open-drain for applications where an pull-up resistor is used as a 3.3V to 5V logic level shifter.
If it helps, I can confirm that this works on a chain with ~20 leds, and with a pull-up resistor used.
Great! Thanks for the feedback.
Operating System
MacOS
INFO_UF2.TXT
TinyUF2 Bootloader 0.8.0 - tinyusb (0.12.0-203-ga4cfd1c6)
Model: Espressif ESP32S3 DevKitC 1
Board-ID: ESP32S3-DevKitC-v1.0
Date: Jan 5 2022
What happened ?
After copy of cp 72x onto S3DKC1BOOT and reboot, device remains in boot mode.
see https://forums.adafruit.com/viewtopic.php?f=60&t=189819
How to reproduce ?
see https://forums.adafruit.com/viewtopic.php?f=60&t=189819
Debug Log
none
Screenshots
No response
Make sure you
- double check the N8R2 on the actual module, mismatched PSRAM configure could cause reset issue
- I have try https://circuitpython.org/board/espressif_esp32s3_devkitc_1_n8r2/ on my N8R2 and it flashed and could run circuitpython just fine
One of the difference is, I use the latest tinyuf2 instead of release version, maybe you should try to see if that fix the issue:
- click on Artifacts to download https://github.com/adafruit/tinyuf2/actions/runs/2056501200
![image]...
Thank you! That fixed it. Now working with cp 724 (public release)
can you confirm that the latest combined.bin fixed the issue, or just using the cp724 fix the issue ?
see https://forums.adafruit.com/viewtopic.php?f=60&t=189819
combined.bin fixed the issue, not cp724
FYI - initially tried drag copy update-tinyuf2.uf2, which did not resolve issue
did not try online serial tool
used esptool v3.3 to install combined.bin
first try failed - had not switched from USB to UART port
second try succeeded - connected to UART port
no plan to regression test cp720 .. 724
Any idea what changed in combined.bin
thanks for confirmation, there is quite a lots of changed, I will make an release as 0.9.0 soon enough.
You are welcome!
Can you update INDEX.HTM for the s3 devkit c1 boards:
OLD user-guide-devkitm-1.html
NEW user-guide-devkitc-1.html
Thanks!
thanks, I will make an update. Actually, could you do another test, so far we have
- web_esptool + 0.8.0 --> issue
- esptool.py + github combined --> work well
would you try to test with following combination just to rule out that web_epstool is the one that cause the issue (since S3 is added recently)
- esptool.py + 0.8.0
via USB port:
drag file onto boot drive
update-tinyuf2-080.uf2 <- SUCCESS
update-tinyuf2-9a414ac.uf2 <- SUCCESS
web-serial combined-080.bin <- FAIL
web-serial combined-9a414ac.bin <- SUCCESS
via UART port:
esptool combined-080.bin <- FAIL
esptool combined-9a414ac.bin <- SUCCESS
thank you for detail testing, 0.9.0 is released with url fixed for devkitc1 https://github.com/adafruit/tinyuf2/releases/tag/0.9.0
I’m trying to generate uf2 from an ESP-IDF project and I observe some weird behavior. When I use the uf2_conv.py to generate, a 595kb file is generated; however, when I do a certain action, a stack overflow happens. When I tried the idf.py build uf2, a 337kb file is generated. But when I uploaded it, it doesn't run at all.
I initially thought something wrong with my code is causing the overflow so I connected a Jtag debugger and tried to debug; then the stack overflow no longer occurs.
...
Is your feature request related to a problem? Please describe.
A custom animation system for boards that has more complex LED.
Describe the solution you'd like
I already made a solution for my own fork. https://github.com/203Electronics/Matrix-Bootloader/commit/5be0be79d0ea44c26edaed1cd995f1df341e1f5d
But I would prefer this is supported upstream.
Describe alternatives you've considered
Mentioned above,
Additional context
https://github.com/203Electronics/Matrix-...
custom animation is totally OK, but it should be per-board configuration and default to existing one. custom animation code/function must be in myboard/board.c since it is board specific.
this is not really issue of this bootloader, you could check out makefile of update-tinyuf2 app for how to generate one. If there is further issue, please post it in forum support
custom animation is totally OK, but it should be per-board configuration and default to existing one. custom animation code/function must be in
myboard/board.csince it is board specific.
Yes, that was the point. On my board.c I included #define CUSTOM_LED which overloads the animation system to the animation.c in the board folder.
feel free to submit pr when you think it is ready.
feel free to submit pr when you think it is ready.
If I want to submit a PR that means I will have to submit a compatible device that uses this system. I don't think my devices are appropriate on this repo, so should I port my code to a device like esp32-s3-devkit-1 and specify a pin for the RGB matrix?
My current implementation prevents self-update to be build
c:/users/caine/.espressif/tools/xtensa-esp32s2-elf/esp-2021r2-8.4.0/xtensa-esp32s2-elf/bin/../lib/gcc/xtensa-esp32s2-elf/8.4.0/../../../../xtensa-esp32s2-elf/bin/ld.exe: esp-idf/src/libsrc.a(main.c.obj): in function
board_timer_handler': C:/Users/caine/Documents/GitHub/Matrix-Bootloader/src/main.c:257: multiple definition ofboard_timer_handler'; esp-idf/boards/libboards.a(animation.c.obj):c:\users\caine\documents\github\matri...
feel free to submit pr when you think it is ready.
If I want to submit a PR that means I will have to submit a compatible device that uses this system. I don't think my devices are appropriate on this repo, so should I port my code to a device like esp32-s3-devkit-1 and specify a pin for the RGB matrix?
yes, since this is board specific, you should only apply this to board with rgb matrix like yours, the s3 devkit does not have this and could confuse other user. If your board is...
If your board is not ready to submit an PR, no problem at all, just wait until it is ready.
My issue is that my board isn't a dev board so I don't think it should be on the tinyuf2 repo. But I'm pretty sure there are some dev boards with RGB matrix or someone wants to implement this on their own project.
My issue is that my board isn't a dev board so I don't think it should be on the tinyuf2 repo. But I'm pretty sure there are some dev boards with RGB matrix or someone wants to implement this on their own project.
ah I see, your board is not in mass production as others. Yeah, in that case, using a popular devkit would be ideal, we will make it disabled by default.
Is the ota_1 partition used by tinyUF2 in any way? If not, can we free it for other uses?
I know in the official documents, at least two OTA partitions are required but I don't think we really need two for tinyUF2.
When flashing fails, just revert back to TinyUF2 at the factory partition and let the user reflash it should be fine,
[adafruit/tinyuf2] Issue opened: #203 ESP32\-S2 enter bootloader with magic number instead of RC pin
I have a board I've designed that does not have the RC components and I want it to be able to enter bootloader by double tap and programmatically from within the firmware. this both could be implemented more easily using the magic number method.
Is there a reason why the ESP32S2 boards implement it wit the RC instead of magic munber?
Operating System
Windows 10
INFO_UF2.TXT
N/A
What happened ?
I am working on a port of tinyuf2 to an MIMXRT1021 based board. I saw in MIMXRT1021_ram.ld, I saw
_fcfb_origin = 0x0400;
I believe this is incorrect and should be 0x0000 based upon the 1020 user manual and my experience w/ the part. I noticed this after programming tinyuf2 to RAM and watching it copy to flash via RTT debug messasges. After a power cycle, the part would always enter ROM DFU boot mo...
esp32 clears out memory between resets, unlike other chips. RC 1 bit memory is required until someone invents something better
Good catch on the FCFB offset. There is a note in the reference manual that you cannot use ITCM address 0x0 for load to RAM images (section 9.6.1.2), so I moved the image to 0x1000 to keep the IVT header 4K aligned. Please try this fix:
https://github.com/nxf58843/tinyuf2/tree/hotfix-rt1020ld
So, I think having the FCFB offset at 0x1000 would still have the issue of the resultant image not being bootable after write_tinyuf2_to_flash() is called. Once the RAM version runs the 1st time, copies itself to the the QSPI flash. However, we need the boot header to be at a zero offset from the base of flexspi base address (0x60000000) per statement 1 in 9.6.1.2
Also, from the manual (9.7.1), It sounds IVT structure must be at 0x1000 when using FlexSPI NOR. From my understand...
Please note the image runs from RAM not XIP. 0x1000 is the location in ITCM where the image will be running from.
The location in flash is adjusted based on the IVT offset so that it will be placed at the correct location in flash.
As long as the difference between _fcfb_origin and _ivt_origin is correct, the FCFB will be located at the correct location.
From ports/mimxrt10xx/boards.h:
// _ivt_origin is defined in linker script
// The FCFB has different offsets, but the IVT is cons...
Configuring the image to run from RAM allows it to be loaded and run with only sdphost. The internal ROM is not able to load flash directly so we simply load a RAM image and it copies itself to flash. TinyUF2 is its own flashloader. This also allows TinyUF2 to update itself with a .UF2 file.
Thank you for the explanation of the Non-XIP boot, etc. Makes sense. I appreciate you taking the time!
I was able to verify that moving the fcfb_origin to 0x1000 and ivt_origin to 0x2000 works.
One piece that I overlooked when studying the code was the mask operation:
#define FCFB_START_ADDRESS (FLEXSPI_FLASH_BASE + (((uint32_t) &qspiflash_config) & 0xFFF))
I kept seeing 0xFFFF instead of 0xFFF and couldn't figure out how it could ever work. :-)
Everything look...
Thanks, now I understand the rationale behind the RC pin.
I have a couple of questions to get a more complete picture.
- after looking at the code for the grandcentral bootloader it saves the magic number in RAM (in the last address). Isn't RAM always cleared between resets by definition. or resetting using the reset pin doesn't actually cut power to the RAM? The ESP reset pin does cut power to the RAM?
- Why not simply store it in NVM? Is it too slow? Will it decrease the life span of...
It doesn't appear this board was added to https://github.com/adafruit/tinyuf2/blob/master/.github/workflows/build_esp32.yml, so it wasn't part of the last release.
oops !
thanks to @makermelissa who noticed it was missing.
- after looking at the code for the grandcentral bootloader it saves the magic number in RAM (in the last address). Isn't RAM always cleared between resets by definition. or resetting using the reset pin doesn't actually cut power to the RAM? The ESP reset pin does cut power to the RAM?
not possible since whole power for the chip is cut off
- Why not simply store it in NVM? Is it too slow? Will it decrease the life span of the flash chip? all of the above?
only answer is giving...
- git throw
fatal: unsafe repositorywhen running git describe for getting version. Due to latest git update from ci ubuntu image 20.04. See https://github.com/actions/checkout/issues/766 for detail - also explicitly specify
depth = 0 - bump up other actions to latest version
Thanks, the esp32 build failed is due to git issue with docker run with IDF. fixed by #206 and re-run
great, thank you for the PR. I do remember having issue testing with rt1020 but thinking it is flash configure issue or something. I didn't test again, but will do later on.
fixed by #207, thank you @ehughes and @nxf58843 for the solution
Operating System
Windows 10
INFO_UF2.TXT
n/a
What happened ?
Summary:
I believe the value use for BOARD_BOOT_LENGTH is incorrect. In ports/mimxrt10xx/boards.h
#define BOARD_BOOT_START (((uint32_t) _ivt_origin) - 0x1000)
#define BOARD_BOOT_LENGTH (0x8800)
0x8800 is the value used for _text_length in ports/mimxrt10xx/linker/memory.ld
Since the ROM boot loader is copying down BOARD_BOOT_LENGTH from (((uint32_t) _ivt_origin) - 0x10...
Operating System
Windows 10
INFO_UF2.TXT
not relevant
What happened ?
I have a custom board that implements the esp32-s2 solo module.
I've attempted resetting the board into bootloader mode using the following snippet from the readme:
`#include "esp_private/system_internal.h"
void reboot_to_uf2(void)
{
// Check out esp_reset_reason_t for other Espressif pre-defined values
enum { APP_REQUEST_UF2_RESET_HINT = 0x11F2 };
// call esp_reset_reason() is required for i...
Closed since clearly not a bug of this repo. Check your flashing scheme, layout, linking etc of platformio and arduino
To set a custom application start vector define in your "board.h":
#define BOARD_FLASH_APP_START 0x08020000
The default start vectors are still 0x08004000 on stm32f3 and 0x08010000 on stm32f4. Other common start vectors on stm32f4 are 0x08008000 and 0x08020000.
Sorry for the long delay! Finally I had time to upgrade my project using tinyuf2 0.9.2.
You are right about (1). I can use make BOARD_DIR="<path>"while I don't like that <path> has to be relative to $(TOP) of tinyuf2. I tried to solve this with PR #162. But I use tinyuf2 as a git submodule in my project, so its relative path never changes ⇒ problem solved.
As for (2) I opened PR #212.
Indeed not a bug in this repo, but I wonder the compiler/linker settings has anything to do with this feature.
I'm going to dive deeper into how platformio are handling the compilation and upload.
do you maybe have an idea what could be the culprit?
Thanks
SPI_DMA_CH_AUTO is the correct fix and a better usage of SPI channel. I have tested with
- S2 TFT
- S3 devkit + TFT breakout
- Funhouse which use both SPI for TFT and DotStar and run fine
it can be anything, I don't use PIO to give an advise. For further question, please post on Adafruit support forum. Github is mostly for code related issue.
Sorry for late response, after TET, I kind of forget about this. This is a great PR, everything look great. And can be merged as it is, though I would like to include the tinyuf2-unlocker in this PR as well if possible.
The reason is for self-update via uf2, basically an special that contains bootloader binary in an array bytes and write that to the bootloader flash region. Currently it is not supported on stm32f4 port, but I think this is a good chance to also include it to
- http...
This PR implements a port of tinyuf2 to the STM32L4 family, specifically the L4R5.
The code has been tested for a few months and is considered fairly stable.
The implementation is mostly a copy and paste of the existing STM32F4 port, updated with the most recent changes. In the longer run, the common elements of F4 and L4 ports may benefit from being merged to avoid code duplication.
I tested the bootloader using this test plan on Swan R5:
- start with a fully erased device
*...
If you are considering to make board_flash_protect_bootloader(false) a generic API, note that it is actually impossible to implement for some MCUs. In fact, STM32F4xx almost looks like an outlier, because for many other STM32 chips (F103, F303, L4xx, L072, probably some more) the only way to make new option bytes take effect is to perform a system reset (or an “option byte reload” procedure, which itself does a system reset); at least that's what the official documentation says. So the impl...
I tried to put my application at the ota_0 partition but TinyUF2 would not boot it until an upload has occurred.
Upon checking the flash content, apparently, TinyUF2 has written something into nvs and otadata partition.
Is there any way to create a TinyUF2 binary that contains a precompiled binary file?
Add the new board MiniMain ESP32-S2.
USB PID provided by Espressif.
@sigprof thank for your input, do you think we can use one of the DBL_TAP_MAGIC_PROTECTION_OFF as way to go around the infinite loop and continue to with the update once protection if off. It is definitely need some handshake between self-update app and bootloader.
Thank you for your PR, I actually don't mind to have a bit of code duplication with f4, most stm32 families will have some shared code with each other. But they will have some difference especially flash API sooner or later. Also that make it easier to test/maintain, since the last thing we want with bootloader is unexpected behavior on L4 while doing some work with unrelated F4 mcu.
I could merge this PR as it is, but it would be nicer if you could
- add your board to ci, to make sure w...
can you elaborate what you do exactly ?
- what is your testing board, and what is its pre-flashing layout
- which binary is flashed to which parittion, and your flashing command
- what is the layout after flashing command.
Operating System
Windows 10
INFO_UF2.TXT
TinyUF2 Bootloader 0.9.0-5-g71a22e5-dirty - esp-idf (v4.4-dev-3608-gbbe2a1bf34) tinyusb (0.12.0-203-ga4cfd1c6)
Model: Adafruit Metro ESP32-S2
Board-ID: ESP32S2-Metro-revC
Date: Jun 15 2022
What happened ?
I'm working on a custom board with the ESP32-S2 and I've used the same neopixel pin as in the adafruit metro esp32-s2 board. I've used the bootloader definition for the metro board, however I've commented out the line:
#define P...
I'm not immediately sure why the build fails. The makefile works locally.
commenting out the macro will remove the respecting code, there is no question for that
https://github.com/adafruit/tinyuf2/blob/7b3933c925f398ce3d72530372252f1adcabd2a6/ports/espressif/components/bootloader/subproject/main/bootloader_start.c#L213
make sure you re-flash the boot2 stage bootloader, also please provide your uart output.
I have a great deal of confidence that I'm indeed flashing the correct bootloader because I've also tried changing the UF2_VOLUME_LABEL and it does take effect.
I'm flashing the newly compiled bootloader by simply plugging in the new tinyuf2.bin into the existing arduino flashing command. should I change anything else besides that?
I will try to poke around the serial output and post it here.
Hello wise ones 🙂
I am having trouble getting to the IOpins. (I'm new)
I cannot find amongst my (now enormous) collection of libraries an "RPi.GPIO".
This is on a Pimoroni Tiny2040.
can you elaborate what you do exactly ?
- what is your testing board, and what is its pre-flashing layout
- which binary is flashed to which parittion, and your flashing command
- what is the layout after flashing command.
- I'm using my own board but we can treat it as esp32-s3-devkitm-1.
- I'm flashing them via ESP32's flash download tool for testing. I flashed the bootloader manually with the following configuration generate by the build.
--flash_mode dio --flash...
0x0 bootloader/bootloader.bin
this is incorrect offset for bootloader, should be 0x1000. Make sure you flash it with
make BOARD=your-board flash
or its equivalent idf.py flash. There is flash_args file in the build folder that you can use.
0x0 bootloader/bootloader.bin
this is incorrect offset for bootloader, should be 0x1000. Make sure you flash it with
make BOARD=your-board flashor its equivalent idf.py flash. There is flash_args file in the build folder that you can use.
Not for ESP32-S3, its bootloader partition does indeed starts at 0x0.
Then, I flash my firmware directly into the ota_0 partition at 0x10000.
It won't be enough, you also need to set otadata to indicate the ota0 is valid partition. please check the esp doc for detail. TinyUF2 does also set this at the end of DFU if you are wondering on the code.
Then, I flash my firmware directly into the ota_0 partition at 0x10000.
It won't be enough, you also need to set otadata (parition) to indicate the ota0 is valid partition. please check the esp doc for detail. TinyUF2 does also set this at the end of DFU if you are wondering on the code.
Thank you, that was what I was wondering. I'm not sure did TinyUF2 write something custom into otadata/NVS or is that something standard.
Operating System
Windows 10
INFO_UF2.TXT
TinyUF2 Bootloader 0.9.4 - st/cmsis_device_f4 (v2.6.4-1-g2615e86) st/stm32f4xx_hal_driver (v1.7.9) tinyusb (0.12.0-203-ga4cfd1c69)
Model: Adafruit Feather STM32F405 Express
Board-ID: STM32F405-Feather-revB
Date: May 30 2022
What happened ?
TinyUF2 doesnt seem to be running programs copied over to the MSC.
How to reproduce ?
- Compile blink example for feather_stm32f405_express
- Convert bin to uf2 `uf2conv -c ...
can you attach both the bin and uf2 file here
that is not custom info, that is how otadata is intended to be used. Basically indicate which partition ota0, ota1 has a valid firmware and which one is active.
closed due to lack of response
closed due to lack of activities. it is possible but we don't have the time to do so. If anyone make an PR, I will be happy to review.
This one should be good to merge now :-)
thank you very much for the pr.
274f897 feat(swan_r5): alpha stm32l4 support. - m-mcgowan
1e42606 fix(stm32l4): updates the family ID for the L4 ... - m-mcgowan
b175c8d chore(stm32l4): catch up with latest stm32f4 ch... - m-mcgowan
da2adc3 add swan_r5 to the CI build - m-mcgowan
8b16843 Updates the board ID to follow uf2 spec - m-mcgowan
I tried it now with a proper metro esp32-s2 board - I commented out the PIN_DOUBLE_RESET_RC and changed the volume label to make sure I'm flashing the correct bootloader.
The volume label does change, but I still have the double tap to enter bootloader capability. I have no explanation for that.
could anyone else try to reproduce it?
I might be flashing my custom bootloader incorrectly. What I did is just to copy the command line from the Arduino ide and replaced the tinyuf2.bin on addr...
Just realized there's a separation between the tinyuf2 firmware and the actual 2nd stage bootloader which is a different bin file at address 0x1000.
When replacing both files in the command line everything works as expected.
thanks
just checking, did we manage to fix it previously. I kind of forgot.
I should have asked this before, but can you also share your simplest test project as github repo viewable and commentable for review. Make sure you got the linker correctly setup with flash layout for application (staring at correct address). It is probably better to convert with hex file than bin file.
I will find one example that works as well for your reference when I got time to pull out the board to test with.
It has not been fixed. I am pretty sure what I suggested is the fix. BOARD_BOOT_LENGTH needs to be whatever _text_length (from the memory.ld file) + 0x2000 to work properly.
I
if so, would you make an PR. I forgot most of the setup with imxrt, but I think other may hep to review the PR.
Patched boot length to include IVT structure and interrupt table. Previous value would cause weird issues if program size got near the .text section length
See Bug #208
OK. Done.
FYI, My port has been working good. It is now integrated in the latest model of some fireworks equipment:
The new 2022 hardware has tinyuf2 built in 😊
From: Ha Thach @.>
Sent: Monday, June 20, 2022 1:10 PM
To: adafruit/tinyuf2 @.>
Cc: Eli Hughes @.>; Author @.>
Subject: Re: [adafruit/tinyuf2] MIMXRT Port - Possible incorrect BOARD_BOOT_LENGTH being stuffed into boot_data struct (Issue #208)
if...
My pleasure! Is there a recommended process to make the compiled STM32L4 bootloader binary available to developers?
the compiled binaries is available for each ci commit https://github.com/adafruit/tinyuf2/actions/runs/2517588142
release binaries are also available under release page as well https://github.com/adafruit/tinyuf2/releases/tag/0.9.4 . Though you need to wait until our next release.
I think the issue is probably you didn't have correct linker script for your firmware application. The starting address must be 0x08010000 since vector table along with function call may or probably use absolute address. Can you double check that ?
e892e5a Add bootloader protection api - KarlK90
8c8f73b Add bootloader protection to stm32f4 boards - KarlK90
1633e6c Add board_flash_protect_bootloader stubs to ports - KarlK90
ebd3ca2 change board_flash_protect_bootloader to take b... - hathach
09f29f5 add port.mk for stm32f4, and add self-update build - hathach
I have updated the board_flash_protect_bootloader to take bool argument for protect/un-protect. I am trying to also get self-update to work with boot protection as well, however, I realize that self-update need quite a bit of additional changes and requires an cmsis f4 update to address the issue with vector table. I will merge this first and make an PR for self-update afterwards. Thank you very much for your effort and patience on this PR.
e892e5a Add bootloader protection api - KarlK90
8c8f73b Add bootloader protection to stm32f4 boards - KarlK90
1633e6c Add board_flash_protect_bootloader stubs to ports - KarlK90
ebd3ca2 change board_flash_protect_bootloader to take b... - hathach
09f29f5 add port.mk for stm32f4, and add self-update build - hathach
Sorry for late response, after TET, I kind of forget about this.
No problem, hope you had a good TET :tada:
I will merge this first and make an PR for self-update afterwards. Thank you very much for your effort and patience on this PR.
I was pretty busy in the last weeks that is why I didn't respond earlier. Thanks for the merge and taking over from here! Happy that I could provide a good starting point for the self-update feature.
@KarlK90 no problem at all, I fully understand the busy with other works well enough. Btw, I struggled a bit with old cmsis f4, since its system_stm32f4xx.c reset the vector table (SCB->VTOR) to default 0x08000000 (incorrect). Just update to latest cmsis, the later skip statement if not defined
I am putting thing up together, self-update may no...
d445647 verify new bootloader contents, and self-destru... - hathach
- implement self-update feature for stm32f4, close #47
- note this PR does not test with protected bootlaoder just yet #189 , will implement it as separated PR.
- tested bootloader protection with f4
- enable write protection for f4 by default
- add feature table to readme
847789a enable write protection for f4 by default - hathach
also if you are using cmsis f4 from ST, make sure you update to the latest, old version will incorrectly set the vector table. I have update readme for this note
https://github.com/adafruit/tinyuf2/blob/master/ports/stm32f4/README.md
f07f2e1 include self-update binary for f4 in release - hathach
refactor esp32 release upload
Though OTA is cool, I'd hazard to guess that fewer CircuitPython users would use OTA in general, and even be confident enough to guess hardly any use it all.
I'd like to see, not only a second UF2 option for ESP32-SX boards that has no OTA partitions laid out at all, and just a much bigger user file system partition, but also have that be the new default partition layout/binary and have OTA as a second option for those that want to use OTA.
I've spoken a few times with @tannewt about th...
thank you for keeping this PR update, I did pull and try to update this PR as well. Unfortunately the self-update target of stm32f4 still failed due to the false warnings from -Werror=stringop-overread gcc. This has been fixed in gcc 11.3. For now, we will suppress it with -Wno-error to get this merged asap.
https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=91f7d7e1bb6827bf8e0b7ba7eb949953a5b1bd18
88ff8ef switch to carlosperate/arm-none-eabi-gcc-action - hathach
- use carlosperate/arm-none-eabi-gcc-action for toolchain installation
- also add linkermap for size analysis
you could add partitions-8MB-noota.csv in additional to default with ota. If it is generic enough, it could be place along side with other csv in ports/expressif. If it is too specific to an board, you should put it under your board folder (with a bit of update to the path-to-csv)
Just got an ESP32-S2 TFT Feather from Adafruit myself, and have just had a similar "Huh?" moment upon realising my "4MB Flash" board has less than 1MB I can actually use for stuff in CP due to this. It does seem like a strange default unless this is really key to something I'm unaware of?
you could add then pick noota partitions layout for your board. I did answer similar question here https://github.com/adafruit/tinyuf2/issues/227#issuecomment-1168885128 . The tinyuf2 may need a few adjustment but not thing major.
This pull-request outputs a warning when a UF2 block is skipped due to mismatching UF2 family IDs. I found this useful when debugging an issue on my STM32F405 board.
If you believe this needs a discussion first or should be part of a larger logging effort then please feel free to reject it :grin:
there is a similar defined for logging here, would you mind update PR to use it instead. and also revert changes to the test files.
Thanks for the tip @hathach. I will take a look at using this instead.
[adafruit/tinyuf2] New comment on issue #74: cannot access I2C after soft reboot with UF2 bootloader
I guess this is fixed now in circuitpython and safe to close, right ?
[adafruit/tinyuf2] New comment on issue #131: Help with mounting errors on GigaDevice GD32VF103 port
@KarlK90 would you mind confirming if we could close this ?
[adafruit/tinyuf2] New comment on issue #74: cannot access I2C after soft reboot with UF2 bootloader
I think it should probably be re-tested first. @jerryneedell did you want to try re-testing? I don't have the sensors with me at the moment.
[adafruit/tinyuf2] New comment on issue #131: Help with mounting errors on GigaDevice GD32VF103 port
@hathach I'll finally open a PR to support tinyuf2 on GD32VF103 in the next days, we could close it afterwards?
hi @ehughes, sorry for the super late response, I got into too many bugs lately. And somehow this fell off my radar
The new 2022 hardware has tinyuf2 built in blush
Congrats, I am happy to here that tinyuf2 is stable enough to be deployed on your new hardware.
sorry for late response, I am pulling out the imxrt reference manual and rt1020 to test with. Please be patient for a bit longer :).
Superb !! I finally could wrap my head around this. This is indeed correct fix. Though I think we should best use all the linker symbol here to avoid the need to change this should we decide to expand the bootloader size in the future. I will try to make a update
I have updated to defined the BOARD_BOOT_LENGTH following the ideal suggestion in your previous comment. Which is based on the linker symbol. Tested with printf and the value is correctly 0x9000 now. Thank you very much for your PR.
38a61e6 fix build with rt1024evk, update linker followi... - hathach
555cc1d update build script to parallel building - hathach
71a89e4 fix rt1021 1024 flash config location - hathach
efe5ae7 correct the led pin for rt1024 - hathach
dc77a05 write_tinyuf2_to_flash() take into acccount of ... - hathach
follow up to #220
- fix write address of rt1020/rt1024 0x60000000
- add uart to rt1020 rt1024
- fix rt1024 LED
- update rt1024 ld ram to match 1020
- fix write_tinyuf2_to_flash() to also include fcbb as well.
Operating System
Linux
INFO_UF2.TXT
TinyUF2 Bootloader 0.10.2-21-g71a89e4-dirty - nxp/mcux-sdk (MCUX_2.10.0-25-ga242602a) tinyusb (0.12.0-203-ga4cfd1c6)
Model: NXP RT1024 EVK
Board-ID: MIMXRT1024-EVK-revA
Date: Jul 15 2022
What happened ?
flash-sdpwork, bootloader seems to run well on SRAM, and seems to write to flash- however when reset, the booROM run again instead of the tinyuf2 even though the boot switch is set to normal
10
This seems to indicate there is ...
38a61e6 fix build with rt1024evk, update linker followi... - hathach
555cc1d update build script to parallel building - hathach
71a89e4 fix rt1021 1024 flash config location - hathach
efe5ae7 correct the led pin for rt1024 - hathach
28fa2d5 write_tinyuf2_to_flash() take into acccount of ... - hathach
Is your feature request related to a problem? Please describe.
CDC interface allow esptool to request board into bootrom for downloading. A bit more convenience