rust-embedded / cortex-m-semihosting

Semihosting for ARM Cortex-M processors
Apache License 2.0
40 stars 19 forks source link

Make hprint macros ignore any errors #48

Closed jonas-schievink closed 4 years ago

jonas-schievink commented 4 years ago

Closes #46

rust-highfive commented 4 years ago

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @thejpster (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

japaric commented 4 years ago

IMO, panicking is too open ended to rely on it for these kind of errors. For example, the chosen panic handler (e.g. panic-semihosting) could use semihosting to report the panic message to the user. In that case, these unwraps would likely result in infinite recursion (recursive panicking) and thus a stack overflow (UB in MPU-less devices). panic-semihosting, unlike std, does not abort on double panic and even if it did the abort handler (HardFault) is user defined so it could call panic! as well.

I don't have a strong opinion about semihosting though other that it's a pretty bad choice for logging outside of QEMU.

jonas-schievink commented 4 years ago

these unwraps would likely result in infinite recursion

Good point, didn't think of that. I see two options:

I don't have a strong opinion about semihosting though other that it's a pretty bad choice for logging outside of QEMU.

Definitely, but it's still used by many people since the quickstart repo pulls it in. It's also in the rust-embedded org, which makes it look official and recommended. I almost want to see this crate getting deprecated, but it does have its uses on M0(+) chips.

jonas-schievink commented 4 years ago

r? @adamgreig

bors[bot] commented 4 years ago

Build failed:

jonas-schievink commented 4 years ago

Arm servers being unreliable again...

bors retry

therealprof commented 4 years ago

Hm, can't we use the llvm-binutils instead?

bors[bot] commented 4 years ago

Build failed:

adamgreig commented 4 years ago

bors retry

bors[bot] commented 4 years ago

Build failed:

adamgreig commented 4 years ago

bors retry

bors[bot] commented 4 years ago

Build failed:

adamgreig commented 4 years ago

Urgh, ARM download servers at it again. Can we just put the semihosting asm call into the nice new cortex-m stuff, then call it from here, so this crate doesn't need any asm, any prebuilt files, or need to use gcc?

bors retry

bors[bot] commented 4 years ago

Build succeeded: