beckus / qemu_stm32

QEMU with an STM32 microcontroller implementation
http://beckus.github.io/qemu_stm32/
Other
527 stars 144 forks source link

Ported the crc peripheral from pebble/qemu #22

Closed baselsayeh closed 5 years ago

beckus commented 5 years ago

Thank you!

baselsayeh commented 5 years ago

@beckus A quick question, Is the vcpu interrupt works by qemu_set_irq, Right?

I'm trying to implement dma for stm32_qemu, and almost succeed but the vcpu interrupt wont work. I did used "sysbus_connect_irq" in stm32.c and "sysbus_init_irq" in stm32_dma.c as in the pebble qemu port but that didn't work for some reason.

And i created a dummy test peripheral for the interrupt testing, initializing it with DeviceState *test123 = qdev_create(NULL, "stm32_test123"); object_property_add_child(stm32_container, "tst123", OBJECT(test123), NULL); QDEV_PROP_SET_PERIPH_T(test123, "periph", STM32_TEST123); qdev_prop_set_ptr(test123, "stm32_rcc", rcc_dev); stm32_init_periph(test123, STM32_TEST123, 0x16560000, NULL); sysbus_connect_irq(SYS_BUS_DEVICE(test123), 0, pic[STM32_EXTI0_IRQ]); but it didn't work

Edit: Solved it! I was not setting the irq priority to a high value!

https://github.com/pebble/qemu/blob/master/hw/arm/stm32f2xx.c#L363

https://github.com/pebble/qemu/blob/master/hw/arm/stm32f2xx_dma.c#L364

https://github.com/pebble/qemu/blob/master/hw/arm/stm32f2xx_dma.c#L217

beckus commented 5 years ago

As always, sorry I didn't get back to you earlier. I'm glad you figured it out - I appreciate you updating the post with your solution.