Hacking SAMD Fusee Payload Launcher V2

  • Thread starter Thread starter electronrancher
  • Start date Start date
  • Views Views 35,308
  • Replies Replies 136
  • Likes Likes 12
UF2, to my knowledge, is just a container for pages of data with some metadata attached. When the bootloader gets a UF2 block sent from PC, it checks where to write it to and then flashes the data directly to that page in the chip. I agree, that function is not using any flash storage other than what the code resides in. Seems that functionality could remain in place - when a file is written, check each block for the UF2 magic and if so - flash it.

I'll check out circuitpy bootloader. I was looking at the mass storage examples from Atmel and others to get a better understanding on how an actual flash drive services requests. Seems reasonable, but not that small. :)

Yep circuitpy flash drive emulation is very slick. But damn is that code a massive tangle!
 
Last edited by electronrancher,
UF2, to my knowledge, is just a container for pages of data with some metadata attached.

Yep thats exactly what it is.

Just keeps going to EoF and filling unwritten blocks with FF.

Seems an awful lot of wasted space in one doesn`t there?

Headers don`t change apart from incrementing one byte every 512b as per the spec.

Doing anything else would "break" this spec. Should we do this?
 
. Should we do this?

Yes, definitely. :). Now that I have played with circuitpy, I don't think an edit to the bootloader is needed. What do you think about leaving the bootloader as-is, and in "normal" mode try to find a switch for 30 seconds.. if none is found then assume we're connected to PC and enumerate as a flash drive where user can drop a new bin file.

All UF2 crap remains untouched, so 0-0x2000 still belongs to samdx1 bootloader. Do you happen to know how big the fusee launcher code is neglecting the payload?
 
Just under 17kbytes.

Need a way of reducing the UF2 image size somehow.

Don`t forget that UF2 isn`t a true format ie the UF2 isn`t run each time, rather it flashes the chip based on whats inside the UF2.

--------------------- MERGED ---------------------------

It is double the size of your flash, as half of the UF2 is payload and the other half is the block "map". So, with 256k flash, the UF2 will be 512k.

The bootloader needs to be modified I`m convinced of that. AFAIK, the virtual TRINKETBOOT UF2 drive cannot store values in a file.
 
Dude... This is incredible work, I'm very impressed with what you've managed to build for the community... Good job dude! :D
Thanks, it's really great to hear such nice feedback!

--------------------- MERGED ---------------------------

Just under 17kbytes.

Need a way of reducing the UF2 image size somehow.

Don`t forget that UF2 isn`t a true format ie the UF2 isn`t run each time, rather it flashes the chip based on whats inside the UF2.

--------------------- MERGED ---------------------------

It is double the size of your flash, as half of the UF2 is payload and the other half is the block "map". So, with 256k flash, the UF2 will be 512k.

The bootloader needs to be modified I`m convinced of that. AFAIK, the virtual TRINKETBOOT UF2 drive cannot store values in a file.

Yes I realize the uf2 is just a wrapper and its not directly flashed to the chip. Also, I thought the UF2 data was flashed chunk by chunk as the OS writes the file to the virtual flash drive. So no storage space is needed save for a ram buffer to hold the incoming chunk of UF2. No?

I don't think any changes are needed to the bootloader. I think the launcher firmware just needs the tiny tweak of emulating a FAT capable mass storage device ala micropython on esp8266 or circuitpython on samd. :) And then we drop the bin file on there.

Piece of cake, lol.
 
  • Like
Reactions: Jayro
I have been working on a solution this afternoon.

Works.

Just boot any .bin from SD card. Keep an eye on my thread.

Just finalising stuff then will write up.

No converting any payloads or any nonsense, just put your bin on SD card and boots straight away.
 
I have been working on a solution this afternoon.

Works.

Just boot any .bin from SD card. Keep an eye on my thread.

Just finalising stuff then will write up.

No converting any payloads or any nonsense, just put your bin on SD card and boots straight away.

Oh yeah, that sounds very slick can't wait to check it out! So you're coding payloads now? Killer!
 
Just a note - I have upgraded to a better LED vendor! I changed the green power LED to a super-bright red and changed the blue activity to a super bright blue!

Nice and shiny blinky goodness at the same low current draw for thousands of launches on a single CR2032 battery!

The first few runs all used green, but the batch I sent out last night was a mix of red and green, so if you recently placed an order you may get either color. For orders starting with today's batch, you'll get the new LEDs.
 
