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

time from crates.io doesn't support no_std #280

Closed
mattico opened this issue Sep 28, 2020 · 7 comments
Closed

time from crates.io doesn't support no_std #280

mattico opened this issue Sep 28, 2020 · 7 comments
Labels
A-targets Area: support for various targets C-bug Category: bug in current code

Comments

@mattico
Copy link

mattico commented Sep 28, 2020

https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#multiple-locations

It is possible to specify both a registry version and a git or path location. The git or path dependency will be used locally (in which case the version is ignored), and when published to a registry like crates.io, it will use the registry version.

time-macros = { version = "0.1", path = "time-macros" }

So, while CI uses the path dependency, the crates.io crate uses the old time-macros from 8 months ago, which does not support no_std.

@jhpratt
Copy link
Member

jhpratt commented Sep 28, 2020

What version of time-macros-impl is in your Cargo.lock file? Performing cargo update should suffice, I believe.

@mattico
Copy link
Author

mattico commented Sep 28, 2020

The problem occurs while compiling time-macros. time-macros 0.1.0, the most recent version on crates.io does not include a933f2a.

   Compiling time-macros v0.1.0
error[E0463]: can't find crate for `std`
  |
  = note: the `thumbv7em-none-eabihf` target may not be installed

error: aborting due to previous error
[[package]]
name = "time"
version = "0.2.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "55b7151c9065e80917fbf285d9a5d1432f60db41d170ccafc749a136b41a93af"
dependencies = [
 "const_fn",
 "standback",
 "time-macros",
 "version_check",
]

[[package]]
name = "time-macros"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ae9b6e9f095bc105e183e3cd493d72579be3181ad4004fceb01adbe9eecab2d"
dependencies = [
 "proc-macro-hack",
 "time-macros-impl",
]

[[package]]
name = "time-macros-impl"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e5c3be1edfad6027c69f5491cf4cb310d1a71ecd6af742788c6ff8bced86b8fa"
dependencies = [
 "proc-macro-hack",
 "proc-macro2",
 "quote",
 "standback",
 "syn",
]

@jhpratt
Copy link
Member

jhpratt commented Sep 28, 2020

Have you tried performing cargo update as suggested? I'm pretty sure this updates indirect dependencies as well.

@mattico
Copy link
Author

mattico commented Sep 28, 2020

Yes, I have run cargo update. I am using the most recent version of time-macros from crates.io. The most recent version is 0.1.0. That version does not include this line:

a933f2a#diff-d5f397db43b8797da48f8cb404ede974R1

which is required to build on no_std.

@jhpratt
Copy link
Member

jhpratt commented Sep 28, 2020

Confirmed. Not sure how I missed this before. I'll get a new time-macros release out today that includes everything already on main. Once that's out, cargo update will suffice.

@jhpratt jhpratt added A-targets Area: support for various targets C-bug Category: bug in current code labels Sep 28, 2020
@mattico
Copy link
Author

mattico commented Sep 28, 2020

Thanks so much!

@jhpratt
Copy link
Member

jhpratt commented Sep 29, 2020

I've just pushed and published the relevant commit. Let me know if cargo update doesn't work for whatever reason 🙂

@jhpratt jhpratt closed this as completed Sep 29, 2020
bors bot added a commit to stm32-rs/stm32h7xx-hal that referenced this issue Oct 12, 2020
143: Implement RTC r=richardeoin a=mattico

The RTC is a bit strange due to the backup power domain. I tried varying amounts of integration with the standard RCC, REC, PWR methods, but the implementation and semantics conflicted. Instead I added `Backup` to manage the backup power domain. Right now it's just the RTC but hypothetically it could help manage the backup SRAM and the LSE.

~~I started out with a minimal `Date`/`Time` implementation but found myself implementing more and more functionality so I replaced it with the `time` crate. It has a `no_std` mode but always requires an allocator. This isn't an issue for me but I might re-introduce the simple `Date`/`Time` and maybe genericize functions that take one of those as an argument.~~

I moved to the `chrono` crate since it doesn't require allocation.

Interested in any feedback you have.

### Blocked on:

- [x] time-rs/time#280
- [x] RTC HSE divider is configurable according to CubeMX
- [x] stm32h7 (stm32-rs/stm32-rs#446, stm32-rs/stm32-rs#445)


Co-authored-by: Matt Ickstadt <mattico8@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-targets Area: support for various targets C-bug Category: bug in current code
Projects
None yet
Development

No branches or pull requests

2 participants