You need to write the program to the flash cart, run it, then download the contents of the flash cart. The BIOS will be in the first 4K of that file. Cutting the first 4K can be done in many different ways. Under Linux and mac OS one can use a dd command:
Only a slight adjustment to the C compiler is needed as the code uses a large memory model one needs to create a new pml.mk file that is copy of pm.mk where occurrences of "-Md" are substituted with "-Ml". The standard flash chip SST39VF1681 is used in DITTO mini, but there is a particularity that all the command bytes need to be with reversed bits. Highest to the lowest bits should be ordered from the lowest to the highest position, so for instance 0x3A becomes 0x5C. Naturally all the flashing functionality should be executed in the RAM.
There was a suggestion from user brizzo on the Discord server…
Would it be possible to add a function to run a checksum against the known BIOS and display a message if we happen to find a previously unknown version of the BIOS? Then if it's the same, you could simply try another Mini without connecting to the computer.
A side note - it is an example how to calculate CRC32. It could be useful for other checks - consistency of a save data for instance.
Second side note - too much writing to either Pokemon mini saves or flash cart itself is deteriorating their life. It is not so small - the flash specs say at least 100'000 writing cycles which is a lot, but still worth having in mind (it is not like the RAM where you can write as much as you want). Writing cycles are times one clears some bit I believe. For instance one can zero up to 8 times the individual bits in a byte and then reset it to all ones, which is considered one writing cycle. The clear state of the flash is all ones (0xFF).