I don't really have one of these yet... I DO want to buy one, but I'm holding out for this:
More case designs to come as the first round of boards arrive at their destinations!
a.png

I just want them in red-and-blue to match my joycons. :P

But I misunderstood how switching payloads initially worked... I thought it showed up as a USB flash drive and you can just drop in the payload file (like what you guys are trying to achieve right now). I DO hope you eventually pull it off, but in the meantime... I was kinda thrown off by the need to recompile a new UF2 with the Arduino dev tools just to replace the payload... didn't want to have to download, setup, and learn a new dev environment just to switch payloads.

So I threw together this tool, that can patch a payload into any valid CURRENT.UF2, just drag the payload file onto the script (I was planning to use this if/when a red/blue case dongle becomes available). And hopefully this is of some use until you guys achieve the "drag-and-drop the payload into the mass storage device" functionality.

EDIT: Please use the files from this post instead

Also attached is a few UNTESTED generated UF2s (with biskeydumpv6 and JigTester payloads). Untested because I haven't bought this dongle yet, so I am not responsible if these break your Switch. :P
 

Attachments

Last edited by bundat,
I don't really have one of these yet... I DO want to buy one, but I'm holding out for this:

View attachment 143257
I just want them in red-and-blue to match my joycons. :P

But I misunderstood how switching payloads initially worked... I thought it showed up as a USB flash drive and you can just drop in the payload file (like what you guys are trying to achieve right now). I DO hope you eventually pull it off, but in the meantime... I was kinda thrown off by the need to recompile a new UF2 with the Arduino dev tools just to replace the payload... didn't want to have to download, setup, and learn a new dev environment just to switch payloads.

So I threw together this tool, that can patch a payload into any valid CURRENT.UF2, just drag the payload file onto the script (I was planning to use this if/when a red/blue case dongle becomes available). And hopefully this is of some use until you guys achieve the "drag-and-drop the payload into the mass storage device" functionality.

Also attached is a few UNTESTED generated UF2s (with biskeydumpv6 and JigTester payloads). Untested because I haven't bought this dongle yet, so I am not responsible if these break your Switch. :P

Very good will check it out later.

I have a solution that just involves dragging the payload.bin to SD card
 
I have just received my loader it is amazing. I try'd to connect to my computer and nothing. I have followed all the steps but it only show's the short blinking blue light while plugged in via the usb and my computer doesn't even see that it is connected.
 
I have just received my loader it is amazing. I try'd to connect to my computer and nothing. I have followed all the steps but it only show's the short blinking blue light while plugged in via the usb and my computer doesn't even see that it is connected.
It won`t do as it is in host mode. Double-press reset...
 
I hope you are not offended when I say this. I`m not insulting your intelligence, really I am not!

But... You are double-pressing reset while it is plugged in to PC right?

Sorry if its bloody obvious! Just covering all bases.

--------------------- MERGED ---------------------------

@electronrancher

Try this...

I`m assuming your device is compatible with Trinket UF2`s
Go to my Github https://github.com/mattytrog/SAMD-ShaXLauncher/tree/master/UF2 Files
and put your chosen UF2 on there...

I`ve attached a zip called datsandpayloads. In there are some files. Extract to root of SD, drag UF2 over

You can run any payload without converting it.

First one is called payload.bin
2 - payloa2.bin
3 - payloa3.bin
4 - payloa4.bin
...
...

etc

up to 8 payloads.

No conversion necessary, just drag and drop. Rename too as above or it won`t work.
Any good?
 

Attachments

  • Like
Reactions: electronrancher
I hope you are not offended when I say this. I`m not insulting your intelligence, really I am not!

But... You are double-pressing reset while it is plugged in to PC right?

Sorry if its bloody obvious! Just covering all bases.
I hope you are not offended when I say this. I`m not insulting your intelligence, really I am not!

But... You are double-pressing reset while it is plugged in to PC right?

Sorry if its bloody obvious! Just covering all bases.



No totally understand, No offense at all. I have double pressed still only the blinking blue light and not seen as connected in any way to the computer. It is not being seen in the IDE either doesn't show in the ports.

--------------------- MERGED ---------------------------

Thank you for the help found the problem. Should have try'd before asking i was using a usb cable that i guess wasn't good it connect and expressed power but i guess couldn't transfer data. Thank you
 

Site & Scene News

Popular threads in this forum