Thanks to the nice community!
I’ve searched some related Github projects and I want to ask: how can I change the Arduboy FX Loader to my custom image?
Just like 8BitCade loader:
Thanks to the nice community!
I’ve searched some related Github projects and I want to ask: how can I change the Arduboy FX Loader to my custom image?
Just like 8BitCade loader:
i believe you would have to edit the bootloader, but im not sure if the source code for it is available, although there is (what i think is) a re-creation. you can edit the images in bitmaps.h
edit: this is the official bootloader, not a recreation
I think it’s as easy as changing the image in the first category on the flashcart, and doesn’t require modifying the bootloader. You can do so with one of the flashcart modifier programs. I hate to advertise my own program (especially because I’ve never tested it on an arduboy mini, be careful!) but I don’t know of others (someone please give alternatives in case mine doesn’t work!).
I recommend you backup your flashcart just in case! You can do so with either Mr.Blinky’s GitHub - MrBlinky/Arduboy-Python-Utilities: Python script to upload .hex, .zip or .arduboy files to Arduboy and Homemade versions or with my tool (after downloading, opening, and connecting your arduboy, go to the Flashcart tab and use the backup tool)
The steps are:
You can use the same program to update individual games on the flashcart, move them around, or create an entirely new one. There’s also the flashcart builder website if you want to make a cart with the latest games, though note that this will overwrite what’s on your flashcart instead of modifying it (including an ‘fx saves’, which only a few games use)
That is true.
The cart site doesn’t really allow you to replace the bootloader screen. Maybe that is an option I can add at some point. At the same time, I should also allow the category images to be changed.
You know what would be cool… If the greyscale games could have greyscale splash screens!
That would require a greyscale bootloader.
I never expected that there wouldn’t be any work involved. I wouldn’t even hazzard a guess if the extra functionality would even fit into the restricted loader space.
That’s a good programming challenge for someone - fit the greyscale library into the bootloader
@Mr.Blinky Why is the Cathy3K bootloader written by AVR assembly, not written by C? Is it because C compiler generated code (including full functions for FX loader) is larger than 4K?
Thank you. I’ve done modify my own loader screen. That’s a great tool. And at beginning I didn’t find the loader screen resource logic in bootloader’s code. And then I finally realized the first loader screen is just the first empty category screen! Wow That’s a cool and a smart design.
It quite probably could be done in C++ or C, but when you’re aiming to keep the code as tiny as possible, assembly is going to be easier to work with because it’s more deterministic - you don’t have to worry about the compiler optimising or not optimising things, the number of instructions you write is precisely what ends up in the final result.
There’s probably a few things that have to be done in assembly because they use instructions or sequences the compiler won’t generate from plain C++ or C code, though such things could still probably be done using inline assembly (asm
statements).
I wouldn’t be surprised if the bootloader isn’t actually using function calls, or at least not using a standard calling convention.
Just to point it out: Technically the bootloader doesn’t have to be as small as 4KB, it could be larger, but the bigger the bootloader is the more it eats into user space, which is something you’d want to avoid. Most Arduboy games were developed with a 4KB bootloader in mind, so if you were to make (for example) a 5KB bootloader, that bootloader wouldn’t be compatible with the games that consume more than 27KB of progmem.
Correction: The ATmega32U4 has a ‘2048 words’ (i.e. 4096 bytes) limit on bootloader size.
Correction 2: Despite the ‘official’ limit you can cheat. See the following comments…
Because of space. The original catarina bootloader where cathy3K is based on was written in C and took up all the 4K of the bootloader space. In Assembly you can do a lot more optimisation tricks then the C compiler ever can do (I managed to crunch down the original C bootloader to 1.8K and then added the Arduboy features in 1.2K)
Thanks!
Technically the maximul bootloader size is limited to 4K but a bootloader could reserve a part of the program/application area to extend it self.
By the hardware? This is news to me.
I just checked the ATmega32U4 datasheet and you are indeed right. I had to do a lot of looking to find that information though. It was buried in a table on page 349 and described as “2048 words”, so I’m not surprised I’d never spotted that before.
Though now I’m wondering how the 3K bootloader only uses 3KB because the table only appears to give four possibilities: 2048 words, 1024 words, 512 words, and 256 words.
The bootloader uses a 2K bootloader area (which contains the flasher code)+ 1K program application area and it is protected by the bootloader software (you can upload a 32K program if you want but it will never flash beyond 29K)
Ah, I see.
In which case, that kind of revalidates/reinstates my original point: in practice you could e.g. have a 5KB bootloader by using that trick to prevent an uploaded program using that 1KB the bootloader wants for itself, even though the hardware would think you’re only using 4KB.