* proof of concept * fix syntax for rust and add auto fix syntax * fix syntax for C * fix bug with files owner * add information to wiki * try to add ci * format code from master * even more format fixes * change docker to docker-compose * Exclude ./target_*/build directories from format check * Run rustfmt only on project files * add ulimit setup for long clang list * merge * fix rustfmt, exclude target Inc directory * sync with master * abspath Co-authored-by: aanper <mail@s3f.ru> Co-authored-by: Vadim Kaushan <admin@disasm.info>
40 lines
806 B
Rust
40 lines
806 B
Rust
#![no_std]
|
|
|
|
#[cfg(target_arch = "arm")]
|
|
use flipper_f1_sys::hal::{huart1, HAL_UART_Transmit_IT};
|
|
|
|
#[no_mangle]
|
|
pub extern "C" fn add(a: u32, b: u32) -> u32 {
|
|
a + b
|
|
}
|
|
|
|
#[no_mangle]
|
|
pub extern "C" fn rust_uart_write() {
|
|
let string = "Rust test string\n";
|
|
let bytes = string.as_bytes();
|
|
|
|
#[cfg(target_arch = "arm")]
|
|
unsafe {
|
|
HAL_UART_Transmit_IT(&mut huart1, bytes.as_ptr() as *mut _, bytes.len() as u16);
|
|
}
|
|
#[cfg(not(target_arch = "arm"))]
|
|
unsafe {
|
|
extern "C" {
|
|
fn write(handle: i32, ptr: *const u8, size: usize) -> isize;
|
|
}
|
|
|
|
write(1, bytes.as_ptr(), bytes.len());
|
|
}
|
|
}
|
|
|
|
mod aux {
|
|
use core::panic::PanicInfo;
|
|
|
|
#[panic_handler]
|
|
fn panic(_info: &PanicInfo) -> ! {
|
|
loop {
|
|
continue;
|
|
}
|
|
}
|
|
}
|