Merge branch 'master' into pca954x_select_api

This commit is contained in:
mwojcik 2022-03-02 10:03:17 +08:00
commit 41355e27f5
2 changed files with 13 additions and 3 deletions

View File

@ -273,7 +273,7 @@ pub unsafe extern fn raise(exception: *const Exception) -> ! {
error!("too many nested exceptions");
// TODO: better reporting?
let exception = Exception {
id: get_exception_id("runtimeerror"),
id: get_exception_id("RuntimeError"),
file: file!().as_c_slice(),
line: line!(),
column: column!(),
@ -405,13 +405,18 @@ extern fn stop_fn(_version: c_int,
}
}
static EXCEPTION_ID_LOOKUP: [(&str, u32); 6] = [
("runtimeerror", 0),
// Must be kept in sync with preallocate_runtime_exception_names() in artiq/language/embedding_map.py
static EXCEPTION_ID_LOOKUP: [(&str, u32); 10] = [
("RuntimeError", 0),
("RTIOUnderflow", 1),
("RTIOOverflow", 2),
("RTIODestinationUnreachable", 3),
("DMAError", 4),
("I2CError", 5),
("CacheError", 6),
("SPIError", 7),
("ZeroDivisionError", 8),
("IndexError", 9)
];
pub fn get_exception_id(name: &str) -> u32 {

View File

@ -203,6 +203,11 @@ pub fn resolve(required: &[u8]) -> Option<u32> {
// exceptions
api!(_Unwind_Resume = unwind::_Unwind_Resume),
api!(__nac3_personality = eh_artiq::artiq_personality),
api!(__nac3_raise = eh_artiq::raise),
api!(__nac3_resume = eh_artiq::resume),
api!(__nac3_end_catch = eh_artiq::end_catch),
// legacy exception symbols
api!(__artiq_personality = eh_artiq::artiq_personality),
api!(__artiq_raise = eh_artiq::raise),
api!(__artiq_resume = eh_artiq::resume),