Skip to content

Commit 46503ac

Browse files
Merge branch 'master' into aes_hil_update
2 parents 03177d2 + 33f9a70 commit 46503ac

118 files changed

Lines changed: 13659 additions & 651 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.vscode/launch.json

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,32 @@
2828
"configFiles": [
2929
"${workspaceRoot}/boards/msp_exp432p401r/openocd.cfg",
3030
]
31-
}
31+
},
32+
{
33+
// Add the following tools to path:
34+
// - arm-none-eabi-gdb
35+
// - openocd (from ModusToolboxProgtools)
36+
"name": "PSC3",
37+
// Install marus25.cortex-debug
38+
"type": "cortex-debug", // probe-rs also works but has significantly worse debugging experience (fewer breakpoints possible, fewer variables visible)
39+
"servertype": "openocd",
40+
"request": "launch",
41+
"executable": "${workspaceRoot}/target/thumbv8m.main-none-eabi/debug/psc3m5_evk-app.elf",
42+
"cwd": "${workspaceRoot}",
43+
// Add the OpenOCD binary from ModusToolboxProgtools to your PATH
44+
// "serverpath": "/opt/ModusToolboxProgtools-1.7/openocd/bin/openocd",
45+
"openOCDLaunchCommands": [
46+
"init; reset init;"
47+
],
48+
"overrideRestartCommands": [
49+
"starti"
50+
],
51+
"preLaunchTask": "build.psc3m5_evk",
52+
"svdFile": "../psc3.svd",
53+
"configFiles": [
54+
"${workspaceRoot}/boards/psc3m5_evk/openocd.tcl",
55+
],
56+
// "showDevDebugOutput": "raw"
57+
},
3258
]
3359
}

.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"files.insertFinalNewline": true,
3+
"debug.onTaskErrors": "abort", // when build tasks fails, debugging is stopped
34
"editor.defaultFormatter": "rust-lang.rust-analyzer",
45
"editor.formatOnSave": true,
56
"rust-analyzer.server.extraEnv": {

.vscode/tasks.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"label": "build.psc3m5_evk",
6+
// edit "tock.app" in ~/.config/Code/User/settings.json
7+
"command": "APP=${config:tock.app} DEBUG=1 make -C ${workspaceRoot}/boards/psc3m5_evk build-with-app",
8+
"type": "shell",
9+
"args": [],
10+
"presentation": {
11+
"reveal": "silent" // only show on errors
12+
},
13+
"group": "build"
14+
},
15+
]
16+
}

Cargo.lock

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1214,6 +1214,29 @@ dependencies = [
12141214
"unicode-ident",
12151215
]
12161216

