qemu-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Add Custom Machine in Qemu-4.2.0 or newer


From: abhijeet inamdar
Subject: Re: Add Custom Machine in Qemu-4.2.0 or newer
Date: Tue, 2 Nov 2021 15:39:41 +0100

Can you elaborate the Testing point (3) as I have never done any unit test so.

I have some general questions like the Ubuntu version I'm using is 16.04 LTS so for the latest QEMU will it be compatible? and for the debug is the real hardware(board) required or just can make happen within software?

BR.
Abhijeet.

On Tue, Nov 2, 2021 at 2:24 PM Peter Maydell <peter.maydell@linaro.org> wrote:
On Tue, 2 Nov 2021 at 13:15, abhijeet inamdar
<abhijeetinamdar3005@gmail.com> wrote:
>
> Hi,
>
> I have a hardware which I want to emulate on QEMU based on arm Cortex M3. I tried to follow the examples like mps2 or stellaris.
>
> I'm finding it really hard to figure out how can I test the devices/peripherals I add to the machine. As the binary which I have contains all major protocols like UART, I2C, CAN, ADC, SPI....etc. and is it something that untill and unless I implementation all these into my machine it won't run(makes sense!).
>
> Is there any way here or how actually I have to approach this?

Start by working with a newer QEMU than 4.2. You should
have a look at the stm32 board models we have -- they are
fairly modern code that implements a model of an SoC
with an assortment of devices.

If you're lucky then your guest code doesn't want to really
do anything with most of the devices beyond "just initialize it"
and you can get away with using unimplemented-device stub
devices or very-little-actually-implemented devices. Starting
with the unimplemented-device stubs means you can turn on
debug logging to see which of them the guest is actually
accessing.

For testing, there are a few options:
 (1) just try to get whatever your guest code is working
     (probably working a lot with the debugger to see how
     far you can get it to go)
 (2) find a different guest binary that does less hardware
     access to use while you're working on this
 (3) you can write unit tests as you go along that try to
     exercise features of the devices. As an example test,
     tests/qtest/cmsdk-apb-timer-test.c starts an mps3-an385
     machine and tests one of its timer devices with a
     sequence of register accesses.

-- PMM

reply via email to

[Prev in Thread] Current Thread [Next in Thread]