Close
0%
0%

eZ80 open-source programmer

AVR-based interface to access eZ80 CPU through ZDI signals - usable as programmer/debugger

Similar projects worth following
ZDI interface with ATmega8 MCU to access eZ80 CPU.
It allows to access CPU core registers, to stop/continue program execution, to set up to 4 breakpoints, to access peripheral registers and all memory.
Command-line utility will download Intel-HEX files to RAM or Flash and run downloaded code.

I am interested in Z80 CPUs for a long time. Some time ago (it could be about 10 years...) I was working with eZ80. So I was curious if it could run CP/M. It could. So I prepared in C rewritten CP/M with FAT file system support. All BDOS calls are accessing SD card with FAT filesystem. By the time I had Zilog IDE, compiler, USB debugger cable etc.
Now, I want to return to this project. Unfortunately, I don't have these tools anymore. I don't use Windows anymore so Zilog IDE is not the right way for me now as it doesn't work in wine correctly; the only possibility I have found is running command-line compiler & linker to get Intel-HEX output files. Fortunately, Zilog provides description for ZDI interface. I have now all I need to start my work.

  • 1 × system with eZ80 CPU
  • 1 × ATmega328

  • All parts of project finished!

    hynek03/08/2016 at 13:23 0 comments

    I spent lLast few days testing and improving both ZDI interface and PC utility. After everything worked fine I moved to documenting these two parts and released source code.

    So here are two links with full description: ZDI debugger/programmer and MCUload utility.

    These two pages close my development, summarize user interface and contain link to download source code.

  • RAM download working reliably

    hynek03/01/2016 at 13:26 0 comments

    After some time spent debugging both AVR and PC parts, download finally seems to be reliable both on Linux and Windows. I can now take HEX file compiled with Zilog's compiler, download it to eZ80 system and run it. Or I can do debugging through ZDI interface: use breakpoints, single-stepping, view changed registers or even full register set.

    I will focus now on flash programming.

  • First HEX file downloaded

    hynek02/26/2016 at 19:51 0 comments

    After some time, Intel-HEX download is now working. HEX file can be downloaded to RAM, verified and executed. This is good start to begin flash programming.

    There is some problem in CDC driver on Windows, some data get corrupted, but on linux it works fine, so I will continue my development on linux; and I will return back to Windows later. Probably, some short delay should be added or shorter packets should be sent but it will come later.

  • extending debugger functions

    hynek02/20/2016 at 12:30 0 comments

    Debugger interface was extended a lot. Long time has been spent on improving reset behaviour.

    New debugger commands:

    • AF, BC, DE, HL, PC, SP, IX, IY for faster register acces (without REG command)
    • ADL, MADL, EXX commands to change these CPU's settings
    • RST (renamed from RESET)
    • STEP can be also executed just by pressing Enter
    • MAP to print current memory mapping

    Reset which results in halted CPU is quite difficult to do. It seems, that there is only short time when ZDI_BRK_CTL can be written in time enough to stop CPU with PC=0x000000. Earlier write leads to CPU completely frozen, later stops CPU at non-zero address. "Frozen" CPU means, that it doesn't do anything, is completely stopped - probably in initialization phase - and nothing else then hardware reset helps.

    RST command can accept single byte parameter used to time this delay. It is possible that with another AVR compiler, this delay should be adjusted again.

    Debugger interface was improved:

    • disassembler prints instruction pointed to by PC register
    • after instruction is executed, changed registers are printed

    Here is an example of single-stepping:

    000000:	DI
    000001:	RSMIX
    000003:	JP.LIL	$028C
    HL =B7E3AD	IX =B7FF4A
    00028C:	LD	A,$FF
    AF =0000FF
    00028E:	OUT0	($9B),A
    000291:	OUT0	($9F),A
    000294:	OUT0	($A3),A
    000297:	LD	A,$00
    AF =000000
    000299:	OUT0	($9C),A
    To finish debugger, breakpoint support has to be added.

  • eZ80 compiler

    hynek02/03/2016 at 09:01 0 comments

    Just short word about compiler/linker...

    When I tried to restart my work with eZ80 CPU, I had to think how to produce HEX files on linux.

    After I realized that Zilog's toolchain is now downloadable for free, I tried if commpiler/linker can be used standalone. I took my source for CP/M and wrote makefile. Than I moved file by file what was needed to compile my project. Here is file list:

    • bin/ez80cc.exe
    • bin/ez80asm.exe
    • bin/ez80link.exe
    • bin/p1.exe
    • bin/p2.exe
    • bin/p3.exe
    • bin/eZ80.ini
    • bin/C1ERRORS.DAT
    • bin/ez80cc.con
    • include/*
    • lib/*

    To run these tools under linux I have prepared scripts calling wine and the first three tools: compiler, assembler and linker.

    Using these tools from command line is covered in ZDSII manual UM0144.

  • Introduction to ZDI interface

    hynek02/03/2016 at 08:47 0 comments

    Basically, ZDI has simple read/write interface similar to I2C bus. Communication starts with START condition, 7-bit address is sent and read/write selector bit, 9-th bit is used as bit separator to allow change between input and output direction.

    Unfortunately, I2C peripheral is not usable for this purpose.

    To simplify initial debugging, ATmega8 interface is connected to UART, so it can be easily controlled from serial terminal.

    Interface has two basic commands:

    • ZDIW <addr> <data> [<data> ...]
    • ZDIR <addr> [<count>]

    These commands should be sufficient to control all future things but for manual testing/debugging other "high-level" commands were added:

    • REG [<reg_name> [<value>]]
    • MEMR <addr> [<count>]
    • MEMW <addr> <data> [<data> ...]
    • IN <port>
    • OUT <port> <data>
    • STOP
    • RUN
    • STEP
    • EXEC <opcode> [<opcode2> ...]
    • :<Intel-HEX format ...>

    I plan to add better debugging support: setting break addresses, smart register printing (changed registers only) etc.

    Now it is time to work on programming utility...

View all 6 project logs

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates