The Arduboy’s CPU (the ATmega32u4) has 32KiB of flash memory (typically referred to as ‘progmem’, and of which 4KiB is reserved by the bootloader), 2.5KiB of RAM (of which 1KiB is occupied by the Arduboy2 frame buffer) and 1 KiB of EEPROM (of which 16 bytes are reserved by the Arduboy2 library for user settings).
The FX chip adds additional flash memory, but it’s accessed differently to the on-chip memory (specifically, it’s connected via an SPI interface and must be communicated with over SPI, as must the screen).
The FX chip can store data, but not executable machine code. Any machine code must be stored in the on-chip memory because the chip can only read machine code from the on-chip memory’s address space (which does not include the external FX chip, the on-chip RAM or the on-chip EEPROM - those all exist as separate address spaces).
Thus it would be theoretically viable to store all your text on the FX chip.
Theoretically, yes - it all just compiles to machine code anyway.
However you’d have to reimplement a lot of the functionality provided by Arduino and/or the Arduboy2 library by yourself.
Fortunately they’re open source, so that would remove a large chunk of the work for you, but it still leaves a lot of writing.
The biggest hurdle to interfacing C++ code is name mangling, so in some scenarios you might be able to either
extern "C" or use some compiler features to specify some unmangled aliases for function overloads that you could then hook onto with Rust.
Failing that, it ought to be possible to write an
extern "C" wrapper for C++ code.
On the bright side, you should be able to use avr-libc with relative ease, since it was written in C, though it only provides the basics of the C standard library and some extra AVR-specific functions.
No, the bootloader does not get overwritten as part of the normal game upload process. You have to perform a special operation to overwrite the bootloader.
This one I’m not entirely sure of. The Arduboy FXs do ship with a companion chip (an ATmega328P I think?) that’s capable of flashing a new bootloader, but I’m not sure how to go about instructing it to do so.
For an Arduboy without an FX mod you’d almost certainly need a secondary device to overwrite the bootloader, be it a standard Arduino board or a specialised bootloader flashing device (I forget what those are typically called).
@Mr.Blinky may be able to help more with that one since he designed the FX chip, though there may be someone else who understands how it works.
To be honest, I think it would be easier to learn enough C++ to get by than it would be to spend the effort providing the necessary infrastructure to use Rust.
I don’t think you’re likely to get much smaller code by using Rust, and safety is going to be limited because you’re going to have to deal with raw pointers from time to time. You’d also have to disable the GC because there’s no way you’re going to get that working decently with the Arduboy’s limited resources. You wouldn’t even be able to use dynamic memory allocation really - there just isn’t enough RAM for it to be viable. Global variables, stack allocation, or registers, no heap allocation.