Want .uf2 files for your switch hacking needs? If you request a payload be converted I should get around to it somewhat quickly. Here are the ones I have done currently.This is mainly meant for the https://github.com/euclala/RCM_typeC_ex Switch RCM-X86 dongle but it might work for other dongles and internal mods for the switch if it's based upon the Adafruit Trinket M0 board, but don't quote me on that :)
Please note: This guide was made for users who have the Windows as their OS, while most of it could work for Mac OS or Linux I can not help you there, I have no experience on Mac OS and only use Linux on occasion or for hobby things. Most things should translate over somewhat evenly but the batch files probably won't.
I take no credit for any files in this repository (credits at the end of readme), except the few files that I made (those being the batch files), and I am not at fault for whatever harm they may or may not bring. All these files I located on the internet and I have modified a few of them (just to get them working and/or patched for this project) to make sure they work properly. You have been warned.
- Python 3.x.x (I'm using 3.8.5 as of making this)
- Arduino IDE (with the required archives, info taken from euclala's repository on how to do this)
- Download and install Python https://www.python.org/downloads/
- Download and install arduino IDE. http://www.arduino.cc/en/Main/Software
- In Arduino: go to "File > Preferences > Additional Board Manager URLs" and add the following URL:
-
https://adafruit.github.io/arduino-board-index/package_adafruit_index.json
- Go to "Tools > Board > Board Manager" select Type:All and
- Install "Arduino SAMD Boards" by Arduino (This may take some time)
- Install "Adafruit SAMD Boards" by Adafruit (This may take some time)
- Select the Trinket M0 with "Tools > Board > Adafruit SAMD > Adafruit Trinket M0"
- Go to "Sketch > Include Library > Manage Libraries"
- Install "USBHost" by Arduino
- Download the files in the build folder or the latest release of Build.7z (working from the build folder makes it easy and keeps all of the files together)
- Python must be installed to path to work properly.
(payload.bin to payload.h conversion)
Once you reach this step you're mostly set up to make your own .uf2 files.
(Note: The build.ino is from euclala's repository as well as one of the python files, with the other one being from microsoft. The batch files I created to make the python files a little easier to use.)
- If you want to use the python files instead of the batch files
- Open cmd and cd to the location where you are working (the command is
cd %file\location%
) - Run this command in cmd
python binConverter.py %nameofpayload%.bin
to convert the .bin file to the %nameofpayload%.h file needed for build.ino.
- Open cmd and cd to the location where you are working (the command is
- If you want to use the batch files (easier)
- Open 1binConverter.bat and enter the
%nameofpayload.bin%
.(including the .bin part of it.) It will convert the .bin file to the %nameofpayload%.h file needed for build.ino.
- Open 1binConverter.bat and enter the
You could rename the %nameofpayload%.h or something easy but keep in mind you will still have to edit the build.ino to work.
(Using the build.ino to create binary and/or push binary to the board)
If you have your own cfw you want to make a .uf2 file for for you can name it accordingly and add it somewhere following 16 using the same format as the other options. I left lines 17 and 18 set up in a "blank" state so if you want you can edit them quickly. (note: to use the build.ino you will have to edit it almost every time its used but its set up to do so easily, just remove the 2 forward slashes in front of the #include "%name.h%" you want to use and make sure the others have 2 forward slashes in front of them, if they do not the program will fail to compile)
For example, let’s say you want to convert argon-nx, but you also have your own homemade cfw and add it to the list:
//#include "sxos.h"
//#include "rajnx.h"
//#include "hekate.h"
//#include "reinx.h"
#include "argon-nx.h"
//#include "homemadecfw01.h"
//#include "homemadecfw02.h"
Using the 2 forward slashes nulls the lines it’s on. This makes switching cfw builds easy as adding and removing 2 forward slashes. It does not matter the order they are in as long as only 1 is activated when running.
Now your %nameofpayload%.h file should in the same folder as the build.ino, if so you are ready for the next step. At this time I would verify you have the proper board selected ("Tools > Board > Adafruit SAMD > Adafruit Trinket M0")
Once the proper board is selected you can activate the right file in the build.ino. Like above you are going to remove the 2 forward slashes in front of the line of code you want to activate, and make sure the other #include %payloads%.h files are disabled. Now you should be able to verify the code using the verification button. When it's done verifying you can export the compiled binary under "Sketch > Export Compiled Binary". It should save to the build folder as build.ino.trinket_m0.bin.
Once you have your build.ino.trinket_m0.bin (not a payload.bin, this is a binary file) compiled from arduino IDE you can close arduino IDE. You can continue to the "Final stretch" to finish making the .uf2 file. (While you can flash the board directly from the Arduino IDE, it requires a little bit more work, you can continue to "The little bit more work" if you want to setup directly board flashing.
- The little bit more work (flashing the board directly)
- A driver is required to push the binary to the dongle from arduino IDE, it can be found here or if you want to get it yourself it is called adafruit_drivers_2.2.0.0.exe (It is also in the Credits)
- Warning! Connect the dongle to your computer and do not Click the Reset Button. Do not Click the Reset Button. Do not Click the Reset Button. (This is the warning given by euclala for the RMCx86)
- You can verify the file and then upload the compiled binary to the dongle under "Tools > Port> trinket M0".
(Turning the binary .bin into a .uf2 file)
- If you want to use the python files instead of the batch files
- Open cmd and cd to the location where you are working (the command is
cd %file\location%
) - Run this command in cmd
python uf2conv.py -o %nameofpayload%.uf2 build.ino.trinket_m0.bin
- Open cmd and cd to the location where you are working (the command is
- If you want to use the batch files (easier)
- Open 2uf2conv.bat and input the name you would like the .uf2 to output as %name_of_file%.uf2 (do not add the file extension in the batch file, it is coded into the batch file and not needed).
If done correctly the %name_of_file%.uf2 should have been created in the build folder. Put this file on your Adafruit Trinket M0 board however you normally do.
Credits:
Euclala for the build.ino and the binConverter.py
Microsoft for the uf2conv.py
Adafruit for the drivers
Link to build.ino, I have literally only added a 3 lines to it.
Link to binConverter.py, I have changed mine a little but it's still mostly their code .
Link to uf2conv.py, I did have to edit this one quite a bit if I remember right.
Link to driver directly here or release page