diff --git a/sim/mcuboot-sys/src/api.rs b/sim/mcuboot-sys/src/api.rs index db8564d3..7014d5c8 100644 --- a/sim/mcuboot-sys/src/api.rs +++ b/sim/mcuboot-sys/src/api.rs @@ -189,42 +189,42 @@ pub fn clear_flash(dev_id: u8) { // This isn't meant to call directly, but by a wrapper. #[no_mangle] -pub extern fn sim_get_flash_areas() -> *const CAreaDesc { +pub extern "C" fn sim_get_flash_areas() -> *const CAreaDesc { THREAD_CTX.with(|ctx| { ctx.borrow().flash_areas.ptr }) } #[no_mangle] -pub extern fn sim_set_flash_areas(areas: *const CAreaDesc) { +pub extern "C" fn sim_set_flash_areas(areas: *const CAreaDesc) { THREAD_CTX.with(|ctx| { ctx.borrow_mut().flash_areas.ptr = areas; }); } #[no_mangle] -pub extern fn sim_reset_flash_areas() { +pub extern "C" fn sim_reset_flash_areas() { THREAD_CTX.with(|ctx| { ctx.borrow_mut().flash_areas.ptr = ptr::null(); }); } #[no_mangle] -pub extern fn sim_get_context() -> *const CSimContext { +pub extern "C" fn sim_get_context() -> *const CSimContext { SIM_CTX.with(|ctx| { ctx.borrow().ptr }) } #[no_mangle] -pub extern fn sim_set_context(ptr: *const CSimContext) { +pub extern "C" fn sim_set_context(ptr: *const CSimContext) { SIM_CTX.with(|ctx| { ctx.borrow_mut().ptr = ptr; }); } #[no_mangle] -pub extern fn sim_reset_context() { +pub extern "C" fn sim_reset_context() { SIM_CTX.with(|ctx| { ctx.borrow_mut().ptr = ptr::null(); }); @@ -257,7 +257,7 @@ pub fn clear_ram_info() { } #[no_mangle] -pub extern fn sim_flash_erase(dev_id: u8, offset: u32, size: u32) -> libc::c_int { +pub extern "C" fn sim_flash_erase(dev_id: u8, offset: u32, size: u32) -> libc::c_int { let mut rc: libc::c_int = -19; THREAD_CTX.with(|ctx| { if let Some(flash) = ctx.borrow().flash_map.get(&dev_id) { @@ -269,7 +269,7 @@ pub extern fn sim_flash_erase(dev_id: u8, offset: u32, size: u32) -> libc::c_int } #[no_mangle] -pub extern fn sim_flash_read(dev_id: u8, offset: u32, dest: *mut u8, size: u32) -> libc::c_int { +pub extern "C" fn sim_flash_read(dev_id: u8, offset: u32, dest: *mut u8, size: u32) -> libc::c_int { let mut rc: libc::c_int = -19; THREAD_CTX.with(|ctx| { if let Some(flash) = ctx.borrow().flash_map.get(&dev_id) { @@ -282,7 +282,7 @@ pub extern fn sim_flash_read(dev_id: u8, offset: u32, dest: *mut u8, size: u32) } #[no_mangle] -pub extern fn sim_flash_write(dev_id: u8, offset: u32, src: *const u8, size: u32) -> libc::c_int { +pub extern "C" fn sim_flash_write(dev_id: u8, offset: u32, src: *const u8, size: u32) -> libc::c_int { let mut rc: libc::c_int = -19; THREAD_CTX.with(|ctx| { if let Some(flash) = ctx.borrow().flash_map.get(&dev_id) { @@ -295,14 +295,14 @@ pub extern fn sim_flash_write(dev_id: u8, offset: u32, src: *const u8, size: u32 } #[no_mangle] -pub extern fn sim_flash_align(id: u8) -> u32 { +pub extern "C" fn sim_flash_align(id: u8) -> u32 { THREAD_CTX.with(|ctx| { ctx.borrow().flash_params.get(&id).unwrap().align }) } #[no_mangle] -pub extern fn sim_flash_erased_val(id: u8) -> u8 { +pub extern "C" fn sim_flash_erased_val(id: u8) -> u8 { THREAD_CTX.with(|ctx| { ctx.borrow().flash_params.get(&id).unwrap().erased_val }) @@ -325,7 +325,7 @@ fn map_err(err: Result<()>) -> libc::c_int { /// or /// RUST_LOG=bootsim=info cargo run --release runall #[no_mangle] -pub extern fn sim_log_enabled(level: libc::c_int) -> libc::c_int { +pub extern "C" fn sim_log_enabled(level: libc::c_int) -> libc::c_int { let res = match level { 1 => log_enabled!(Level::Error), 2 => log_enabled!(Level::Warn),