qemu bare metal emulation of a Motorola 68000 CPU

171 Views Asked by At

I want to create an emulator for an SBC I'm creating using a 68k CPU. The SBC will not have a hard-drive it is just CPU, EEPROM, RAM, LCD and a serial port. I will need to write a bootloader for this, and I wanted to try to create an emulator for testing code.

Is this possible with qemu? If it is possible, could you give me the command to spin up one of these?

2

There are 2 best solutions below

2
Peter Maydell On

It can be done, but it is not as simple as "run a command". You would need to add code to QEMU to implement the new machine type you want to emulate, plus code to implement any device models the machine has which QEMU doesn't yet have models of.

1
fifteenhex On

Use the qemu m68k system emulation with the virt machine and set the CPU to mc68000 and you'll have basically what you want. The virtio peripherals aren't as easy to use as the stuff you'd have on you SBC but the uart, timer etc are easy and documented (see the drivers in my u-boot port below)

I actually found your post searching for if anyone else was actually using the 68000 emulation in qemu.

I used it to get u-boot working on plain 68000 and fix up the 68000 support in Linux over the past few days.

My WIP u-boot is here: https://github.com/fifteenhex/u-boot/tree/mc68000 WIP Linux is here: https://github.com/fifteenhex/linux/tree/m68kdt WIP build root to build a rootfs: https://github.com/fifteenhex/buildroot/tree/mc68000