-
Notifications
You must be signed in to change notification settings - Fork 198
Clarify usage of #[interrupt] attribute and recommend device crate re… #386
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
Conversation
Thanks much for this! The text is a definite improvement. I wonder why the code needed to change? Any chance you could do a similar PR for https://github.com/rust-embedded/discovery-mb2 |
It demonstrates how to use interrupts and highlights the need to include use device::interrupt. Additionally, since the emulator in this book is based on the LM3S6965, which does not have a TIM2 peripheral but instead provides TIMER2A and TIMER2B, the code must be adapted accordingly. |
their position in the interrupt handler table) are usually automatically | ||
generated via `svd2rust` from a SVD description. | ||
Similarly to exceptions, the cortex-m-rt crate exposes an [`interrupt`] attribute for declaring interrupt handlers. However, this | ||
attribute is only available when the device feature is enabled. That said, this attribute is not intended to be used directly—doing |
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.
attribute is only available when the device feature is enabled. That said, this attribute is not intended to be used directly—doing | |
attribute is only available when the device feature is enabled. That said, this attribute is not intended to be used directly — doing |
LGTM |
Update books ## rust-lang/book 3 commits in ef1ce8f87a8b18feb1b6a9cf9a4939a79bde6795..b2d1a0821e12a676b496d61891b8e3d374a8e832 2025-07-08 17:24:41 UTC to 2025-07-02 21:30:57 UTC - Chapter 16 from tech review (rust-lang/book#4438) - WIP ch 17 edits after tech review (rust-lang/book#4319) - Chapter 15 from tech review (rust-lang/book#4433) ## rust-embedded/book 1 commits in 41f688a598a5022b749e23d37f3c524f6a0b28e1..fe88fbb68391a465680dd91109f0a151a1676f3e 2025-07-08 18:54:25 UTC to 2025-07-08 18:54:25 UTC - Clarify usage of #[interrupt] attribute and recommend device crate re… (rust-embedded/book#386) ## rust-lang/nomicon 3 commits in 8b61acfaea822e9ac926190bc8f15791c33336e8..3ff384320598bbe8d8cfe5cb8f18f78a3a3e6b15 2025-07-05 07:34:22 UTC to 2025-07-05 07:13:51 UTC - Add build script part to FFI chapter for more clear and smooth learn … (rust-lang/nomicon#440) - Cleanups for tree example of splitting borrows (rust-lang/nomicon#443) - Handle drop zst (rust-lang/nomicon#425) ## rust-lang/reference 17 commits in e9fc99f107840813916f62e16b3f6d9556e1f2d8..1f45bd41fa6c17b7c048ed6bfe5f168c4311206a 2025-07-11 23:15:51 UTC to 2025-07-01 16:49:33 UTC - mention an important use for the naked attribute (rust-lang/reference#1929) - Array expression repeat operands can be const blocks. (rust-lang/reference#1928) - Document (tuple) struct pattern namespace behavior (rust-lang/reference#1925) - Replace set of en dashes with set of em dashes (rust-lang/reference#1926) - Update `should_panic` to use the attribute template (rust-lang/reference#1882) - const-eval.const-expr.borrows: mention indirect places (rust-lang/reference#1865) - associated-items.md: remove redundant word (rust-lang/reference#1874) - introduction.md: replace hard-to-read example (rust-lang/reference#1873) - typo (rust-lang/reference#1924) - Update `ignore` to use the attribute template (rust-lang/reference#1881) - Update `test` to use the attribute template (rust-lang/reference#1880) - Update `cfg_attr` to use the attribute template (rust-lang/reference#1879) - Update `cfg` to use the attribute template (rust-lang/reference#1878) - allow constants to refer to mutable/external memory, but reject such constants as patterns (rust-lang/reference#1859) - Remove outdated comment about non-copy unions (rust-lang/reference#1872) - Add a template for documenting attributes (rust-lang/reference#1877) - Switch enum grammar to use "variant" (rust-lang/reference#1876) ## rust-lang/rust-by-example 1 commits in 288b4e4948add43f387cad35adc7b1c54ca6fe12..e386be5f44af711854207c11fdd61bb576270b04 2025-07-04 23:17:15 UTC to 2025-07-04 23:17:15 UTC - Update Chinese translations (rust-lang/rust-by-example#1943)
Update books ## rust-lang/book 3 commits in ef1ce8f87a8b18feb1b6a9cf9a4939a79bde6795..b2d1a0821e12a676b496d61891b8e3d374a8e832 2025-07-08 17:24:41 UTC to 2025-07-02 21:30:57 UTC - Chapter 16 from tech review (rust-lang/book#4438) - WIP ch 17 edits after tech review (rust-lang/book#4319) - Chapter 15 from tech review (rust-lang/book#4433) ## rust-embedded/book 1 commits in 41f688a598a5022b749e23d37f3c524f6a0b28e1..fe88fbb68391a465680dd91109f0a151a1676f3e 2025-07-08 18:54:25 UTC to 2025-07-08 18:54:25 UTC - Clarify usage of #[interrupt] attribute and recommend device crate re… (rust-embedded/book#386) ## rust-lang/nomicon 3 commits in 8b61acfaea822e9ac926190bc8f15791c33336e8..3ff384320598bbe8d8cfe5cb8f18f78a3a3e6b15 2025-07-05 07:34:22 UTC to 2025-07-05 07:13:51 UTC - Add build script part to FFI chapter for more clear and smooth learn … (rust-lang/nomicon#440) - Cleanups for tree example of splitting borrows (rust-lang/nomicon#443) - Handle drop zst (rust-lang/nomicon#425) ## rust-lang/reference 17 commits in e9fc99f107840813916f62e16b3f6d9556e1f2d8..1f45bd41fa6c17b7c048ed6bfe5f168c4311206a 2025-07-11 23:15:51 UTC to 2025-07-01 16:49:33 UTC - mention an important use for the naked attribute (rust-lang/reference#1929) - Array expression repeat operands can be const blocks. (rust-lang/reference#1928) - Document (tuple) struct pattern namespace behavior (rust-lang/reference#1925) - Replace set of en dashes with set of em dashes (rust-lang/reference#1926) - Update `should_panic` to use the attribute template (rust-lang/reference#1882) - const-eval.const-expr.borrows: mention indirect places (rust-lang/reference#1865) - associated-items.md: remove redundant word (rust-lang/reference#1874) - introduction.md: replace hard-to-read example (rust-lang/reference#1873) - typo (rust-lang/reference#1924) - Update `ignore` to use the attribute template (rust-lang/reference#1881) - Update `test` to use the attribute template (rust-lang/reference#1880) - Update `cfg_attr` to use the attribute template (rust-lang/reference#1879) - Update `cfg` to use the attribute template (rust-lang/reference#1878) - allow constants to refer to mutable/external memory, but reject such constants as patterns (rust-lang/reference#1859) - Remove outdated comment about non-copy unions (rust-lang/reference#1872) - Add a template for documenting attributes (rust-lang/reference#1877) - Switch enum grammar to use "variant" (rust-lang/reference#1876) ## rust-lang/rust-by-example 1 commits in 288b4e4948add43f387cad35adc7b1c54ca6fe12..e386be5f44af711854207c11fdd61bb576270b04 2025-07-04 23:17:15 UTC to 2025-07-04 23:17:15 UTC - Update Chinese translations (rust-lang/rust-by-example#1943)
Update books ## rust-lang/book 3 commits in ef1ce8f87a8b18feb1b6a9cf9a4939a79bde6795..b2d1a0821e12a676b496d61891b8e3d374a8e832 2025-07-08 17:24:41 UTC to 2025-07-02 21:30:57 UTC - Chapter 16 from tech review (rust-lang/book#4438) - WIP ch 17 edits after tech review (rust-lang/book#4319) - Chapter 15 from tech review (rust-lang/book#4433) ## rust-embedded/book 1 commits in 41f688a598a5022b749e23d37f3c524f6a0b28e1..fe88fbb68391a465680dd91109f0a151a1676f3e 2025-07-08 18:54:25 UTC to 2025-07-08 18:54:25 UTC - Clarify usage of #[interrupt] attribute and recommend device crate re… (rust-embedded/book#386) ## rust-lang/nomicon 3 commits in 8b61acfaea822e9ac926190bc8f15791c33336e8..3ff384320598bbe8d8cfe5cb8f18f78a3a3e6b15 2025-07-05 07:34:22 UTC to 2025-07-05 07:13:51 UTC - Add build script part to FFI chapter for more clear and smooth learn … (rust-lang/nomicon#440) - Cleanups for tree example of splitting borrows (rust-lang/nomicon#443) - Handle drop zst (rust-lang/nomicon#425) ## rust-lang/reference 17 commits in e9fc99f107840813916f62e16b3f6d9556e1f2d8..1f45bd41fa6c17b7c048ed6bfe5f168c4311206a 2025-07-11 23:15:51 UTC to 2025-07-01 16:49:33 UTC - mention an important use for the naked attribute (rust-lang/reference#1929) - Array expression repeat operands can be const blocks. (rust-lang/reference#1928) - Document (tuple) struct pattern namespace behavior (rust-lang/reference#1925) - Replace set of en dashes with set of em dashes (rust-lang/reference#1926) - Update `should_panic` to use the attribute template (rust-lang/reference#1882) - const-eval.const-expr.borrows: mention indirect places (rust-lang/reference#1865) - associated-items.md: remove redundant word (rust-lang/reference#1874) - introduction.md: replace hard-to-read example (rust-lang/reference#1873) - typo (rust-lang/reference#1924) - Update `ignore` to use the attribute template (rust-lang/reference#1881) - Update `test` to use the attribute template (rust-lang/reference#1880) - Update `cfg_attr` to use the attribute template (rust-lang/reference#1879) - Update `cfg` to use the attribute template (rust-lang/reference#1878) - allow constants to refer to mutable/external memory, but reject such constants as patterns (rust-lang/reference#1859) - Remove outdated comment about non-copy unions (rust-lang/reference#1872) - Add a template for documenting attributes (rust-lang/reference#1877) - Switch enum grammar to use "variant" (rust-lang/reference#1876) ## rust-lang/rust-by-example 1 commits in 288b4e4948add43f387cad35adc7b1c54ca6fe12..e386be5f44af711854207c11fdd61bb576270b04 2025-07-04 23:17:15 UTC to 2025-07-04 23:17:15 UTC - Update Chinese translations (rust-lang/rust-by-example#1943)
Update books ## rust-lang/book 3 commits in ef1ce8f87a8b18feb1b6a9cf9a4939a79bde6795..b2d1a0821e12a676b496d61891b8e3d374a8e832 2025-07-08 17:24:41 UTC to 2025-07-02 21:30:57 UTC - Chapter 16 from tech review (rust-lang/book#4438) - WIP ch 17 edits after tech review (rust-lang/book#4319) - Chapter 15 from tech review (rust-lang/book#4433) ## rust-embedded/book 1 commits in 41f688a598a5022b749e23d37f3c524f6a0b28e1..fe88fbb68391a465680dd91109f0a151a1676f3e 2025-07-08 18:54:25 UTC to 2025-07-08 18:54:25 UTC - Clarify usage of #[interrupt] attribute and recommend device crate re… (rust-embedded/book#386) ## rust-lang/nomicon 3 commits in 8b61acfaea822e9ac926190bc8f15791c33336e8..3ff384320598bbe8d8cfe5cb8f18f78a3a3e6b15 2025-07-05 07:34:22 UTC to 2025-07-05 07:13:51 UTC - Add build script part to FFI chapter for more clear and smooth learn … (rust-lang/nomicon#440) - Cleanups for tree example of splitting borrows (rust-lang/nomicon#443) - Handle drop zst (rust-lang/nomicon#425) ## rust-lang/reference 17 commits in e9fc99f107840813916f62e16b3f6d9556e1f2d8..1f45bd41fa6c17b7c048ed6bfe5f168c4311206a 2025-07-11 23:15:51 UTC to 2025-07-01 16:49:33 UTC - mention an important use for the naked attribute (rust-lang/reference#1929) - Array expression repeat operands can be const blocks. (rust-lang/reference#1928) - Document (tuple) struct pattern namespace behavior (rust-lang/reference#1925) - Replace set of en dashes with set of em dashes (rust-lang/reference#1926) - Update `should_panic` to use the attribute template (rust-lang/reference#1882) - const-eval.const-expr.borrows: mention indirect places (rust-lang/reference#1865) - associated-items.md: remove redundant word (rust-lang/reference#1874) - introduction.md: replace hard-to-read example (rust-lang/reference#1873) - typo (rust-lang/reference#1924) - Update `ignore` to use the attribute template (rust-lang/reference#1881) - Update `test` to use the attribute template (rust-lang/reference#1880) - Update `cfg_attr` to use the attribute template (rust-lang/reference#1879) - Update `cfg` to use the attribute template (rust-lang/reference#1878) - allow constants to refer to mutable/external memory, but reject such constants as patterns (rust-lang/reference#1859) - Remove outdated comment about non-copy unions (rust-lang/reference#1872) - Add a template for documenting attributes (rust-lang/reference#1877) - Switch enum grammar to use "variant" (rust-lang/reference#1876) ## rust-lang/rust-by-example 1 commits in 288b4e4948add43f387cad35adc7b1c54ca6fe12..e386be5f44af711854207c11fdd61bb576270b04 2025-07-04 23:17:15 UTC to 2025-07-04 23:17:15 UTC - Update Chinese translations (rust-lang/rust-by-example#1943)
Rollup merge of #143938 - rustbot:docs-update, r=ehuss Update books ## rust-lang/book 3 commits in ef1ce8f87a8b18feb1b6a9cf9a4939a79bde6795..b2d1a0821e12a676b496d61891b8e3d374a8e832 2025-07-08 17:24:41 UTC to 2025-07-02 21:30:57 UTC - Chapter 16 from tech review (rust-lang/book#4438) - WIP ch 17 edits after tech review (rust-lang/book#4319) - Chapter 15 from tech review (rust-lang/book#4433) ## rust-embedded/book 1 commits in 41f688a598a5022b749e23d37f3c524f6a0b28e1..fe88fbb68391a465680dd91109f0a151a1676f3e 2025-07-08 18:54:25 UTC to 2025-07-08 18:54:25 UTC - Clarify usage of #[interrupt] attribute and recommend device crate re… (rust-embedded/book#386) ## rust-lang/nomicon 3 commits in 8b61acfaea822e9ac926190bc8f15791c33336e8..3ff384320598bbe8d8cfe5cb8f18f78a3a3e6b15 2025-07-05 07:34:22 UTC to 2025-07-05 07:13:51 UTC - Add build script part to FFI chapter for more clear and smooth learn … (rust-lang/nomicon#440) - Cleanups for tree example of splitting borrows (rust-lang/nomicon#443) - Handle drop zst (rust-lang/nomicon#425) ## rust-lang/reference 17 commits in e9fc99f107840813916f62e16b3f6d9556e1f2d8..1f45bd41fa6c17b7c048ed6bfe5f168c4311206a 2025-07-11 23:15:51 UTC to 2025-07-01 16:49:33 UTC - mention an important use for the naked attribute (rust-lang/reference#1929) - Array expression repeat operands can be const blocks. (rust-lang/reference#1928) - Document (tuple) struct pattern namespace behavior (rust-lang/reference#1925) - Replace set of en dashes with set of em dashes (rust-lang/reference#1926) - Update `should_panic` to use the attribute template (rust-lang/reference#1882) - const-eval.const-expr.borrows: mention indirect places (rust-lang/reference#1865) - associated-items.md: remove redundant word (rust-lang/reference#1874) - introduction.md: replace hard-to-read example (rust-lang/reference#1873) - typo (rust-lang/reference#1924) - Update `ignore` to use the attribute template (rust-lang/reference#1881) - Update `test` to use the attribute template (rust-lang/reference#1880) - Update `cfg_attr` to use the attribute template (rust-lang/reference#1879) - Update `cfg` to use the attribute template (rust-lang/reference#1878) - allow constants to refer to mutable/external memory, but reject such constants as patterns (rust-lang/reference#1859) - Remove outdated comment about non-copy unions (rust-lang/reference#1872) - Add a template for documenting attributes (rust-lang/reference#1877) - Switch enum grammar to use "variant" (rust-lang/reference#1876) ## rust-lang/rust-by-example 1 commits in 288b4e4948add43f387cad35adc7b1c54ca6fe12..e386be5f44af711854207c11fdd61bb576270b04 2025-07-04 23:17:15 UTC to 2025-07-04 23:17:15 UTC - Update Chinese translations (rust-lang/rust-by-example#1943)
Update books ## rust-lang/book 3 commits in ef1ce8f87a8b18feb1b6a9cf9a4939a79bde6795..b2d1a0821e12a676b496d61891b8e3d374a8e832 2025-07-08 17:24:41 UTC to 2025-07-02 21:30:57 UTC - Chapter 16 from tech review (rust-lang/book#4438) - WIP ch 17 edits after tech review (rust-lang/book#4319) - Chapter 15 from tech review (rust-lang/book#4433) ## rust-embedded/book 1 commits in 41f688a598a5022b749e23d37f3c524f6a0b28e1..fe88fbb68391a465680dd91109f0a151a1676f3e 2025-07-08 18:54:25 UTC to 2025-07-08 18:54:25 UTC - Clarify usage of #[interrupt] attribute and recommend device crate re… (rust-embedded/book#386) ## rust-lang/nomicon 3 commits in 8b61acfaea822e9ac926190bc8f15791c33336e8..3ff384320598bbe8d8cfe5cb8f18f78a3a3e6b15 2025-07-05 07:34:22 UTC to 2025-07-05 07:13:51 UTC - Add build script part to FFI chapter for more clear and smooth learn … (rust-lang/nomicon#440) - Cleanups for tree example of splitting borrows (rust-lang/nomicon#443) - Handle drop zst (rust-lang/nomicon#425) ## rust-lang/reference 17 commits in e9fc99f107840813916f62e16b3f6d9556e1f2d8..1f45bd41fa6c17b7c048ed6bfe5f168c4311206a 2025-07-11 23:15:51 UTC to 2025-07-01 16:49:33 UTC - mention an important use for the naked attribute (rust-lang/reference#1929) - Array expression repeat operands can be const blocks. (rust-lang/reference#1928) - Document (tuple) struct pattern namespace behavior (rust-lang/reference#1925) - Replace set of en dashes with set of em dashes (rust-lang/reference#1926) - Update `should_panic` to use the attribute template (rust-lang/reference#1882) - const-eval.const-expr.borrows: mention indirect places (rust-lang/reference#1865) - associated-items.md: remove redundant word (rust-lang/reference#1874) - introduction.md: replace hard-to-read example (rust-lang/reference#1873) - typo (rust-lang/reference#1924) - Update `ignore` to use the attribute template (rust-lang/reference#1881) - Update `test` to use the attribute template (rust-lang/reference#1880) - Update `cfg_attr` to use the attribute template (rust-lang/reference#1879) - Update `cfg` to use the attribute template (rust-lang/reference#1878) - allow constants to refer to mutable/external memory, but reject such constants as patterns (rust-lang/reference#1859) - Remove outdated comment about non-copy unions (rust-lang/reference#1872) - Add a template for documenting attributes (rust-lang/reference#1877) - Switch enum grammar to use "variant" (rust-lang/reference#1876) ## rust-lang/rust-by-example 1 commits in 288b4e4948add43f387cad35adc7b1c54ca6fe12..e386be5f44af711854207c11fdd61bb576270b04 2025-07-04 23:17:15 UTC to 2025-07-04 23:17:15 UTC - Update Chinese translations (rust-lang/rust-by-example#1943)
Update books ## rust-lang/book 3 commits in ef1ce8f87a8b18feb1b6a9cf9a4939a79bde6795..b2d1a0821e12a676b496d61891b8e3d374a8e832 2025-07-08 17:24:41 UTC to 2025-07-02 21:30:57 UTC - Chapter 16 from tech review (rust-lang/book#4438) - WIP ch 17 edits after tech review (rust-lang/book#4319) - Chapter 15 from tech review (rust-lang/book#4433) ## rust-embedded/book 1 commits in 41f688a598a5022b749e23d37f3c524f6a0b28e1..fe88fbb68391a465680dd91109f0a151a1676f3e 2025-07-08 18:54:25 UTC to 2025-07-08 18:54:25 UTC - Clarify usage of #[interrupt] attribute and recommend device crate re… (rust-embedded/book#386) ## rust-lang/nomicon 3 commits in 8b61acfaea822e9ac926190bc8f15791c33336e8..3ff384320598bbe8d8cfe5cb8f18f78a3a3e6b15 2025-07-05 07:34:22 UTC to 2025-07-05 07:13:51 UTC - Add build script part to FFI chapter for more clear and smooth learn … (rust-lang/nomicon#440) - Cleanups for tree example of splitting borrows (rust-lang/nomicon#443) - Handle drop zst (rust-lang/nomicon#425) ## rust-lang/reference 17 commits in e9fc99f107840813916f62e16b3f6d9556e1f2d8..1f45bd41fa6c17b7c048ed6bfe5f168c4311206a 2025-07-11 23:15:51 UTC to 2025-07-01 16:49:33 UTC - mention an important use for the naked attribute (rust-lang/reference#1929) - Array expression repeat operands can be const blocks. (rust-lang/reference#1928) - Document (tuple) struct pattern namespace behavior (rust-lang/reference#1925) - Replace set of en dashes with set of em dashes (rust-lang/reference#1926) - Update `should_panic` to use the attribute template (rust-lang/reference#1882) - const-eval.const-expr.borrows: mention indirect places (rust-lang/reference#1865) - associated-items.md: remove redundant word (rust-lang/reference#1874) - introduction.md: replace hard-to-read example (rust-lang/reference#1873) - typo (rust-lang/reference#1924) - Update `ignore` to use the attribute template (rust-lang/reference#1881) - Update `test` to use the attribute template (rust-lang/reference#1880) - Update `cfg_attr` to use the attribute template (rust-lang/reference#1879) - Update `cfg` to use the attribute template (rust-lang/reference#1878) - allow constants to refer to mutable/external memory, but reject such constants as patterns (rust-lang/reference#1859) - Remove outdated comment about non-copy unions (rust-lang/reference#1872) - Add a template for documenting attributes (rust-lang/reference#1877) - Switch enum grammar to use "variant" (rust-lang/reference#1876) ## rust-lang/rust-by-example 1 commits in 288b4e4948add43f387cad35adc7b1c54ca6fe12..e386be5f44af711854207c11fdd61bb576270b04 2025-07-04 23:17:15 UTC to 2025-07-04 23:17:15 UTC - Update Chinese translations (rust-lang/rust-by-example#1943)
…-export