Main file -> Interrupt handler (which will jump to 0x20000) -> jump back to Main file #737
-
FPGA Setup NEORV32 on Cyclone V De0-CV Hardware Version: V1.8.6 (Purpose: compatible to Zephyr latest version) Task I'm Trying to Achieve A simple Main file "hello_world.bin" uploaded to 0x00000 [Around 64KB] (Integrated with Zephyr OS) I'm interested in the cfs interrupt, and did some configuration for its corresponding vhdl to capture one pulse. In addition, I stored the previous PC before the interrupt handler in NEORV32_CFS->REG[61], and the current PC in NEORV32_CFS->REG[63] ( If I press key1 on FPGA, it will trigger a cfs one pulse interrupt) ZEPHYR Within that Interrupt handler (Zephyr OS API for IQR_Connect, irq_enable)
hello_world.bin
NEORV32 task.bin
Error I Got
What could be potential reason I got this errors, and does it mean in order to normally execute after getting back from the interrupt, I need to disable its Machine Mode? If so, how? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
I'm not very familiar with the Zephyr OS kernel or its interrupt handling... 🙈 However, the general interrupt flow seems to be working in your setup.
Do you do this using software or did you wire up the CFU to the CPU's execution/control logic? So you want to execute the "task.bin" program when your CFU interrupt triggers, right? I am not sure, but somehow this feels like a stack corruption issue... 🤔
This might be dangerous as this overrides the Did you compile "task.bin" on its own (i.e. not linked with the base program)? Could you show the C-code of that? If that task is just a "free-standing" single function (no linking with your base/main program) then you could try to use the Another option would be to link everything during compilation. That would make things much easier as your task would become just another C function (where everyone is aware of) 😅 |
Beta Was this translation helpful? Give feedback.
-
Yes, I wired the fetch_PC from V1.8.6 NEORV32 CPU to CFS module (I just added another input port for PC in my CFS module)
Yes
Yes, It's a separate file loaded during boot time on 0x00020000; in addition, I tested and it's running fine with its own starting base_rom at 0x00020000. task.bin
In addition below is how I define my Interrupt in CFS
Lastly, what would be a corresponding inline assembly that let you directly jump to 0x00020000, without overrides any other registers. |
Beta Was this translation helpful? Give feedback.
Thats right - as long as your compile for a
rv32i
architecture (which is the default one). If you use the "embedded"rv32e
architecture then only registers x0 to x15 exist.Some "special" registers like
gp
won't be touched by GCC (as far as I know). However, I would recommend to backup all registers just be safe (except forx0
, which is hardwired to zero).First of all, I would recommend to upgrade your NEORV32 setup to the latest version. We had some minor bug fixes since version 1.8.6 (-> CHANGELOG).
This should be no …