Closed smymm closed 2 months ago
This is amazing @smymm, great thanks to you and @jeroentaverne for all of this work! It makes the card even more flexible than it was before.
I'll be merging this shortly and this will definitely be part of the next official firmware release. There are a few things I'll want to do before doing the release – for example I want to extend the permanent mode switch storage to also allow saving other pgusinit settings. For example there are settings for upcoming serial mouse emulation that I want to keep sticky at boot time. I also will need to integrate the multiple builds into the GitHub action.
I would probably move the FLASH programming of the last sector to the firmware code which receives the pgusinit init values. The bootloader only needs to check the scratch register and one byte in FLASH. Also note that more scratch registers are available to pass data to the bootloader. By changing the start positions of the different firmwares the resulting combined firmware size can be reduced.
Merging this! I'm going to start a new branch to implement the suggestions @jeroentaverne has, and make a PR and tag you @smymm and @jeroentaverne.
The flash programming of the permanent mode selection I'll do as a step of permanently setting pgusinit options, because I also want to permanently store other pgusinit settings there.
I've already made some changes to create_release.sh to build each firmware, calculate the size and offset, and re-link. This reduces the size of the pg-muiti.uf2 from 2.7MB to 848KB.
Calculate and relink is a nice feature! I will add it to my project as well.
Flash only one file: pg-multi.uf2 only one time. It contains all firmwares (6 at this moment). You can change between them in DOS:
New usage for this version:
Examples of use:
You have default mode as GUS mode on boot, want to change mode to SB, but only temporarily:
pgusinit /m 2
You want to change the default (permanent) mode of the card to SB mode, and the next system cold boots / hard resets / power offs you want to stay in SB mode without using pgusinit:
pgusinit /m 2 d
Credits go to @jeroentaverne for his great multifw code for the pico https://github.com/jeroentaverne/pico_multi_firmware