Project:

ecgc

Date:

08/01/2023

Progress on boot ROM programmer

Welp, there goes my promise of regular posts. In my defence, I got allotted 1 day a week on the project. This would mean posts would be made for 3 days worth of work, which is much too little for any significant development.

I also (purposefully) procrastinated on working on the project. I can't get any work done in 1 day a week working schedule, so I pushed all work to after the new year.

But leaving that aside, let me explain what I have the last week.

Programmer concept

As I've discussed in my previous post, I planned to spend my time on fixing the issue of slow boot ROM development. I was planning to make a kind of programmer to only re-program the boot ROM, making it much easier and faster to test and deploy boot images. I have since made some progress designing and developing a solution.

functional-design
Figure 1. Functional concept of debug core

The main idea here is that the boot ROM will be able to be programmed via SPI. To reach this goal, I will need some extra components in my design.

The main difference is that there will now be a debug core. It's job is to set the internals such that programming via SPI is possible. This includes:

  • Putting the Gameboy in reset before programming and taking it off when finished.
  • Disallowing the GB decoder to master the WishBone crossbar.
  • Controlling the DMA to move data between SPI controller and boot ROM.
  • Allowing writes to boot ROM during programming.

I plan to use the DMA core for handling data movement, since that means the debug core does not need to implement a WishBone master. I did already plan to included a DMA peripheral for quick transfer between SD card and DRAM, so I think this will save me resources. I do doubt if it will save much space (if any), since the DMA still would need to be configured somehow. We will see how details iron themselves out during development.

Programmer implementation

I've already started on the programmer. Its job is to take the program sent by my PC and flash and verify the program to boot ROM. I didn't think to long about it and just used an Arduino Pro Mini I had laying around. It can operate with 3.3V logic signals, which is the same operating voltage as the cart.

I decided to use the serial port of the Arduino board to send commands to the programmer. The Arduino provides simple tools for this, so it seemed like to most simple method. The code running on the Arduino can be found in my ecgc-spi-programmer repo.

The current implementation is quite simple, only accepting commands for SPI data transmission. In the future, the programmer will also concern itself with the debug core's control signals.

I will also probably solder together some wires and headers to easily insert the programmer into the prototyping board of the cartridge. I currently have the Arduino on a breadboard with haphazard jumper wires, which I don't really trust (see photo below). It also makes the assembly more difficult to stash somewhere in my room.

messy-wires
Figure 2. Help, I have no spare jumper wires

The eventual plan with the programmer is that it can be controller via my PC. This would allow me to make an upload script, which sends the correct commands and boot image to the programmer.

Closing remarks

I hoped to have more progress, but the development of a programming feature is surprisingly more difficult then anticipated.

I had another software-based approach to programming, where the Gameboy itself would read SPI data and program the boot ROM. But I eventually found problems with this method and abandoned it.

I do think that this method will work though. Hopefully I can finish it quickly so that I can continue on the software. I still need to write the entire bootloader, which will certainly prove difficult.

I've learned my lesson in promising regular posts, so the next one will come when its time has come. I do wish the reader a happy new year and to look forward to a working programmer.

<-- Previous post

All posts

Next post -->