-
Notifications
You must be signed in to change notification settings - Fork 157
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
Import cortex-m-semihosting and panic-semihosting into this repo #263
Conversation
r? @adamgreig (rust_highfive has picked a reviewer for you, use r? to override) |
I am still very much not a fan of this and would like to put this up for a vote. |
PR looks fine content-wise. @therealprof, I know you weren't keen on having semihosting be part of cortex-m itself, but what's the issue with having the crates live inside this repo? We save on management and overhead, but it doesn't change anything for users. Is the objection just to having any semihosting support at all? |
I think it doesn't feel right from an architectural standpoint to depend on the semihosting crate and a panic handler just for CI purposes. Moving them into this repository blesses the semihosting approach and highlights it in a weird way. I'd rather we only move the |
How else would you test inside qemu? |
Not even sure what we want to test in |
Semihosting is, to my knowledge, the only way to terminate QEMU with a success error code, and the only clean way to terminate it with an error code (the non-clean way is to cause a lockup). It is also the simplest way to print to stdout, which is useful for doing snapshot testing outside of QEMU (I'm not aware of any others that work on all targets we support). I did not add any tests to this PR because I wanted to land the basic prerequisites first (and tests are quite distinct from what this PR aims to do), but if even that ends up being so controversial I'm not sure if my time isn't better spent elsewhere.
I think it is now highlighted much less than before, when it had its own dedicated repo and issue tracker. |
I don't see why we couldn't just use the
Yeah, sorry about that (although my criticism shouldn't at all come as a big surprise). I'm all for bringing in test scaffolding and low level primitives for testing, I am still not conviced this is the only or right approach to do this.
I respectfully disagree that |
That's what this does, essentially; it's providing the wrapper code around
What issues do you think this will cause compared to having them separate, either for us or for users? I know you don't like people using semihosting, not least because it often causes confusion when code doesn't run without a debugger present, but organisationally this move seems to save us work and effort and remove duplication of CI/test infra, without any impact on users that I'm aware of. |
I'm in favor of this change. I don't think this is putting semihosting at a spotlight or something, the people looking at our CI probably already know its disadvantages and alternatives. If we wish to discourage beginners to use semihosting, our time would be better spent removing it from examples, which is arguably already happening and we have a lot of other tools in the spotlight now. Also, I don't understand why we should go out of our way to look for possible alternatives when the work is already done and it matches our requirements. Anyway, this is my opinion on the matter, thanks for your work Jonas. |
The wrapper and panic handler go way beyond providing lowlevel primitives which is what this repo should focus on IMHO. The only motiviation mentioned to break out of this idea is to enable CI which this PR doesn't even do. At the very least I'd like to see how this is going to be used to maybe come up with a possible alternative.
For me
I do think it makes it harder for us to discourage the use of semihosting if we cannot keep the distance ourselves and accept bug reports for it in our central platform support repository.
While this might save us an unquantified bit of duplicate work it also increases the risk of CI breakage due to some semihosting related breakage. All of this stuff is very low-level and somewhat fragile to compiler changes and whatnot; increasing the complexity is not going to help here. |
We already provide
Especially given as ITM stuff is already in cortex-m, I'd be entirely in favour of putting panic-itm inside cortex-m. It makes it even easier for cortex-m users to specify a provided panic handler. We could even put panic-abort inside and thus reduce the dependency count of many apps one further. I see
We already support cortex-m-semihosting as an official working group crate and repository, so any such breakage would just happen there instead and still need to be dealt with. Importing it here seems like a net win. |
Sorry, completely forgot about this still being open. I could find solace by moving a variety panic handlers into There would be a few more points I could bring to the table re maintenance and (undesirably) bringing a spotlight to semihosting but if we integrate all sorts of panic handlers I could live with the maintenance complications and my main concern would be resolved. |
They're all so simple that honestly just having a copy in cortex-m doesn't seem like a problem. It provides a useful feature to users of the crate and makes quickly adopting some sort of default panic handler easier. I'd propose in addition to semihosting we include itm (using existing iprintln), abort/halt (infinite loop), and perhaps fault (jump to hardfault). Could those be a new PR so we can get this one moving? |
Fine. Who's going to do all the maintainance work and how do we handle the republishing of the crates with the correct new repository URL? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, here's a proposal based on the meeting yesterday:
- Update links as suggested in this review
- Fix merge errors by rebuilding precompiled libs
- Merge this PR
- Apply https://github.com/rust-embedded/cortex-m-semihosting/pull/41/files in a new PR
- Check for breakage and update cortex-m dependency in cortex-m-semihosting and panic-semihosting to allow cortex-m <0.8 instead of <0.7
- Release cortex-m-semihosting 0.4.0 with those changes, publishing the new links and ensuring compatibility with the new cortex-m
- Release panic-semihosting 0.5.4, same deal
- Mark the two old repositories as archived
- Merge https://github.com/rust-embedded/panic-itm into this repository as well
- Update links, bump cortex-m dependency to allow 0.7.0, release v0.4.2
- Mark panic-itm repository as archived
- Release cortex-m 0.7
We could also consider:
- Apply formatting from Code formatting cortex-m-semihosting#54 but to all of cortex-m; this is a large but non-breaking change that we could probably land before 0.7 and might want to do before 1.0.
panic-semihosting/Cargo.toml
Outdated
keywords = ["panic-handler", "panic-impl", "panic", "semihosting"] | ||
license = "MIT OR Apache-2.0" | ||
name = "panic-semihosting" | ||
repository = "https://github.com/rust-embedded/panic-semihosting" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
repository = "https://github.com/rust-embedded/panic-semihosting" | |
repository = "https://github.com/rust-embedded/cortex-m" |
cortex-m-semihosting/Cargo.toml
Outdated
license = "MIT OR Apache-2.0" | ||
name = "cortex-m-semihosting" | ||
readme = "README.md" | ||
repository = "https://github.com/rust-embedded/cortex-m-semihosting" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
repository = "https://github.com/rust-embedded/cortex-m-semihosting" | |
repository = "https://github.com/rust-embedded/cortex-m" |
|
||
*Adapted from the [Node.js Policy on Trolling](http://blog.izs.me/post/30036893703/policy-on-trolling) as well as the [Contributor Covenant v1.3.0](https://www.contributor-covenant.org/version/1/3/0/).* | ||
|
||
[team]: https://github.com/rust-embedded/wg#the-cortex-m-team |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we just delete this file? It already exists in the repository root. And the LICENCE files too in fact. Same in the panic-semihosting directory.
cortex-m-semihosting/README.md
Outdated
|
||
- Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or | ||
http://www.apache.org/licenses/LICENSE-2.0) | ||
- MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we do delete the redundant licence files, these links would need updating to point to the file in the directory above, as far as I can tell that should still work even on crates.io though.
cortex-m-semihosting/README.md
Outdated
Conduct][CoC], the maintainer of this crate, the [Cortex-M team][team], promises | ||
to intervene to uphold that code of conduct. | ||
|
||
[CoC]: CODE_OF_CONDUCT.md |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This link would also need updating (and in panic-semihosting's README).
@jonas-schievink any thoughts on my review comments? If we can get those ticked off and rebuild the binary files I think we're clear to merge this and start on the rest of the checklist. |
bors merge |
Build succeeded: |
269: Merge HStdout and HStderr into the same type r=jonas-schievink a=adamgreig As the next step in #263 (review), this PR applies rust-embedded/cortex-m-semihosting#41 to this repository. @m-ou-se, I tried exporting a patch from cortex-m-semihosting and applying it here but it didn't work first time, so I ended up just copying the changes. I've set you as the author of the commit and marked it as committed-by me, I hope you're OK with that but please let me know if you'd like it changed. (Also, thanks again for the PR, sorry it's taken over a year...). Co-authored-by: Mara Bos <m-ou.se@m-ou.se>
270: Prepare for release of new versions of cortex-m-semihosting and panic-semihosting r=therealprof a=adamgreig For the next step in #263 (review), this PR increases the version number for panic-semihosting and cortex-m-semihosting. For c-m-sh this is a breaking change to include #269. Both projects seem to build just fine with cortex-m master, so I anticipate they should work fine with the to-be-released 0.7, hence increasing the acceptable cortex-m version range. The CHANGELOG links are a bit troublesome, so I've added new tags to this repo `c-m-sh-v0.3.5` and `p-sh-v0.5.3` which point to the merge commit, and I'll tag new `c-m-sh-v0.4.0` and `p-sh-v0.5.4` after this is merged. Co-authored-by: Adam Greig <adam@adamgreig.com>
263: Add triagebot configuration r=jonas-schievink a=LeSeulArtichaut This enables [assignment](https://github.com/rust-lang/triagebot/wiki/Assignment) through triagebot on this repository, in preparation for the migration from highfive to triagebot for PR assignment. cc rust-lang/highfive#258 rust-lang/triagebot#433 Co-authored-by: LeSeulArtichaut <leseulartichaut@gmail.com>
Motivation:
cortex-m
's functionality that use semihosting to control QEMU. Previously these crates would pull in another cortex-m version, which doesn't work. Now they have apath
dependency on the root crate.cargo-xtask
in general.I also want to import cortex-m-rt, but I'll do that in a later PR.
CI was updated to build-test all crates with all or most feature combinations, like it did before.