Skip to content

Commit

Permalink
rust: Convert k_str_out to bindgen one
Browse files Browse the repository at this point in the history
Remove the manual k_str_out wrapper, and use the one generated by bindgen.

Signed-off-by: David Brown <david.brown@linaro.org>
  • Loading branch information
d3zd3z committed Aug 27, 2024
1 parent 9f71cc7 commit 1d9d675
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 15 deletions.
10 changes: 0 additions & 10 deletions lib/rust/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,4 @@ int main(void)
return 0;
}

#ifdef CONFIG_PRINTK
/*
* Until we have syscall support in Rust, wrap this syscall.
*/
void wrapped_str_out(char *c, size_t n)
{
k_str_out(c, n);
}
#endif

#endif
6 changes: 1 addition & 5 deletions lib/rust/zephyr/src/printk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ impl Context {
fn flush(&mut self) {
if self.count > 0 {
unsafe {
wrapped_str_out(self.buf.as_ptr(), self.count);
zephyr_sys::k_str_out(self.buf.as_mut_ptr() as *mut i8, self.count);
}
self.count = 0;
}
Expand Down Expand Up @@ -111,7 +111,3 @@ pub fn printkln(args: Arguments<'_>) {
context.add_byte(b'\n');
context.flush();
}

extern "C" {
fn wrapped_str_out(buf: *const u8, len: usize);
}

0 comments on commit 1d9d675

Please sign in to comment.