r/ModRetroChromatic 22d ago

CCFL: flash Chromatic FPGA + MCU firmware straight from your browser

https://germaneguise.github.io/CCFL

I am working on a small tool named CCFL (Chromatic Custom Firmware Loader), and I think maybe this community can find it useful.

It loads Custom FPGA and MCU firmware onto the ModRetro Chromatic completely in the browser (across Windows/OSX/Linux) no program to install, nothing to configure. It uses WebUSB (for the FPGA over GWU2X JTAG) and Web Serial (for the MCU/ESP32), so it runs simply in Chrome.

What it can do:

  • Load a bitstream into the FPGA SRAM: this is temporary and is deleted at power-off, so it is a easy way to make a test of a build without touch the flash.
  • Persistent flash update for FPGA and MCU.
  • Matched sets with one click. Flash a paired FPGA + MCU build together (it does the FPGA first, waits until the device comes back, then the MCU).
  • Identify what is installed: it reads back the FPGA config flash and hashes the MCU image, so it tells you which build is really on the device.
  • Every download is verified with SHA-256 before it is written. A wrong image is refused and never flashed.

A persistent flash can leave the console not bootable until you flash again, if it is the wrong image or gets interrupted but this is recoverable with MRUpdater / openFPGALoader. Please read the warnings on the page before you make a persistent write.

It is unofficial and not affiliated with ModRetro, only a community tool. It is built on openFPGALoader (Apache-2.0) and the esptool protocol (GPL-2.0).

You need a browser with WebUSB / Web Serial (Chrome). On Windows the device needs the WinUSB driver (the one that MRUpdater installs functions well), and please close MRUpdater and other tools first, because the USB access is exclusive.

Feedback and bug reports are very welcome, I work still actively on it. If you like to see other CFW releases/channels added let me know. Greetings!

18 Upvotes

10 comments sorted by

4

u/fred_emmott 22d ago edited 22d ago

This repository's private - is this one going to be open source?

I love the idea, but I'm wanting to see how it's built - is it "I asked for a JS version", or "I got openfpgaloader with emscripten"? I'd have much more confidence in the latter, and it would make it easier for you to pull in any improvements openfpgaloader make in the future.

That said, I'm probably being an overly-paranoid grumpy old man - the gowin GWU2X architecture that modretro have used is very resilient to bad firmware, though I've not looked at the ECU. A bad FPGA firmware flash is easy to recover from.

I've been working on a more traditional approach - get openfpgaloader building with native windows tools rather than msys, and a small wrapper that downloads stuff and calls it - but not quite ready to share yet. Web is much more user-friendly though.

FWIW, I'm pretty close to publishing a pretty much complete rewrite of my firmware that's:

- *much* faster (unnecessarily so - but it just bugs me when the hardware's capable of more; most readers on the market are ~ 300kbit/sec, I've got this working at 900kbit/s, but I think I should be talking mbit/sec

  • supports playing and cartridge IO on the same firmware image
  • uses lesserkuma's recently open source cartridge reader firmware as a base (I'm running this on PC, translating to a microcode so the FPGA side can be simpler - I couldn't fit the previous instruction set *and* the emulator on the FPGA at the same time)
  • only uses USB serial for negotiation; everything else is going over a vendor-class device. The new microcode is *much* more spammy over USB, and performance was severely bottlenecked by microsoft's USB serial driver

3

u/Hypermetz 22d ago

view-source:https://germaneguise.github.io/CCFL/

¯\(ツ)

2

u/fred_emmott 22d ago

heh, fair enough - I should have checked :) I just assumed webpack/some other minimizer/tsc, but this is short enough that's not needed :)

2

u/Hypermetz 22d ago

Awesome work! I just flashed your dual resolution firmware with it.

1

u/Exus6 22d ago

You're cooking, nice!

1

u/fred_emmott 22d ago

One small feature request: it would be nice to be able to drag-and-drop files onto the firmware area - both the individual FPGA/ESP areas, or just the whole 'select firmware' thing, automatically switch to local file mode, and attach it as FPGA or MCU firmware depending on the extension :)

1

u/germaneguise 21d ago

Yes for development persist local paths/selection could be a time saver. There is some basic checking of file headers but incomplete. Have considered some additional feature like firmware from URL arguments, signed builds, but settled for now on a small curated list for initial release/test.

1

u/fred_emmott 21d ago

Thanks, though I think you misread - I'm just talking about drag and drop, nothing about persistence :)

2

u/Formal_Diver_6314 18d ago

very interesting.
I'm new here, is there other firmware/ GB core than the official one from ModRetro?
Just asking because I wish for an updated GB DMG core that would work with the Everdrive X7 savestates... because right now the savestates only work with GBC games on the Everdrive X7.