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

[BUG] Renode crashes when using interrupts with the DPI interface #534

Open
mohamed opened this issue Oct 17, 2023 · 0 comments
Open

[BUG] Renode crashes when using interrupts with the DPI interface #534

mohamed opened this issue Oct 17, 2023 · 0 comments
Labels
bug confirmed A verified bug

Comments

@mohamed
Copy link
Contributor

mohamed commented Oct 17, 2023

Description

A peripheral device with APB3 target interface and an IRQ interrupt output is connected to Renode via the new DPI interface. The APB3 bus reads/writes behave as expected. However, when the DUT asserts the IRQ line, we observe that Renode shows the following:

  1. It prints the following error: 11:50:59.2184 [ERROR] dut: Timeout reached while waiting for a tick response.
  2. Renode crashes with the following dump:
11:51:09.2264 [ERROR] dut: Send error!
Fatal error:
Exception of type 'Antmicro.Renode.Peripherals.CPU.CpuAbortException' was thrown.
  at Antmicro.Renode.Peripherals.Verilated.BaseVerilatedPeripheral.AbortAndLogError (System.String message) [0x00027] in <7261fe6bf97f4df0ae1a5e909490eaf5>:0
  at Antmicro.Renode.Peripherals.Verilated.VerilatedPeripheral+<>c__DisplayClass0_0.<.ctor>b__0 () [0x00058] in <7261fe6bf97f4df0ae1a5e909490eaf5>:0
  at Antmicro.Renode.Peripherals.Timers.LimitTimer.OnLimitReached () [0x0002c] in <b05710e063024506ba998245a09a24f0>:0
  at Antmicro.Renode.Time.BaseClockSource.Update (Antmicro.Renode.Time.TimeInterval time, System.Collections.Generic.List`1[System.Action]& alreadyRunHandlers) [0x000d7] in <b05710e063024506ba998245a09a24f0>:0
  at Antmicro.Renode.Time.BaseClockSource.AdvanceInner (Antmicro.Renode.Time.TimeInterval time, System.Boolean immediately) [0x0007b] in <b05710e063024506ba998245a09a24f0>:0
  at Antmicro.Renode.Time.BaseClockSource.Advance (Antmicro.Renode.Time.TimeInterval time, System.Boolean immediately) [0x00055] in <b05710e063024506ba998245a09a24f0>:0
  at Antmicro.Renode.Core.Machine.HandleTimeProgress (Antmicro.Renode.Time.TimeInterval diff) [0x00000] in <b05710e063024506ba998245a09a24f0>:0
  at Antmicro.Renode.Time.TimeSourceBase.SynchronizeVirtualTime () [0x00050] in <b05710e063024506ba998245a09a24f0>:0
  at Antmicro.Renode.Time.TimeSourceBase.ReportTimeProgress () [0x00000] in <b05710e063024506ba998245a09a24f0>:0
  at Antmicro.Renode.Time.TimeHandle.ReportProgress (Antmicro.Renode.Time.TimeInterval progress) [0x00092] in <b05710e063024506ba998245a09a24f0>:0
  at Antmicro.Renode.Peripherals.CPU.BaseCPU.ReportProgress (System.UInt64 instructions) [0x00041] in <8dc598eb94ab48eeaf1e0ec47b6fddd1>:0
  at Antmicro.Renode.Peripherals.CPU.BaseCPU.CpuThreadBodyInner (System.Boolean singleStep) [0x00114] in <8dc598eb94ab48eeaf1e0ec47b6fddd1>:0
  at Antmicro.Renode.Peripherals.CPU.BaseCPU.CpuThreadBody () [0x00163] in <8dc598eb94ab48eeaf1e0ec47b6fddd1>:0
  at System.Threading.ThreadHelper.ThreadStart_Context (System.Object state) [0x00014] in <aeea2e33ea654cfabae63b60ba0e127a>:0
  at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00071] in <aeea2e33ea654cfabae63b60ba0e127a>:0
  at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <aeea2e33ea654cfabae63b60ba0e127a>:0
  at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state) [0x0002b] in <aeea2e33ea654cfabae63b60ba0e127a>:0
  at System.Threading.ThreadHelper.ThreadStart () [0x00008] in <aeea2e33ea654cfabae63b60ba0e127a>:0

exception inside UnhandledException handler: (null) assembly:mscorlib.dll type:IOException member:(null)

The DUT behavior has been verified by enabling VCD tracing and checking if the DUT sends the IRQ. You can see this in the waveform below:
image

The DUT asserts o_intr and the renode_interrupts module is receiving the interrupt properly, see interrupts[0] and interrupts_prev[0] in the waveform.

The .repl file contains this:

cpu: CPU.CortexM @ sysbus
    cpuType: "cortex-m0+"
    nvic: nvic

nvic: IRQControllers.NVIC @ sysbus 0xE000E000
    priorityMask: 0xFF
    systickFrequency: 24000000
    -> cpu@0

Flash: Memory.MappedMemory @ sysbus 0x0
    size: 0x00040000

RAM: Memory.MappedMemory @ sysbus 0x20000000
    size: 0x00020000

uart0: UART.PL011 @ sysbus 0x40000000

dut: Verilated.VerilatedPeripheral @ sysbus <0x70000000, +0x100>
    maxWidth: 32
    limitBuffer: 1000000
    timeout: 10000
    numberOfInterrupts: 1
    address: "127.0.0.1"
    0 -> nvic@0
@PiotrZierhoffer PiotrZierhoffer added bug confirmed A verified bug labels Oct 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug confirmed A verified bug
Projects
None yet
Development

No branches or pull requests

2 participants