no-OS
Loading...
Searching...
No Matches
imu_dual_core_example_riscv.c File Reference

RISC-V RV32 (CPU1) side of the dual-core IMU example. More...

#include <stdint.h>
#include "no_os_alloc.h"
#include "no_os_spi.h"
#include "no_os_delay.h"
#include "maxim_gpio_spi.h"
#include "adis.h"
#include "adis1657x.h"
#include "maxim_ipc_raw.h"
#include "maxim_coprocessor_riscv.h"
#include "imu_ipc_shared.h"
Include dependency graph for imu_dual_core_example_riscv.c:

Macros

#define IMU_ADIS_RESET_ATTEMPTS   3u
 

Functions

void imu_riscv_fault (void)
 Report a CPU1 trap to the host and park the core.
 
void illegal_insn_handler (void)
 
void ecall_insn_handler (void)
 
int main (void)
 RISC-V entry point (CPU1). Brings up the ADIS via the no-OS driver, then publishes raw samples to the ARM.
 

Detailed Description

RISC-V RV32 (CPU1) side of the dual-core IMU example.

Author
Victor Pascu (victo.nosp@m.r.pa.nosp@m.scu@a.nosp@m.nalo.nosp@m.g.com)

Copyright 2026(c) Analog Devices, Inc.

SPDX-License-Identifier: BSD-3-Clause

Macro Definition Documentation

◆ IMU_ADIS_RESET_ATTEMPTS

#define IMU_ADIS_RESET_ATTEMPTS   3u

Function Documentation

◆ ecall_insn_handler()

void ecall_insn_handler ( void )

◆ illegal_insn_handler()

void illegal_insn_handler ( void )

◆ imu_riscv_fault()

void imu_riscv_fault ( void )

Report a CPU1 trap to the host and park the core.

RISC-V trap handler. The stock startup's __isr_vector routes synchronous exceptions (entry 1, illegal instruction) and other traps to weak handlers that just spin forever, which would silently wedge this core. We override the trap entry to capture the trap cause and notify the ARM before halting, so a fault is visible instead of an infinite hang.

Implemented as a plain function that reads the RISC-V trap CSRs (mcause/mepc/ mtval), publishes them to the shared table with a magic, rings the ARM doorbell, then parks the core. We do not attempt to return from the trap.

◆ main()

int main ( void )

RISC-V entry point (CPU1). Brings up the ADIS via the no-OS driver, then publishes raw samples to the ARM.