Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rust timer example #4

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

Rust timer example #4

wants to merge 7 commits into from

Conversation

nebkor
Copy link
Collaborator

@nebkor nebkor commented May 30, 2022

OK, I think this branch is reasonably ready to merge into main, provided @dbt signs off on being able to build it on his system.

Doesn't actually run, though it does build and boot.
Error messages could be better, but at least you can have arbitrary expressions as the value
argument to the macro.
proc_macros are required to have the function signature `pub fn(...)`, which means it can't be
`pub unsafe fn(...)`. But they'll expand out to something that requires using `unsafe` at the call
site, so at least users will be forced to face their life choices directly.
@nebkor nebkor requested review from dbt and swetland May 30, 2022 22:37
@dbt
Copy link
Collaborator

dbt commented May 31, 2022

Still failing for me, I'm guessing I'm missing a weird path dependency because I still have all the necessary compiler packages installed to build the C stuff.

% cargo clean
% git clean -fdx
% cargo build 
   Compiling libc v0.2.126
   Compiling memchr v2.5.0
   Compiling glob v0.3.0
   Compiling proc-macro2 v1.0.39
   Compiling cfg-if v1.0.0
   Compiling unicode-ident v1.0.0
   Compiling log v0.4.17
   Compiling regex-syntax v0.6.26
   Compiling minimal-lexical v0.2.1
   Compiling compiler_builtins v0.1.71
   Compiling unicode-width v0.1.9
   Compiling humantime v2.1.0
   Compiling vec_map v0.8.2
   Compiling ansi_term v0.12.1
   Compiling strsim v0.8.0
   Compiling bitflags v1.3.2
   Compiling either v1.6.1
   Compiling termcolor v1.1.3
   Compiling bindgen v0.59.2
   Compiling cc v1.0.73
   Compiling rustc-hash v1.1.0
   Compiling peeking_take_while v0.1.2
   Compiling shlex v1.1.0
   Compiling lazy_static v1.4.0
   Compiling syn v1.0.95
   Compiling core v0.0.0 (/home/dbt/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core)
   Compiling lazycell v1.3.0
   Compiling libloading v0.7.3
   Compiling textwrap v0.11.0
   Compiling clang-sys v1.3.2
   Compiling quote v1.0.18
   Compiling aho-corasick v0.7.18
   Compiling nom v7.1.1
   Compiling ex-timer v0.1.0 (/home/dbt/Projects/OS/os-workshop/rust/ex-timer)
   Compiling atty v0.2.14
   Compiling which v4.2.5
   Compiling clap v2.34.0
   Compiling regex v1.5.6
   Compiling env_logger v0.9.0
   Compiling cexpr v0.6.0
   Compiling tiny-rt-macros v0.1.0 (/home/dbt/Projects/OS/os-workshop/rust/tiny-rt-macros)
   Compiling tiny-rt v0.1.0 (/home/dbt/Projects/OS/os-workshop/rust/tiny-rt)
   Compiling rustc-std-workspace-core v1.99.0 (/home/dbt/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/rustc-std-workspace-core)
   Compiling cty v0.2.2
error: failed to run custom build command for `tiny-rt v0.1.0 (/home/dbt/Projects/OS/os-workshop/rust/tiny-rt)`

Caused by:
  process didn't exit successfully: `/home/dbt/Projects/OS/os-workshop/rust/target/debug/build/tiny-rt-d299a17e28995c0f/build-script-build` (exit status: 101)
  --- stdout
  cargo:rerun-if-changed=../../external/vgafonts.c
  cargo:rerun-if-changed=platform_bindings.h
  cargo:rerun-if-changed=build.rs
  cargo:rustc-link-arg=-Tmake/app.ram.ld
  cargo:rustc-link-arg=-melf32lriscv
  cargo:rustc-link-search=/home/dbt/Projects/OS/os-workshop/rust/target/riscv32ima-unknown-none-elf/debug/build/tiny-rt-7eb4ad6a0c5dd89c/out

  --- stderr
  ./../../hw/inc/hw/platform.h:43:10: fatal error: 'stdint.h' file not found
  ./../../hw/inc/hw/platform.h:43:10: fatal error: 'stdint.h' file not found, err: true
  thread 'main' panicked at 'Could not generate Rust bindings from platform_bindings.h: ()', tiny-rt/build.rs:38:10
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
% 

@nebkor
Copy link
Collaborator Author

nebkor commented May 31, 2022

Well, telling bindgen to pretend to be an assembler didn't break anything, so if you can verify that works for you, call it good?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants