Skip to content

Commit 07dcd7f

Browse files
committed
Small fixes
This commit adds small fixes based on the received feedback.
1 parent 2f5a6b6 commit 07dcd7f

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

docs/tock_workshop/index.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,10 @@ The configuration for the various boards supported can be found in the `boards`
111111

112112
```shell
113113
cd boards/cy8cproto_62_4343_w
114-
cargo flash
114+
make flash
115115
```
116116

117-
Alternatively, you can use the `make flash` while inside the board's directory.
117+
Alternatively, you can use the `cargo flash` while inside the board's directory.
118118

119119
If you did everything correctly, you should be able to use the `tockloader listen` command to interact with the kernel. When prompted to select a serial port, pick the one that ends with `KitProg3 CMSIS-DAP`.
120120

@@ -185,9 +185,9 @@ use kernel::{
185185
ErrorCode,
186186
};
187187

188-
const DRIVER_NUM: usize = 0x9000A;
188+
pub const DRIVER_NUM: usize = 0x9000A;
189189

190-
struct MockCapsule;
190+
pub struct MockCapsule;
191191

192192
impl SyscallDriver for MockCapsule {
193193
fn command(
@@ -439,6 +439,10 @@ impl<A: 'static + Alarm<'static>> Component for MockCapsuleComponent<A> {
439439
}
440440
```
441441

442+
:::note Module definition
443+
Do not forget to add `pub mod mock;` in `boards/components/src/lib.rs`.
444+
:::
445+
442446
The allocation of the memory segments is usually done through a marco. It is out of this workshop's scope to dive into writing macros, but the macro bellow takes a `type` that must implement the `hil::time::Alarm` trait and returns a tuple of static mutable references to `MaybeUninit` wrappers of the `VirtualMuxAlarm` nad the `MockCapsule`.
443447

444448
```rust title="boards/components/src/mock.rs"
@@ -726,7 +730,7 @@ impl<'a, A: adc::AdcChannel<'a>> adc::Client for Cy8cprotoThermistor<'a, A> {
726730

727731
#### Defining the component
728732

729-
As before, we need to ensure the capsule can be easily configured by implementing a new `Component`. You can name the module `cyc8cproto_thermistor.rs`.
733+
As before, we need to ensure the capsule can be easily configured by implementing a new `Component`. You can name the module `cy8cproto_thermistor.rs`.
730734

731735
We should start from the bottom up, considering what should be needed to instantiate this capsule. These are the `AdcChannel`s and an `MuxAdc`, to be able to multiplex an ADC peripheral to sample multiple channels.
732736

@@ -758,7 +762,7 @@ impl<A: 'static + adc::Adc<'static>> Cy8cprotoThermistorComponent<A> {
758762

759763
The `finalize` implementation of the `Component` trait will need to create the two virtual `AdcDevices` that multiplex the peripheral, and therefore, the static memory needed must accommodate the two devices, and the thermistor capsule.
760764

761-
```rust title="boards/components/src/cyc8proto_thermistor.rs"
765+
```rust title="boards/components/src/cy8cproto_thermistor.rs"
762766
impl<A: 'static + adc::Adc<'static>> Component for Cy8cprotoThermistorComponent<A> {
763767
type StaticInput = (
764768
&'static mut MaybeUninit<AdcDevice<'static, A>>,
@@ -790,7 +794,7 @@ impl<A: 'static + adc::Adc<'static>> Component for Cy8cprotoThermistorComponent<
790794

791795
The macro should look like this:
792796

793-
```rust title="boards/components/src/cyc8proto_thermistor.rs"
797+
```rust title="boards/components/src/cy8cproto_thermistor.rs"
794798
#[macro_export]
795799
macro_rules! cy8cproto_thermistor_component_static {
796800
($A:ty $(,)?) => {{

0 commit comments

Comments
 (0)