1217+
[[package]]
1218+
name = "psc3"
1219+
version = "0.2.3-dev"
1220+
dependencies = [
1221+
"cortexm33",
1222+
"enum_primitive",
1223+
"kernel",
1224+
]
1225+
1226+
[[package]]
1227+
name = "psc3m5_evk"
1228+
version = "0.2.3-dev"
1229+
dependencies = [
1230+
"capsules-core",
1231+
"capsules-extra",
1232+
"capsules-system",
1233+
"components",
1234+
"cortexm33",
1235+
"kernel",
1236+
"psc3",
1237+
"tock_build_scripts",
1238+
]
1239+
12171240
[[package]]
12181241
name = "psoc62xa"
12191242
version = "0.2.3-dev"

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ members = [
4949
"boards/apollo3/redboard_artemis_atp",
5050
"boards/apollo3/redboard_artemis_nano",
5151
"boards/apollo3/lora_things_plus",
52+
"boards/psc3m5_evk",
5253
"boards/redboard_redv",
5354
"boards/stm32f3discovery",
5455
"boards/stm32f412gdiscovery",
@@ -100,6 +101,7 @@ members = [
100101
"chips/pci-x86",
101102
"chips/x86_q35",
102103
"chips/qemu_rv32_virt_chip",
104+
"chips/psc3",
103105
"chips/psoc62xa",
104106
"chips/rp2040",
105107
"chips/rp2350",
@@ -238,7 +240,6 @@ upper_case_acronyms = "allow"
238240
collapsible-match = "allow"
239241

240242
missing_safety_doc = "allow"
241-
doc_lazy_continuation = "allow"
242243

243244

244245
# PERF
@@ -276,7 +277,6 @@ option_if_let_else = "allow"
276277
cognitive_complexity = "allow"
277278

278279

279-
unused_peekable = "allow"
280280
branches_sharing_code = "allow"
281281

282282

arch/cortex-m/src/lib.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -195,11 +195,7 @@ pub unsafe extern "C" fn initialize_ram_jump_to_main() {
195195
}
196196

197197
pub unsafe fn print_cortexm_state(writer: &mut dyn Write) {
198-
let _ccr = syscall::SCB_REGISTERS[0];
199-
let cfsr = syscall::SCB_REGISTERS[1];
200-
let hfsr = syscall::SCB_REGISTERS[2];
201-
let mmfar = syscall::SCB_REGISTERS[3];
202-
let bfar = syscall::SCB_REGISTERS[4];
198+
let (_ccr, cfsr, hfsr, mmfar, bfar) = crate::syscall::get_global_scb_registers();
203199

204200
let iaccviol = (cfsr & 0x01) == 0x01;
205201
let daccviol = (cfsr & 0x02) == 0x02;

arch/cortex-m/src/nvic.rs

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -130,29 +130,29 @@ fn number_of_nvic_registers() -> usize {
130130
}
131131

132132
/// Clear all pending interrupts
133-
pub unsafe fn clear_all_pending() {
133+
pub fn clear_all_pending() {
134134
for icpr in NVIC.icpr.iter().take(number_of_nvic_registers()) {
135135
icpr.set(!0)
136136
}
137137
}
138138

139139
/// Enable all interrupts
140-
pub unsafe fn enable_all() {
140+
pub fn enable_all() {
141141
for icer in NVIC.iser.iter().take(number_of_nvic_registers()) {
142142
icer.set(!0)
143143
}
144144
}
145145

146146
/// Disable all interrupts
147-
pub unsafe fn disable_all() {
147+
pub fn disable_all() {
148148
for icer in NVIC.icer.iter().take(number_of_nvic_registers()) {
149149
icer.set(!0)
150150
}
151151
}
152152

153153
/// Get the index (0-240) the lowest number pending interrupt, or `None` if none
154154
/// are pending.
155-
pub unsafe fn next_pending() -> Option<u32> {
155+
pub fn next_pending() -> Option<u32> {
156156
for (block, ispr) in NVIC
157157
.ispr
158158
.iter()
@@ -178,7 +178,7 @@ pub unsafe fn next_pending() -> Option<u32> {
178178
/// Mask is defined as two `u128` fields,
179179
/// `mask.0` has the bits corresponding to interrupts from 128 to 240.
180180
/// `mask.1` has the bits corresponding to interrupts from 0 to 127.
181-
pub unsafe fn next_pending_with_mask(mask: (u128, u128)) -> Option<u32> {
181+
pub fn next_pending_with_mask(mask: (u128, u128)) -> Option<u32> {
182182
for (block, ispr) in NVIC
183183
.ispr
184184
.iter()
@@ -198,7 +198,7 @@ pub unsafe fn next_pending_with_mask(mask: (u128, u128)) -> Option<u32> {
198198
None
199199
}
200200

201-
pub unsafe fn has_pending() -> bool {
201+
pub fn has_pending() -> bool {
202202
NVIC.ispr
203203
.iter()
204204
.take(number_of_nvic_registers())
@@ -212,7 +212,7 @@ pub unsafe fn has_pending() -> bool {
212212
/// Mask is defined as two `u128` fields,
213213
/// `mask.0` has the bits corresponding to interrupts from 128 to 240.
214214
/// `mask.1` has the bits corresponding to interrupts from 0 to 127.
215-
pub unsafe fn has_pending_with_mask(mask: (u128, u128)) -> bool {
215+
pub fn has_pending_with_mask(mask: (u128, u128)) -> bool {
216216
NVIC.ispr
217217
.iter()
218218
.take(number_of_nvic_registers())
@@ -232,10 +232,7 @@ pub struct Nvic(u32);
232232

233233
impl Nvic {
234234
/// Creates a new `Nvic`.
235-
///
236-
/// Marked unsafe because only chip/platform configuration code should be
237-
/// able to create these.
238-
pub const unsafe fn new(idx: u32) -> Nvic {
235+
pub const fn new(idx: u32) -> Nvic {
239236
Nvic(idx)
240237
}
241238

0 commit comments

Comments
 (0)