webhdx / PicoBoot

Raspberry Pi Pico (RP2040) based IPL replacement modchip for GameCube
GNU General Public License v2.0
1.46k stars 93 forks source link

Turn PicoBoot into full DOL-RTC replacement #63

Open webhdx opened 1 year ago

webhdx commented 1 year ago

PicoBoot's popularity contributed to a huge pile of broken consoles as people who's never soldered anything are now trying to install it. Usually they manage to break IPL chip which unfortunately is not replaceable. By far no one came with a replacement chip that could fix all dead GameCubes.

I've started researching what could be done to provide DOL-RTC replacement and it may be possible with Pico.

The original IC has multiple functionalities:

This could be potentially implemented on Pico in the future. Prior to that we definitely need to have: #62 and #59.

Should PicoBoot even cover this? I feel like it shouldn't be mixed with PicoBoot, maybe separate project would be better and could utilize custom PCB? Of course people will expect this replacement to act as a modchip. It feels like a derivative from PicoBoot with more features that should not be pushed into mainline PicoBoot firmware as we don't have too much memory to spare.

ROM

This is the easiest part as this is what PicoBoot is basically doing at the moment

RTC

This one is tricky. RP2040 has builtin RTC so it doesn't require external modules but you still need to keep Pico powered by a backup battery. The question is how long can you power Pico from cell battery? I haven't checked any deep sleep modes yet but if I had to guess it'll deplete the battery much faster than original IC. My another idea was to eliminate the battery completely and rely on setting up the clock with NTP via network. This seemingly won't work as you'd need a few seconds before NTP could be accessed (setting up network, DHCP, DNS all add up).

Update: The more I think about NTP I start to believe it may actually work. Since RTC is first accessed by BS2 or Swiss we can simply run our code before that ever happens. The bootloader (#61) can wait until time is synchronized and then proceed to load Swiss or IPL. There would be a few seconds penalty but it isn't that bad given you will never have to worry about replacing coin battery ever again.

SRAM

Easy to emulate with SRAM available on Pico. Since my goal would be to eliminate coin cell battery, the SRAM should be backed up in Pico's flash and restored on boot. This seems like an easy job. Writing SRAM to flash should only happen when it's updated by i.e. when changing screen setting or language.

Extrems commented 1 year ago

The AD16 is a Serial Port 2 device. It's not part of the RTC-DOL.

webhdx commented 1 year ago

Thanks, updated the description. I wrote it quickly off my head without checking if it makes sense 😅

Grayda commented 1 year ago

Not sure if I'm missing something here, but could you just set a "default" time and date (e.g. 1/1/2000 00:00:00) to avoid the RTC boot penalty, then just update the clock once you've got the time from an NTP server? If there's only a few seconds delay between boot and getting the time, I doubt most people would notice.

the0remora commented 1 year ago

So this would allow the clock to go past 2030?

Extrems commented 1 year ago

The clock already goes up to 2136.

brucenovaa commented 2 weeks ago

Hi!!! Thank you for the great work put in this project. I saw that there's a roadmap for the picoboot, but this one is way below on priority, and would like to know if there's anything that I could do to help here. I bought a bunch of GameCubes with busted ipl-rtc chips, and helping finalize this roadmap would benefit me a hundreds more. (Sorry for my bad English)