1- /* Arduino wrapper for DoomGeneric
2- * Mouse and keyboard controls are not implemented at the moment;
3- * to use the internal QSPI flash as storage, force the board in bootloader mode
4- * by double clicking the reset button and upload doom.fat.dump (from doom/utils folder)
5- * with this command
6- *
7- * dfu-util -a1 --device 0x2341:0x035b -D doom.fat.dump --dfuse-address=0x90000000
8- */
1+ /*
2+ Arduino wrapper for DoomGeneric
3+ Mouse and keyboard controls are not implemented at the moment.
4+
5+ To use the internal QSPI flash as storage, run Portenta_WiFiFirmwareUpdater
6+ sketch once to create the partitions, AccessFlashAsUSBDisk to expose the QSPI flash
7+ as a USB disk, copy DOOM1.WAD in the biggest partition, flash this sketch and you are ready to go :)
8+ */
99
1010#include " QSPIFBlockDevice.h"
1111#include " FATFileSystem.h"
12+ #include " MBRBlockDevice.h"
1213#include " doomgeneric.h"
1314
14- QSPIFBlockDevice block_device (PD_11, PD_12, PF_7, PD_13, PF_10, PG_6, QSPIF_POLARITY_MODE_1, 40000000 ) ;
15+ QSPIFBlockDevice block_device;
1516// Comment previous line and uncomment these two if you want to store DOOM.WAD in an external SD card (FAT32 formatted)
1617// #include "SDMMCBlockDevice.h"
1718// SDMMCBlockDevice block_device;
1819
19- mbed::FATFileSystem fs (" fs" );
20+ mbed::MBRBlockDevice fs_data (&block_device, 2 );
21+ static mbed::FATFileSystem fs (" fs" );
2022
2123extern " C" int main_wrapper (int argc, char **argv);
2224char *argv[] = {" /fs/doom" , " -iwad" , " /fs/DOOM1.WAD" };
2325
2426void setup () {
25- // put your setup code here, to run once:
26- delay (2000 );
27- int err = fs.mount (&block_device);
27+ int err = fs.mount (&fs_data);
2828 if (err) {
29- // Reformat if we can't mount the filesystem
30- // this should only happen on the first boot
31- printf (" No filesystem found, formatting... " );
32- fflush (stdout);
33- err = fs.reformat (&block_device);
29+ printf (" No filesystem found, please run AccessFlashAsUSBDisk sketch and copy DOOM1.WAD in the big partition" );
30+ pinMode (LEDB, OUTPUT);
31+ while (1 ) {
32+ digitalWrite (LEDB, LOW);
33+ delay (100 );
34+ digitalWrite (LEDB, HIGH);
35+ delay (100 );
36+ }
3437 }
3538 DIR *dir;
3639 struct dirent *ent;
@@ -51,4 +54,4 @@ void setup() {
5154void loop () {
5255 // put your main code here, to run repeatedly:
5356
54- }
57+ }
0 commit comments