Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added Arduino/main/CURRENT.UF2
Binary file not shown.
Binary file not shown.
6 changes: 6 additions & 0 deletions Arduino/main/How to use UF2Conv.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
py uf2conv.py hekate_compiled_from_arduino.bin -o Hekate_uf2.uf2

OR

py uf2conv.py hekate_compiled_from_arduino.bin
if the switch is connected to the computer in bootloader mode
22 changes: 22 additions & 0 deletions Arduino/main/How to use.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Step 1: Run `binConverter.py hekate.bin` inside of `Arduino/main` to get `Arduino/main/hekate.h`

Step 2: Open Arduino/main/main.ino with Arduino

Step 3(Make sure board steps have been completed in the main readme.md):
Sketch > Export Compiled Binary. Save to `Arduino/main`. This will create a new .bin file.

Step 4: Run `uf2Conv.py Arduino/main/nameOfBinFile.bin -o path/to/NEW.uf2` to convert exported bin to UF2.
OPTIONALLY: If your switch is in HOS mode and the modchip is in bootloader mode, and connected to your PC already, you can run:
`uf2Conv.py Arduino/main/nameOfBinFile.bin` to flash to the chip directly.

Step 5: Rename to `NEW.uf2

Step 6: Plug Switch into PC USB.

Step 7: Boot into Nintendo OS (HOS).

Step 8: Double tap modchip button.

Step 9: Drag new `NEW.UF2` onto Modchip Drive.

Profit!
55 changes: 55 additions & 0 deletions Arduino/main/binConverter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import sys
import binascii
import os


def printProgressBar(progress):
i = int(progress * 20)
sys.stdout.write('\r')
sys.stdout.write("[%-20s] %d%%" % ('='*i, 5*i))
sys.stdout.flush()

def openFileToByte_generator(filename , chunkSize = 128):
fileSize = os.stat(filename).st_size
readBytes = 0.0
with open(filename, "rb") as f:
while True:
chunk = f.read(chunkSize)
readBytes += chunkSize
printProgressBar(readBytes/float(fileSize))
if chunk:
for byte in chunk:
yield byte
else:
break


if(len(sys.argv) is not 2):
sys.exit('usage: binConverter.py "pathToFile\\fileName.bin"')

fileIn = sys.argv[1]


base = os.path.splitext(fileIn)[0]
fileOut = base + ".h"

stringBuffer = "\t"
countBytes = 0
print("reading file: " + fileIn)

for byte in openFileToByte_generator(fileIn,16):
countBytes += 1
stringBuffer += "0x"+binascii.hexlify(byte).decode('ascii')+", "
if countBytes%16 is 0:
stringBuffer += "\n\t"



stringBuffer = "#include <Arduino.h> \n \n#define FUSEE_BIN_SIZE " + str(countBytes) + "\nconst PROGMEM byte fuseeBin[FUSEE_BIN_SIZE] = {\n" + stringBuffer + "\n};"

print("\nwriting file: " + fileOut)
text_file = open(fileOut, "w")
text_file.write(stringBuffer)
text_file.close()

print("finished")
Binary file not shown.
Binary file not shown.
Loading