From what I read online, it seems impossible to load programs onto an Arduino without the use of a programmer, or a bootloader+computer. From my understanding, the arduboy loads games from flash, and I was mostly wondering: how?
The original Arduboy can only load programs via a serial connection from some external source like a computer. When it does that, it’s actually the bootloader that’s in charge of writing the data transmitted via the serial connection onto the Arduboy’s on-board internal flash memory.
The Arduboy FX on the other hand has a built-in external memory chip (the Flash Expansion or FX chip) that has programs stored on it, and the bootloader is a custom bootloader that knows about the existance of the FX chip, so it knows how to read the chip, detect which games are on it, and provide a menu that displays all the on-chip games. From there it’s capable of loading the game onto the on-board internal flash memory just as before. Ultimately the only difference between the two kinds of upload process is where the game data is coming from: in the ordinary upload method it’s transmitted via a USB serial connection, and in the FX method it’s being read from the built-in external memory chip.
(When I say the FX memory is ‘external’ and the other flash memory is ‘on-board’ and ‘internal’ I mean that the ‘internal’ memory is actually built into the Arduboy’s processor and the ‘external’ memory is on a separate chip that has been connected to the processor after-the-fact. Both are actually inside the Arduboy’s case, and both use flash memory, but they are connected differently and have different characteristics. The FX chip is communicated with via SPI whereas the on-board/internal memory is actually part of the processor and can’t be separated from its ability to function. The internal memory is also the only memory from which the processor can run its native machine code, so any computer instructions must be actually stored in the internal memory, which is why the bootloader has to copy the game from the FX chip into the internal memory.)
Apologies if any of that is confusing or overly technical, but hopefully I’ve got the general idea across at least. If not, feel free to ask for clarifications or further explanations.
(Some of what I’ve said is technical terminology, some of it is just informal and a bit handwavey.)
I’m actually looking for as technical of an explanation as possible, and that answered most of my questions brilliantly. I was asking because I was wondering if it would be possible to make an Arduino-based console that could load games from cartridges.
Considering the FX chip is just a flash memory chip, in theory this would be possible, right? It would be like switching out the FX chip with another one with different games, would the processor even notice?
Theoretically yes, but the FX chip is already like one of those ‘200 games in one’ cartridges.
The Arduboy’s internal flash is 32,768 bytes (32KB) in total, with 4,096 bytes (4KB) of that reserved for the bootloader, so it can only load 28,672 bytes (28KB) of machine code and on-board data.
In comparison, the FX chip is 16MB in size; 16,777,216 bytes! That means you could theoretically fit just under 512 normal-sized games on board. There’s some additional overhead for each game to keep track of things like the game’s name, image for the bootloader menu, the next game in the list et cetera, all of which would eat into that total slightly, but even with that factored in you’re likely looking at 300-400 games, which is actually more or less the number of games that are actually registered on the FX cart builder system.
Not to say you couldn’t do it though. Technically it has actually already been done - the prototype FX units during ‘project falcon’ actually worked like that. But the thing is that it would be so inefficient/such a waste of memory that it would pretty much be just for show. Then again, the memory chips are relatively cheap, so the cost wouldn’t be prohibative, it would just be wasteful.
Edit: This was more difficult to dig up than I was anticipating…
The little blue thing is a removable cartridge with the same kind of chip that production FX models have and a 3D printed outer shell. It was designed by @Mr.Blinky.
That’s more tricky to answer.
As I say, the machine code for the game has to be copied onto internal memory, so even if you did develop a cartridge system you’d need to make the bootloader copy the machine code across before a game could be played.
It might be possible to wire things up such that attaching and detaching a cartridge activates an interrupt, in which case the processor would notice, but I don’t actually know if there are any spare pins on the Arduboy’s processor that would allow that to happen.
It may be possible as is, it may only be possible with some reconfiguring, or it may not be possible - it depends on the specifics and I’m not certain of those. Someone who knows more about the hardware could probably answer that better than I could.
That little lightning bolt takes to that thread btw you might have muted it a long time ago. I should probably look at this navigation bar again.
As @pharap noted the original implementation of the flash mod was exactly this, to offer user replaceable carts.
At the end of the day, anything is possible! That’s one of my favorite things about the Arduboy, is it opens peoples minds to that you can control electronics to do what you want!
The bootloader does a cart (flash) detection on the loader screen so carts can be changed while on the loader screen. When a cart is changed you can use left/right to browse the new carts contents.
Check out the flash cart thread. This is what started it all.