|
1 | 1 | # Target Architecture
|
2 | 2 |
|
| 3 | +## Cortex-M Devices |
| 4 | + |
3 | 5 | While RTIC can currently target all Cortex-m devices there are some key architecture differences that
|
4 | 6 | users should be aware of. Namely, the absence of Base Priority Mask Register (`BASEPRI`) which lends
|
5 | 7 | itself exceptionally well to the hardware priority ceiling support used in RTIC, in the ARMv6-M and
|
@@ -27,11 +29,11 @@ Table 1 below shows a list of Cortex-m processors and which type of critical sec
|
27 | 29 | | Cortex-M23 | ARMv8-M-base | | ✓ |
|
28 | 30 | | Cortex-M33 | ARMv8-M-main | ✓ | |
|
29 | 31 |
|
30 |
| -## Priority Ceiling |
| 32 | +### Priority Ceiling |
31 | 33 |
|
32 | 34 | This is covered by the [Resources](../by-example/resources.html) page of this book.
|
33 | 35 |
|
34 |
| -## Source Masking |
| 36 | +### Source Masking |
35 | 37 |
|
36 | 38 | Without a `BASEPRI` register which allows for directly setting a priority ceiling in the Nested
|
37 | 39 | Vectored Interrupt Controller (NVIC), RTIC must instead rely on disabling (masking) interrupts.
|
@@ -66,3 +68,45 @@ risk of data race conditions. At time *t4*, task A completes and returns the exe
|
66 | 68 |
|
67 | 69 | Since source masking relies on use of the NVIC, core exception sources such as HardFault, SVCall,
|
68 | 70 | PendSV, and SysTick cannot share data with other tasks.
|
| 71 | + |
| 72 | +## RISC-V Devices |
| 73 | + |
| 74 | +All the current RISC-V backends work in a similar way as Cortex-M devices with priority ceiling. |
| 75 | +Therefore, the [Resources](../by-example/resources.html) page of this book is a good reference. |
| 76 | +However, some of these backends are not full hardware implementations, but use software to emulate |
| 77 | +a physical interrupt controller. Therefore, these backends do not implement hardware tasks, and |
| 78 | +only software tasks are needed. Furthermore, the number of software tasks for these targets is |
| 79 | +not bounded by the number of available physical interrupt sources. |
| 80 | + |
| 81 | +Table 2 below compares the available RISC-V backends. |
| 82 | + |
| 83 | +#### *Table 2: Critical Section Implementation by Processor Architecture* |
| 84 | + |
| 85 | +| Backend | Compatible targets | Backend-specific configuration | Hardware Tasks | Software Tasks | Number of tasks bounded by HW | |
| 86 | +| :---------------------: | :---------------------------: | :----------------------------: | :------------: | :------------: | :---------------------------: | |
| 87 | +| `riscv-esp32c3-backend` | ESP32-C3 only | | ✓ | ✓ | ✓ | |
| 88 | +| `riscv-mecall-backend` | Any RISC-V device | | | ✓ | | |
| 89 | +| `riscv-clint-backend` | Devices with CLINT peripheral | ✓ | | ✓ | | |
| 90 | + |
| 91 | + |
| 92 | +### `riscv-mecall-backend` |
| 93 | + |
| 94 | +It is not necessary to provide a list of dispatchers in the `#[app]` attribute, as RTIC will generate them at compile time. |
| 95 | +Priority levels can go from 0 (for the `idle` task) to 255. |
| 96 | + |
| 97 | +### `riscv-clint-backend` |
| 98 | + |
| 99 | +It is not necessary to provide a list of `dispatchers` in the `#[app]` attribute, as RTIC will generate them at compile time. |
| 100 | +Priority levels can go from 0 (for the `idle` task) to 255. |
| 101 | + |
| 102 | +You **must** include a `backend`-specific configuration in the `#[app]` attribute so RTIC knows the ID number used to identify the HART running your application. |
| 103 | +For example, for `e310x` chips, you would configure a minimal application as follows: |
| 104 | + |
| 105 | +```rust |
| 106 | +#[rtic::app(device = e310x, backend = H0)] |
| 107 | +mod app { |
| 108 | + // your application here |
| 109 | +} |
| 110 | +``` |
| 111 | + |
| 112 | +In this way, RTIC will always refer to HART `H0`. |
0 commit comments