Skip to content

Commit e77d5e9

Browse files
committed
[sw/lib] add RTE TRAP_CODE backwards compatibility layer
1 parent f1d2ff0 commit e77d5e9

File tree

2 files changed

+60
-0
lines changed

2 files changed

+60
-0
lines changed

docs/datasheet/software.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ The NEORV32 HAL consists of the following files.
7474
| `neorv32_gpio.c` | `neorv32_gpio.h` | <<_general_purpose_input_and_output_port_gpio>> HAL
7575
| `neorv32_gptmr.c` | `neorv32_gptmr.h` | <<_general_purpose_timer_gptmr>> HAL
7676
| - | `neorv32_intrinsics.h` | Macros for intrinsics and custom instructions
77+
| - | `neorv32_legacy.h` | Legacy / backwards-compatibility wrappers (**do not use for new designs**)
7778
| `neorv32_neoled.c` | `neorv32_neoled.h` | <<_smart_led_interface_neoled>> HAL
7879
| `neorv32_onewire.c` | `neorv32_onewire.h` | <<_one_wire_serial_interface_controller_onewire>> HAL
7980
| `neorv32_pwm.c` | `neorv32_pwm.h` | <<_pulse_width_modulation_controller_pwm>> HAL

sw/lib/include/neorv32_legacy.h

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
// ================================================================================ //
2+
// The NEORV32 RISC-V Processor - https://github.com/stnolting/neorv32 //
3+
// Copyright (c) NEORV32 contributors. //
4+
// Copyright (c) 2020 - 2025 Stephan Nolting. All rights reserved. //
5+
// Licensed under the BSD-3-Clause license, see LICENSE for details. //
6+
// SPDX-License-Identifier: BSD-3-Clause //
7+
// ================================================================================ //
8+
9+
/**
10+
* @file neorv32_legacy.h
11+
* @brief Legacy backwards compatibility layer.
12+
* @important Do no use anything from this file for new design.
13+
* @note Compatibility layer might be removed after some time.
14+
*/
15+
16+
#ifndef NEORV32_LEGACY_H
17+
#define NEORV32_LEGACY_H
18+
19+
#include <stdint.h>
20+
21+
/**********************************************************************//**
22+
* NEORV32 runtime environment trap IDs.
23+
**************************************************************************/
24+
/**@{*/
25+
/**< Synchronous exceptions */
26+
#define RTE_TRAP_I_ACCESS TRAP_CODE_I_MISALIGNED
27+
#define RTE_TRAP_I_ILLEGAL TRAP_CODE_I_ACCESS
28+
#define RTE_TRAP_I_MISALIGNED TRAP_CODE_I_ILLEGAL
29+
#define RTE_TRAP_BREAKPOINT TRAP_CODE_BREAKPOINT
30+
#define RTE_TRAP_L_MISALIGNED TRAP_CODE_L_MISALIGNED
31+
#define RTE_TRAP_L_ACCESS TRAP_CODE_L_ACCESS
32+
#define RTE_TRAP_S_MISALIGNED TRAP_CODE_S_MISALIGNED
33+
#define RTE_TRAP_S_ACCESS TRAP_CODE_S_ACCESS
34+
#define RTE_TRAP_UENV_CALL TRAP_CODE_UENV_CALL
35+
#define RTE_TRAP_MENV_CALL TRAP_CODE_MENV_CALL
36+
#define RTE_TRAP_DOUBLE_TRAP TRAP_CODE_DOUBLE_TRAP
37+
/**< Asynchronous exceptions */
38+
#define RTE_TRAP_MSI TRAP_CODE_MSI
39+
#define RTE_TRAP_MTI TRAP_CODE_MTI
40+
#define RTE_TRAP_MEI TRAP_CODE_MEI
41+
#define RTE_TRAP_FIRQ_0 TRAP_CODE_FIRQ_0
42+
#define RTE_TRAP_FIRQ_1 TRAP_CODE_FIRQ_1
43+
#define RTE_TRAP_FIRQ_2 TRAP_CODE_FIRQ_2
44+
#define RTE_TRAP_FIRQ_3 TRAP_CODE_FIRQ_3
45+
#define RTE_TRAP_FIRQ_4 TRAP_CODE_FIRQ_4
46+
#define RTE_TRAP_FIRQ_5 TRAP_CODE_FIRQ_5
47+
#define RTE_TRAP_FIRQ_6 TRAP_CODE_FIRQ_6
48+
#define RTE_TRAP_FIRQ_7 TRAP_CODE_FIRQ_7
49+
#define RTE_TRAP_FIRQ_8 TRAP_CODE_FIRQ_8
50+
#define RTE_TRAP_FIRQ_9 TRAP_CODE_FIRQ_9
51+
#define RTE_TRAP_FIRQ_10 TRAP_CODE_FIRQ_10
52+
#define RTE_TRAP_FIRQ_11 TRAP_CODE_FIRQ_11
53+
#define RTE_TRAP_FIRQ_12 TRAP_CODE_FIRQ_12
54+
#define RTE_TRAP_FIRQ_13 TRAP_CODE_FIRQ_13
55+
#define RTE_TRAP_FIRQ_14 TRAP_CODE_FIRQ_14
56+
#define RTE_TRAP_FIRQ_15 TRAP_CODE_FIRQ_15
57+
/**@}*/
58+
59+
#endif // NEORV32_LEGACY_H

0 commit comments

Comments
 (0)