Zeal8bit / Zeal-8-bit-OS

An Operating System for Z80 computers, written in assembly
Apache License 2.0
574 stars 54 forks source link

New image loads in emulation, hangs on real hardware #36

Closed Candid-Moe closed 3 months ago

Candid-Moe commented 3 months ago

I compiled the OS + ROMdisk, producing os_with_romdisk.img, which loads and runs flawlessly in the emulator. However, after flashing the board with the same image, the computer hangs while booting the new OS.

The image is available here. It's configured to boot and run zorth.bin.

This is the dialog in the bootloader section (57.600, 8 bit, 1 stop bit, no parity):

Zeal 8-bit Computer bootloader v1.2.1
...
Enter your choice: a
Numbers must be provided in hexadecimal
New entry name (max 32 chars): Zorth
22-bit physical address, aligned on 16KB: 4000
16-bit virtual address: 0

Entering menu. Please select an option:

1 - Boot Zeal 8-bit OS (0x004000 -> 0x0000)
2 - Boot Zorth (0x004000 -> 0x0000)
p - Load program from UART
a - Add a new entry
d - Delete an existing entry
s - Save configuration to flash
b - Change baudrate
f - Flash/Program the ROM
q - Quick format I2C EEPROM (ZealFS)
t - Test hardware

Enter your choice: f
Numbers must be provided in hexadecimal
ROM address to flash, aligned on 4KB: 4000
Binary size: c70d
Please, send file...
Flashing in progress, do not turn off...

Entering menu. Please select an option:

1 - Boot Zeal 8-bit OS (0x004000 -> 0x0000)
2 - Boot Zorth (0x004000 -> 0x0000)
p - Load program from UART
a - Add a new entry
d - Delete an existing entry
s - Save configuration to flash
b - Change baudrate
f - Flash/Program the ROM
q - Quick format I2C EEPROM (ZealFS)
t - Test hardware

Enter your choice: 2

Now booting Zorth

That is as after as it goes.

Zeal8bit commented 3 months ago

Hello @Candid-Moe !

From what you tell me, I suspect your bootloader is using the UART as the standard output (since you specified the baudrate config).

When I execute the OS image you linked in the emulator, the text output is on the video, not the UART. So, it normal that the bootloader doesn't have any further output after booting Zorth, since the latter will have its output on the video board.

If you have the video board, do you have any output on the video output? If you don't have the video board, you will want to recompile the OS with the UART as the standard output.

Candid-Moe commented 3 months ago

No, I don't have the video board. Some day ...

Well, I changed the standard output driver to UART, recompiled it and upload. I got stucked: Screenshot at 2024-08-14 07-21-05

I tested with "executable to launch on bot" set to "a:zorth.bin" y "a:init.bin", with same results.

BTW, it's "init.bin" included by default in the rom disk?

Zeal8bit commented 3 months ago

@Candid-Moe I see, then the way you recompiled the OS is correct. You may want to check the following:

Candid-Moe commented 3 months ago

I can't boot any image. I did make clean; make menuconfig; make, changing only standard output to UART. No extra files for the romdisk, and still can't pass the same point.

Zeal8bit commented 3 months ago

@Candid-Moe You also need to modify the Physical address of the kernel option to 0x4000 since this is where you will flash the OS image, then it should be enough to have the system boot directly into zorth.bin or init.bin

Candid-Moe commented 3 months ago

Still the same result with this parameters

Screenshot at 2024-08-15 05-28-05

Zeal8bit commented 3 months ago

@Candid-Moe Can you please try the following ROM: https://zeal8bit.com/roms/staging/os_with_zorth.img

Flash it at address 0x4000, it was compiled with the following configuration: https://zeal8bit.com/roms/staging/os.conf

If it still doesn't work, I highly suspect the program you use on your host computer to send the rom via UART is corrupting the file (it adds a header maybe? Or it shifts some bytes? Converts the 0xA bytes into 0xD 0xA?)

Candid-Moe commented 3 months ago

The ROM link gave me a 404, but I copied your os.conf and recompiled it. Now it's working ! Screenshot at 2024-08-15 11-36-24 The only difference in your os.conf seems to be that mine line

CONFIG_TARGET_ENABLE_VIDEO=y

has been commented out. I didn't find the corresponding control in menuconfig for this variable.

Zeal8bit commented 3 months ago

@Candid-Moe Any r was missing in the URL I edited it.

Glad to hear it worked! This video option can be disabled in the "Zeal 8-bit Computer" sub menu, uncheck "Enable video driver"

Zeal8bit commented 3 months ago

@Candid-Moe I was able to identify and fix the bug, thanks again for reporting it!