Espeon icon indicating copy to clipboard operation
Espeon copied to clipboard

ROM Won't Load

Open 32teeth opened this issue 4 years ago • 12 comments

ROM (Any) Won't Load

Including flash or sd card

IMG_3174 IMG_3175 IMG_3176

To reproduce

Edit the gbfiles.h file and comment out the three defines (since i don't have a bios file)

/* Uncomment this to include a fallback ROM */
// #define USE_INTERNAL_ROM
// #define USE_INTERNAL_BIOS
// #define USE_INTERNAL_BORDER

Attempt to load from sd card - fails

Flashed to M5 Directly as per partition table - fails

python (path to my esp-idf toolchain)/esptool.py --chip esp32 --port /dev/cu.SLAB_USBtoUART --baud 2000000 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size detect 0x110000 dinosofflineadventure.gb

32teeth avatar Jun 26 '20 17:06 32teeth

Does the "Flashing ROM..." progress bar show up when loading from SD card? If not, then you need to flash the boot_app0, bootloader, and partitions_espeon files.

Ryuzaki-MrL avatar Jun 27 '20 01:06 Ryuzaki-MrL

thanks @Ryuzaki-MrL

I have tried

  1. compiling and flashing from arduino source
  2. flashing directly using esptools

both methods produce same results

I never see the message for "Flashing ROM..."

32teeth avatar Jun 27 '20 10:06 32teeth

The command should look like this:

esptool.py --chip esp32 --port /dev/cu.SLAB_USBtoUART --baud 2000000 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size detect 0x1000 bootloader_0x1000.bin 0xe000 boot_app0_0xe000.bin 0x8000 partitions_espeon_0x8000.bin 0x10000 espeon.ino.m5stack_core_esp32_0x10000.bin

If it still doesn't work, try using M5Burner. You can import the Espeon.zip file into it and have it flash everything. Right now I don't have my M5Stack at hand.

Ryuzaki-MrL avatar Jun 27 '20 12:06 Ryuzaki-MrL

I'm quite familiar with ESP-IDF, the example i posted was adding a rom directly into flash at address 0x110000 as per the provisioned partition csv, as you see in the first pics i have it up and running

the problem may be with the missing bios files

32teeth avatar Jun 28 '20 11:06 32teeth

The BIOS is entirely optional, the emulator sets the memory accordingly if it's not present. The "rom_init failed" only triggers when the "esp_partition" API can't find the ROM partition, that is, when the file "partitions_espeon_0x8000.bin" is not flashed onto address 0x8000. That's why the "Flashing ROM..." screen doesn't show up. Manually flashing a ROM at 0x110000 will do nothing if the API doesn't know what that address is supposed to be.

Ryuzaki-MrL avatar Jun 29 '20 09:06 Ryuzaki-MrL

The command should look like this:

esptool.py --chip esp32 --port /dev/cu.SLAB_USBtoUART --baud 2000000 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size detect 0x1000 bootloader_0x1000.bin 0xe000 boot_app0_0xe000.bin 0x8000 partitions_espeon_0x8000.bin 0x10000 espeon.ino.m5stack_core_esp32_0x10000.bin

If it still doesn't work, try using M5Burner. You can import the Espeon.zip file into it and have it flash everything. Right now I don't have my M5Stack at hand.

espeon.ino.m5stack_core_esp32_0x10000.bin is not in your repo?

32teeth avatar Jun 29 '20 17:06 32teeth

I do not commit the executable, but I assume you have compiled it yourself. I also provide a compiled binary at the releases page, of the last version I was able to test.

Ryuzaki-MrL avatar Jun 30 '20 07:06 Ryuzaki-MrL

Using the command you supplied above, I can get the precompiled binaries to run, and I can load a ROM and it works (except I have no joypad input because I don't have one of those).

I added support for an IR controller I had laying around and want to try that.

I can compile and program the source from the Arduino IDE, but the code faints when I try to load the same ROM I can play with the pre-compiled binaries.

To create a binary of my own, so I could upload my code in place of the pre-compiled binary, I followed the directions here: https://randomnerdtutorials.com/bin-binary-files-sketch-arduino-ide/ which did, in fact, create a binary from my build.

In the esptool.py command, I substituted this binary, replacing the espeon.ino.m5stack_core_esp32_0x10000.bin precompiled binary. Everything seems to program correctly, I can see the menu, but choosing the same that ROM that ran with the pre-compiled binary does not work, it just drops me back to the menu. I can see it write something to the screen, but it gets overwritten immediately.

Is there anything special in the board setup or anything else you have to do to get this to work? BTW, one of the links in your README.md file - the one that talks about setting up the environment - is dead. Apparently Espressif moved the document you were referring to.

haverdude avatar Jul 29 '20 07:07 haverdude

Update - I don't know what I changed, but this is what happens when I load my code instead of the precompiled binaries, After uploading, I get the menu, as normal... image Choosing the GB file, I get this.... image

haverdude avatar Jul 29 '20 07:07 haverdude

That's odd. It's showing a blank gameboy screen, so that means the emulator is running (no error screen was triggered). There's two possibilities:

  1. The modified code might have broken something on the emulator side.
  2. The ROM is not being properly copied to the correct partition for whatever reason.

Also, I found the docs again: https://docs.m5stack.com/#/en/arduino/arduino_development Thanks for pointing out, I'll update the README.

Ryuzaki-MrL avatar Jul 30 '20 11:07 Ryuzaki-MrL

I backed out all my changes and the behavior is the same.

I'll check the load address, but that shouldn't have changed - I do have to use esptool.py though, otherwise I can't even load the ROM.

One thing I noticed is that my image, even after enabling debug (later Arduino IDF integrations have this turned off by default), is much smaller than yours and I don't know what's causing that.

Maybe you're including a BIOS and/or border in your binaries?

On Thu, Jul 30, 2020, 6:07 AM Lázaro Vieira [email protected] wrote:

That's odd. It's showing a blank gameboy screen, so that means the emulator is running (no error screen was triggered). There's two possibilities:

  1. The modified code might have broken something on the emulator side.
  2. The ROM is not being properly copied to the correct partition for whatever reason.

Also, I found the docs again: https://docs.m5stack.com/#/en/arduino/arduino_development Thanks for pointing out, I'll update the README.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Ryuzaki-MrL/Espeon/issues/6#issuecomment-666301222, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGJWE5MXAC27X2HBLE4TPTR6FH5LANCNFSM4OJQON3A .

haverdude avatar Jul 30 '20 19:07 haverdude

Anyone facing this issue, you need to run esptool.py --chip esp32 --port /dev/cu.usbserial-01B9087E erase_flash

linkov avatar May 17 '22 00:05 linkov