Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assertion failure running emulator on Windows #6

Open
codaris opened this issue Mar 22, 2015 · 2 comments
Open

Assertion failure running emulator on Windows #6

codaris opened this issue Mar 22, 2015 · 2 comments

Comments

@codaris
Copy link

codaris commented Mar 22, 2015

I cross-compiled the Pebble emulator for Windows and I get the following runtime assertion failure:

Assertion failed: clk != NULL, file qemu/hw/arm/stm32_rcc.c, line 32

The assert is located here:

void stm32_rcc_set_periph_clk_irq(
        Stm32Rcc *s,
        stm32_periph_t periph,11
        qemu_irq periph_irq)
{
    Clk clk = s->PERIPHCLK[periph];

    assert(clk != NULL);

    clktree_adduser(clk, periph_irq);
}

This is called from the stm32_uart_init function:

    /* Register handlers to handle updates to the USART's peripheral clock. */
    clk_irq =
          qemu_allocate_irqs(stm32_uart_clk_irq_handler, (void *)s, 1);
    stm32_rcc_set_periph_clk_irq(s->stm32_rcc, s->periph, clk_irq[0]);

I don't really expect a solution but I thought I'd post this in case it's something obvious.

@vinifr
Copy link
Contributor

vinifr commented Jul 21, 2016

What command did you use for run qemu? And what peripherals your firmware use?

@Helco
Copy link

Helco commented Jun 5, 2018

Hi, maybe a bit too late but I have a found the cause:

Stm32Rcc is inherited by e.g. Stm32f2xxRcc and the member PERIPHCLK is used via the parent struct, but because of struct alignment differences on windows the inherited parent structure is 4 bytes bigger, therefore referencing the UART1 clock with Stm32Rcc actually accesses the clock before (AFIO).

A fix for this would be to increase the size of the parent structure like so.

With this the emulator runs with RebbleOS, although there are some other issues with build, input and stdio, which I will try to fix over at the Rebble fork.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants