Skip to content

Commit

Permalink
chips/esp32-c3: #[naked] -> global_asm!()
Browse files Browse the repository at this point in the history
  • Loading branch information
bradjc committed Jan 18, 2024
1 parent c405b76 commit c785ca0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 16 deletions.
29 changes: 14 additions & 15 deletions chips/esp32-c3/src/chip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,16 +297,18 @@ pub extern "C" fn _start_trap_vectored() {
}

#[cfg(all(target_arch = "riscv32", target_os = "none"))]
#[link_section = ".riscv.trap_vectored"]
#[export_name = "_start_trap_vectored"]
#[naked]
pub extern "C" fn _start_trap_vectored() -> ! {
use core::arch::asm;
unsafe {
// Below are 32 (non-compressed) jumps to cover the entire possible
// range of vectored traps.
asm!(
"
extern "C" {
pub fn _start_trap_vectored();
}

#[cfg(all(target_arch = "riscv32", target_os = "none"))]
// Below are 32 (non-compressed) jumps to cover the entire possible
// range of vectored traps.
global_asm!(
"
.section .riscv.trap_vectored, \"ax\"
.globl _start_trap_vectored
_start_trap_vectored:
j _start_trap
j _start_trap
j _start_trap
Expand Down Expand Up @@ -338,8 +340,5 @@ pub extern "C" fn _start_trap_vectored() -> ! {
j _start_trap
j _start_trap
j _start_trap
",
options(noreturn)
);
}
}
"
);
1 change: 0 additions & 1 deletion chips/esp32-c3/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

//! Drivers and chip support for ESP32-C3.

#![feature(naked_functions)]
#![no_std]
#![crate_name = "esp32_c3"]
#![crate_type = "rlib"]
Expand Down

0 comments on commit c785ca0

Please sign in to comment.