Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flashing image questions #13

Open
mattie47 opened this issue Feb 25, 2024 · 2 comments
Open

Flashing image questions #13

mattie47 opened this issue Feb 25, 2024 · 2 comments

Comments

@mattie47
Copy link

mattie47 commented Feb 25, 2024

Finally had a weekend to build and assemble this project, and about to install into Wii.

Just wanted to check a couple things with others to confirm I've flashed the chip correctly.

On #5 @jpaglier stated an alternative flash chip could be used. In this case, the MX25V4006EM1I-13G. I have gone ahead and used this as opposed to the original project chip.

I then downloaded the latest release gcvideo-3.1-shuriken-v3-wii.zip and attempted to flash using flashrom on a Raspberry Pi.

pi@octopi:~ $ flashrom -p linux_spi:dev=/dev/spidev0.0,spispeed=256 -w  gcvideo-dvi-shuriken-v3-wii-3.1-spirom-complete.bin
flashrom  on Linux 5.10.103-v7+ (armv7l)
flashrom is free software, get the source code at https://flashrom.org

Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns).
Found Macronix flash chip "MX25L4005(A/C)/MX25L4006E" (512 kB, SPI) on linux_spi.
Error: Image size (346144 B) doesn't match the flash chip's size (524288 B)!

As above, this complained about the image size. To get around this, I needed to pad the file out to the flash chip size.

I understand I could do this using 0xff or possibly 0x00 bytes added to the end of the bin file, however I've read some people having issues doing so (not with Wii/gamecube wiiHDMI but unrelated projects).

It seems to be best to pad out the chip with the rom image again filling to the total bytes.

From this reddit thread:
https://www.reddit.com/r/techsupport/comments/dc8jmw/flashed_a_2mb_bios_rom_on_a_16mb_chip_cant_get_it/

We should be able to use the DD command. First we make a copy of our bin file which will be our target file for appending to.

cp gcvideo-dvi-shuriken-v3-wii-3.1-spirom-complete.bin gcvideo-dvi-shuriken-v3-wii-3.1-spirom-complete-copy.bin

Next we pad out the copy file using dd. We do this to a total size of 524288 bytes (512kb) minus 346144 bytes (gcvideo bin size) = 178144 bytes.

dd if=gcvideo-dvi-shuriken-v3-wii-3.1-spirom-complete.bin of=gcvideo-dvi-shuriken-v3-wii-3.1-spirom-complete-copy.bin bs=178144 oflag=append count=1 conv=notrunc

Now we have a bin file we can burn to our flash chip:

flashrom -p linux_spi:dev=/dev/spidev0.0,spispeed=256 -w gcvideo-dvi-shuriken-v3-wii-3.1-spirom-complete-copy.bin
flashrom  on Linux 5.10.103-v7+ (armv7l)
flashrom is free software, get the source code at https://flashrom.org

Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns).
Found Macronix flash chip "MX25L4005(A/C)/MX25L4006E" (512 kB, SPI) on linux_spi.
Reading old flash chip contents... done.
Erasing and writing flash chip... Erase/write done.
Verifying flash... VERIFIED.

Should this work? and was this the correct way I should have burned the flash chip?

Further notes for others attempting to flash via RPI

Wiring up:

Note: If you're familiar with SPI bus, sometimes it's not always clear if you need to cross over MOSI and MISO in wiring up. In the case of Wii-HDMI, this isn't required. Simply connect the Pi's MISO to the silkscreen labelled MISO, followed by MOSI to MOSI.

Next, make sure SPI is enabled in boot/config.txt:

# Uncomment some or all of these to enable the optional hardware interfaces
#dtparam=i2c_arm=on
#dtparam=i2s=on
dtparam=spi=on

Note: Initially I had only tried following ikorb/gcvideo#65 (comment) instructions by @drandreas however I could not get things working using the dtoverlay=jedec-spi-nor,flash-spi0-0 overlay. Simply enabling spi above was enough for flashrom to work for me.

Thanks,

Matt

@Arthrimus
Copy link
Owner

I've used larger flash before and padded the end of the file with the hex value FF. This has worked without issue. I do all of my programming on a Windows system so I use a GUI flashing utility that handles the padding automatically so I haven't really looked into this further than that.

@mattie47
Copy link
Author

Thank you!

Closing Issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants