Skip to content

Commit d00b7f4

Browse files
committed
tests: Organize and label MPU unit tests
1 parent 39f83a8 commit d00b7f4

File tree

19 files changed

+71
-19
lines changed

19 files changed

+71
-19
lines changed

examples/tests/mpu/README.md

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,56 @@
11
MPU Tests
22
=========
33

4-
Test that the MPU restricts process accesses correctly.
4+
Tests that the MPU restricts process accesses correctly.
5+
6+
MPU test applications are necessarily somewhat fine-grained, as each MPU
7+
violation results in termination of the test process.
8+
9+
As it can be annoying to flash myriad apps during development, the tests in the
10+
top-level directory attempt to exercise all of the reads and writes of regions
11+
that _should_ work during normal operation (and allow use of a button to inject
12+
faults for interactive testing). The `unit/` folder holds all of the smaller
13+
tests which attempt to violate access rules at each of the boundaries.
14+
15+
```text
16+
Perms? Application Memory Layout Relevant Memop(s) Test
17+
18+
╔═ ╒RWX════════ ← mem_start + mem_len.....{3-mem_end} get unit/mpu_ram_end
19+
║ │...┆Grant Pointers
20+
║ │...┆──────
21+
║ │...┆Process Control Block
22+
║ ╔═ │...┆──────
23+
║ │...┆Grant Regions
24+
║ D │...┆
25+
║ Y │...┆ ↓
26+
║ N │...┆────── ← kernel_memory_break.....{6-grant start} get unit/mpu_grant_start
27+
║ A │...┆
28+
║ M │rw.┆────── ← app_break...............{0-brk, 1-sbrk} unit/mpu_heap_end
29+
║ I │rw.┆ get or move
30+
║ C │rw.┆ ↑
31+
║ │rw.┆ Heap
32+
║ ╚═ │rw.┆────── ← app_heap_start..........{11-heap bot} set (debug facilty; untested)
33+
│rw.┆ Data
34+
F │rw.┆────── ← data_start_pointer......{10-stack top} set (debug facilty; untested)
35+
I │rw.┆Stack
36+
X │rw.┆ ↓
37+
E │rw.┆
38+
D │rw.┆────── ← current_stack_pointer
39+
│rw.┆
40+
╚═══ ╘═══════════ ← memory_start............{2-mem_start} get unit/mpu_stack_growth (needs refinement)
41+
42+
╔═ ╒RWX ═══════ ← app end.................{5-flash end} get unit/mpu_flash_end
43+
║ │r.x┆
44+
│r.x┆ app
45+
F │r.x┆
46+
I ╔ │r.x┆──────
47+
X T │r..┆
48+
E B │rw.┆ ┍──
49+
D F rw.┆ ┋ Writeable flash
50+
│rw.┆ ┍── regions in the {9-region[N] end} get (todo)
51+
║ H │rw.┆ ┝── TBF header {8-region[N] start} get (todo)
52+
║ D │rw.┆ ┕──
53+
║ R │r..┆ {7-#flash regions} get (todo)
54+
║ │r..┆
55+
╚═ ╚ ╘═══════════ ← app start...............{4-flash start} get unit/mpu_flash_start
56+
```

examples/tests/mpu/mpu_ram_end/Makefile

Lines changed: 0 additions & 13 deletions
This file was deleted.

examples/tests/mpu/mpu_flash_end/Makefile renamed to examples/tests/mpu/unit/mpu_flash_end/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Makefile for user application
22

33
# Specify this directory relative to the current application.
4-
TOCK_USERLAND_BASE_DIR = ../../../..
4+
TOCK_USERLAND_BASE_DIR = ../../../../..
55

66
# Which files to compile.
77
C_SRCS := $(wildcard *.c)
File renamed without changes.
File renamed without changes.

examples/tests/mpu/mpu_flash_start/Makefile renamed to examples/tests/mpu/unit/mpu_flash_start/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Makefile for user application
22

33
# Specify this directory relative to the current application.
4-
TOCK_USERLAND_BASE_DIR = ../../../..
4+
TOCK_USERLAND_BASE_DIR = ../../../../..
55

66
# Which files to compile.
77
C_SRCS := $(wildcard *.c)
File renamed without changes.
File renamed without changes.

examples/tests/mpu/mpu_grant_start/Makefile renamed to examples/tests/mpu/unit/mpu_grant_start/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Makefile for user application
22

33
# Specify this directory relative to the current application.
4-
TOCK_USERLAND_BASE_DIR = ../../../..
4+
TOCK_USERLAND_BASE_DIR = ../../../../..
55

66
# Which files to compile.
77
C_SRCS := $(wildcard *.c)
File renamed without changes.

0 commit comments

Comments
 (0)