├── Exception_model
├── .gitignore
├── context-switch-fp
│ ├── .cproject
│ ├── .gitignore
│ ├── .project
│ ├── PendSV_Handler.png
│ ├── RTE
│ │ ├── Device
│ │ │ └── ARMv8MML_DP
│ │ │ │ ├── ARMv8MML_ac6.sct
│ │ │ │ ├── startup_ARMv8MML.c
│ │ │ │ └── system_ARMv8MML.c
│ │ └── RTE_Components.h
│ ├── Readme.md
│ ├── context-switch-fp.launch
│ ├── context-switch-fp.rteconfig
│ ├── context_switch_fp_process.png
│ ├── main.c
│ ├── scheduler.c
│ ├── scheduler.h
│ ├── scripts
│ │ ├── gcc_arm.ld
│ │ ├── paddron.ds
│ │ └── success.txt
│ ├── task1.c
│ └── task2.c
├── interrupt-deprivileging
│ ├── .cproject
│ ├── .gitignore
│ ├── .project
│ ├── At_service_ini_depriv.png
│ ├── Before_IRQ_state_ini_depriv.png
│ ├── PrivilegedFuncs.c
│ ├── RTE
│ │ ├── Device
│ │ │ └── ARMv81MML_DSP_DP_MVE_FP
│ │ │ │ ├── ARMv81MML_ac6.sct
│ │ │ │ ├── startup_ARMv81MML.c
│ │ │ │ └── system_ARMv81MML.c
│ │ └── RTE_Components.h
│ ├── Readme.md
│ ├── UnprivilegedFuncs.c
│ ├── excep_prog.h
│ ├── interrupt-deprivileging.launch
│ ├── interrupt-deprivileging.rteconfig
│ ├── main.c
│ ├── mpu_prog.c
│ ├── mpu_prog.h
│ ├── priority_setting.png
│ └── scripts
│ │ ├── gcc_arm.ld
│ │ ├── paddron.ds
│ │ └── success.txt
├── irq-priority-basic
│ ├── .cproject
│ ├── .gitignore
│ ├── .project
│ ├── IRQConfig.c
│ ├── IRQConfig.h
│ ├── RTE
│ │ ├── Device
│ │ │ └── ARMv8MML
│ │ │ │ ├── ARMv8MML_ac6.sct
│ │ │ │ ├── startup_ARMv8MML.c
│ │ │ │ └── system_ARMv8MML.c
│ │ └── RTE_Components.h
│ ├── Readme.md
│ ├── group_prio_setting.png
│ ├── irq-priority-basic.launch
│ ├── irq-priority-basic.rteconfig
│ ├── main.c
│ └── scripts
│ │ ├── gcc_arm.ld
│ │ ├── paddron.ds
│ │ └── success.txt
├── priority-boost-types
│ ├── .cproject
│ ├── .gitignore
│ ├── .project
│ ├── IRQSet.c
│ ├── IRQSet.h
│ ├── RTE
│ │ ├── Device
│ │ │ └── ARMv8MML
│ │ │ │ ├── ARMv8MML_ac6.sct
│ │ │ │ ├── startup_ARMv8MML.c
│ │ │ │ └── system_ARMv8MML.c
│ │ └── RTE_Components.h
│ ├── Readme.md
│ ├── main.c
│ ├── priority-boost-types.launch
│ ├── priority-boost-types.rteconfig
│ └── scripts
│ │ ├── gcc_arm.ld
│ │ ├── paddron.ds
│ │ └── success.txt
├── svc-number-as-parameter
│ ├── .cproject
│ ├── .gitignore
│ ├── .project
│ ├── RTE
│ │ ├── Device
│ │ │ └── ARMv8MML
│ │ │ │ ├── ARMv8MML_ac6.sct
│ │ │ │ ├── startup_ARMv8MML.c
│ │ │ │ └── system_ARMv8MML.c
│ │ └── RTE_Components.h
│ ├── Readme.md
│ ├── SelectSVCNumber.c
│ ├── SelectSVCNumber.h
│ ├── main.c
│ ├── scripts
│ │ ├── gcc_arm.ld
│ │ ├── paddron.ds
│ │ └── success.txt
│ ├── svc-number-as-parameter.launch
│ └── svc-number-as-parameter.rteconfig
├── synchronous-fault
│ ├── .cproject
│ ├── .gitignore
│ ├── .project
│ ├── RTE
│ │ ├── Device
│ │ │ └── ARMv8MML_DP
│ │ │ │ ├── ARMv8MML_ac6.sct
│ │ │ │ ├── startup_ARMv8MML.c
│ │ │ │ └── system_ARMv8MML.c
│ │ └── RTE_Components.h
│ ├── Readme.md
│ ├── funcs.h
│ ├── funcs.s
│ ├── main.c
│ ├── scripts
│ │ ├── gcc_arm.ld
│ │ ├── paddron.ds
│ │ └── success.txt
│ ├── synchronous-fault.launch
│ └── synchronous-fault.rteconfig
└── system-exceptions
│ ├── .cproject
│ ├── .gitignore
│ ├── .project
│ ├── RTE
│ ├── Device
│ │ └── ARMv8MML
│ │ │ ├── ARMv8MML_ac6.sct
│ │ │ ├── startup_ARMv8MML.c
│ │ │ └── system_ARMv8MML.c
│ └── RTE_Components.h
│ ├── Readme.md
│ ├── main.c
│ ├── scripts
│ ├── gcc_arm.ld
│ ├── paddron.ds
│ └── success.txt
│ ├── system-exceptions.launch
│ └── system-exceptions.rteconfig
├── LICENSE
├── Memory_model
├── TCM_implement
│ ├── .cproject
│ ├── .gitignore
│ ├── .project
│ ├── Excep_prog.c
│ ├── Excep_prog.h
│ ├── RTE
│ │ ├── Device
│ │ │ └── ARMCM55
│ │ │ │ ├── ARMCM55_ac6.sct
│ │ │ │ ├── startup_ARMCM55.c
│ │ │ │ └── system_ARMCM55.c
│ │ └── RTE_Components.h
│ ├── Readme.md
│ ├── TCM_implement.launch
│ ├── TCM_implement.rteconfig
│ ├── check_is_full.c
│ ├── flowchart.png
│ ├── main.c
│ ├── mpu_defs.h
│ ├── mpu_prog.c
│ ├── mpu_prog.h
│ └── scripts
│ │ ├── gcc_arm.ld
│ │ ├── paddron.ds
│ │ └── success.txt
├── rtos_context_switch
│ ├── .cproject
│ ├── .gitignore
│ ├── .project
│ ├── RTE
│ │ ├── Device
│ │ │ └── ARMv8MML
│ │ │ │ ├── ARMv8MML_ac6.sct
│ │ │ │ ├── startup_ARMv8MML.c
│ │ │ │ └── system_ARMv8MML.c
│ │ └── RTE_Components.h
│ ├── Readme.md
│ ├── main.c
│ ├── mpu_configs.c
│ ├── mpu_configs.h
│ ├── mpu_defs.h
│ ├── mpu_prog.c
│ ├── mpu_prog.h
│ ├── mpu_reprog.c
│ ├── mpu_reprog.h
│ ├── myRTOS.c
│ ├── myRTOS.h
│ ├── rtos_context_switch.launch
│ ├── rtos_context_switch.rteconfig
│ ├── scripts
│ │ ├── gcc_arm.ld
│ │ ├── paddron.ds
│ │ └── success.txt
│ ├── threadA.c
│ ├── threadB.c
│ └── threadDefs.h
└── trap_access
│ ├── .cproject
│ ├── .gitignore
│ ├── .project
│ ├── RTE
│ ├── Device
│ │ └── ARMv8MML
│ │ │ ├── ARMv8MML_ac6.sct
│ │ │ ├── startup_ARMv8MML.c
│ │ │ └── system_ARMv8MML.c
│ └── RTE_Components.h
│ ├── Readme.md
│ ├── main.c
│ ├── mpu_defs.h
│ ├── mpu_prog.c
│ ├── mpu_prog.h
│ ├── scripts
│ ├── gcc_arm.ld
│ ├── paddron.ds
│ └── success.txt
│ ├── trap_access.launch
│ └── trap_access.rteconfig
├── README.md
└── security
├── basic-Non-secure-only-program
├── Readme.md
├── basic-Non-secure-only-program_ns
│ ├── .cproject
│ ├── .gitignore
│ ├── .project
│ ├── .settings
│ │ └── language.settings.xml
│ ├── RTE
│ │ ├── Device
│ │ │ └── ARMv81MML_DSP_DP_MVE_FP
│ │ │ │ ├── ARMv81MML_ac6.sct
│ │ │ │ ├── startup_ARMv81MML.c
│ │ │ │ └── system_ARMv81MML.c
│ │ └── RTE_Components.h
│ ├── basic-Non-secure-only-program_ns.rteconfig
│ └── main_ns.c
├── basic-Non-secure-only-program_s
│ ├── .cproject
│ ├── .gitignore
│ ├── .project
│ ├── .settings
│ │ └── language.settings.xml
│ ├── RTE
│ │ ├── Device
│ │ │ └── ARMv81MML_DSP_DP_MVE_FP
│ │ │ │ ├── ARMv81MML_ac6_s.sct
│ │ │ │ ├── partition_ARMv81MML.h
│ │ │ │ ├── startup_ARMv81MML.c
│ │ │ │ └── system_ARMv81MML.c
│ │ └── RTE_Components.h
│ ├── basic-Non-secure-only-program_m55_FVP.launch
│ ├── basic-Non-secure-only-program_s.rteconfig
│ ├── main_s.c
│ └── region_defs.h
└── scripts
│ ├── build.sh
│ ├── build_gcc.sh
│ ├── gcc_arm_ns.ld
│ ├── gcc_arm_s.ld
│ ├── run.sh
│ ├── run_tarmac.sh
│ └── success.txt
├── exception-across-security-state
├── Readme.md
├── exception-across-security-state_ns
│ ├── .cproject
│ ├── .gitignore
│ ├── .project
│ ├── .settings
│ │ └── language.settings.xml
│ ├── IRQconfig_ns.c
│ ├── IRQconfig_ns.h
│ ├── RTE
│ │ ├── Device
│ │ │ └── ARMv81MML_DSP_DP_MVE_FP
│ │ │ │ ├── ARMv81MML_ac6.sct
│ │ │ │ ├── startup_ARMv81MML.c
│ │ │ │ └── system_ARMv81MML.c
│ │ └── RTE_Components.h
│ ├── exceptions-across-security-states_ns.rteconfig
│ ├── interface.h
│ └── main_ns.c
├── exception-across-security-state_s
│ ├── .cproject
│ ├── .gitignore
│ ├── .project
│ ├── .settings
│ │ └── language.settings.xml
│ ├── RTE
│ │ ├── Device
│ │ │ └── ARMv81MML_DSP_DP_MVE_FP
│ │ │ │ ├── ARMv81MML_ac6_s.sct
│ │ │ │ ├── partition_ARMv81MML.h
│ │ │ │ ├── startup_ARMv81MML.c
│ │ │ │ └── system_ARMv81MML.c
│ │ └── RTE_Components.h
│ ├── exception-across-security-state.launch
│ ├── exceptions-across-security-states_s.rteconfig
│ ├── init.c
│ ├── init.h
│ ├── interface.c
│ ├── interface.h
│ ├── main_s.c
│ └── region_defs.h
└── scripts
│ ├── build.sh
│ ├── build_gcc.sh
│ ├── gcc_arm_ns.ld
│ ├── gcc_arm_s.ld
│ ├── run.sh
│ ├── run_tarmac.sh
│ └── success.txt
├── hello-world-in-security-states
├── Readme.md
├── hello-world-in-security-states_ns
│ ├── .cproject
│ ├── .gitignore
│ ├── .project
│ ├── .settings
│ │ └── language.settings.xml
│ ├── RTE
│ │ ├── Device
│ │ │ └── ARMv81MML_DSP_DP_MVE_FP
│ │ │ │ ├── ARMv81MML_ac6.sct
│ │ │ │ ├── startup_ARMv81MML.c
│ │ │ │ └── system_ARMv81MML.c
│ │ └── RTE_Components.h
│ ├── hello-world-in-security-states-CMSE-Lib.o
│ ├── hello-world-in-security-states_ns.rteconfig
│ ├── interface.h
│ └── main_ns.c
├── hello-world-in-security-states_s
│ ├── .cproject
│ ├── .gitignore
│ ├── .project
│ ├── .settings
│ │ └── language.settings.xml
│ ├── RTE
│ │ ├── Device
│ │ │ └── ARMv81MML_DSP_DP_MVE_FP
│ │ │ │ ├── ARMv81MML_ac6_s.sct
│ │ │ │ ├── partition_ARMv81MML.h
│ │ │ │ ├── startup_ARMv81MML.c
│ │ │ │ └── system_ARMv81MML.c
│ │ └── RTE_Components.h
│ ├── hello-world-in-security-states.launch
│ ├── hello-world-in-security-states_s.rteconfig
│ ├── init.c
│ ├── init.h
│ ├── interface.h
│ ├── main_s.c
│ └── region_defs.h
└── scripts
│ ├── build
│ ├── build.sh
│ ├── build_gcc.sh
│ ├── gcc_arm_ns.ld
│ ├── gcc_arm_s.ld
│ ├── run.sh
│ ├── run_tarmac.sh
│ └── success.txt
└── security-func-call-params-passing
├── Readme.md
├── scripts
├── build.sh
├── build_gcc.sh
├── gcc_arm_ns.ld
├── gcc_arm_s.ld
├── run.sh
├── run_tarmac.sh
└── success.txt
├── security-func-call-params-passing_ns
├── .cproject
├── .gitignore
├── .project
├── .settings
│ └── language.settings.xml
├── RTE
│ ├── Device
│ │ └── ARMv81MML_DSP_DP_MVE_FP
│ │ │ ├── ARMv81MML_ac6.sct
│ │ │ ├── startup_ARMv81MML.c
│ │ │ └── system_ARMv81MML.c
│ └── RTE_Components.h
├── callback_ns.c
├── callback_ns.h
├── interface.h
├── main_ns.c
└── security-func-call-params-passing_ns.rteconfig
└── security-func-call-params-passing_s
├── .cproject
├── .gitignore
├── .project
├── .settings
└── language.settings.xml
├── RTE
├── Device
│ └── ARMv81MML_DSP_DP_MVE_FP
│ │ ├── ARMv81MML_ac6_s.sct
│ │ ├── partition_ARMv81MML.h
│ │ ├── startup_ARMv81MML.c
│ │ └── system_ARMv81MML.c
└── RTE_Components.h
├── init.c
├── init.h
├── interface.c
├── interface.h
├── main_s.c
├── region_defs.h
├── security-func-call-params-passing.launch
└── security-func-call-params-passing_s.rteconfig
/Exception_model/.gitignore:
--------------------------------------------------------------------------------
1 | /.metadata/
2 |
--------------------------------------------------------------------------------
/Exception_model/context-switch-fp/.gitignore:
--------------------------------------------------------------------------------
1 | /Debug/
2 |
--------------------------------------------------------------------------------
/Exception_model/context-switch-fp/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | context-switch-fp
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder
10 | clean,full,incremental,
11 |
12 |
13 |
14 |
15 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
16 | full,incremental,
17 |
18 |
19 |
20 |
21 |
22 | org.eclipse.cdt.core.cnature
23 | org.eclipse.cdt.managedbuilder.core.managedBuildNature
24 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
25 | com.arm.cmsis.pack.project.RteNature
26 |
27 |
28 |
--------------------------------------------------------------------------------
/Exception_model/context-switch-fp/PendSV_Handler.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ARM-software/m-profile-user-guide-examples/1c961a98d1f5e8e92b7142403a2722d2e52be624/Exception_model/context-switch-fp/PendSV_Handler.png
--------------------------------------------------------------------------------
/Exception_model/context-switch-fp/RTE/RTE_Components.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Auto generated Run-Time-Environment Component Configuration File
3 | * *** Do not modify ! ***
4 | *
5 | * Project: context-switch-fp
6 | * RTE configuration: context-switch-fp.rteconfig
7 | */
8 | #ifndef RTE_COMPONENTS_H
9 | #define RTE_COMPONENTS_H
10 |
11 | /*
12 | * Define the Device Header File:
13 | */
14 | #define CMSIS_device_header "ARMv8MML_DP.h"
15 |
16 |
17 | #endif /* RTE_COMPONENTS_H */
18 |
--------------------------------------------------------------------------------
/Exception_model/context-switch-fp/context-switch-fp.rteconfig:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/Exception_model/context-switch-fp/context_switch_fp_process.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ARM-software/m-profile-user-guide-examples/1c961a98d1f5e8e92b7142403a2722d2e52be624/Exception_model/context-switch-fp/context_switch_fp_process.png
--------------------------------------------------------------------------------
/Exception_model/context-switch-fp/scheduler.h:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * MIT License
4 | * Copyright (c) 2023 ARM Limited.
5 | *
6 | * SPDX-License-Identifier: MIT
7 | *
8 | * Permission is hereby granted, free of charge, to any person obtaining a copy
9 | * of this software and associated documentation files (the "Software"), to deal
10 | * in the Software without restriction, including without limitation the rights
11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | * copies of the Software, and to permit persons to whom the Software is
13 | * furnished to do so, subject to the following conditions:
14 | *
15 | * The above copyright notice and this permission notice shall be included in all
16 | * copies or substantial portions of the Software.
17 | *
18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 | * SOFTWARE.
25 | *
26 | */
27 | #ifndef SCHEDULER_H_
28 | #define SCHEDULER_H_
29 |
30 | /* Parameters for Task Context definition */
31 | /* Two task threads and one idle thread */
32 | #define TASK_NUM_MAX 3
33 | #define TASK_STACK_SIZE 2048u
34 | /* Index 0 for task array presents idle thread */
35 | #define ID_TASK1 1
36 | #define ID_TASK2 2
37 |
38 | struct TaskContext{
39 | uint32_t *sp;
40 | uint32_t *spLimit;
41 | uint32_t excReturn;
42 | };
43 |
44 | void task1(void);
45 | void task2(void);
46 |
47 | /* Context stack for tasks */
48 | #define NUM_CALLEE_REGS 24
49 | #define NORM_STACK_FRAME_SIZE 50
50 |
51 | /* Refresh value for exception return */
52 | #define XPSR_THREAD 0x01000000
53 | #define EXC_RETURN_THREAD_S_PSP 0xFFFFFFED
54 |
55 | /* Index for caller register of SVC stack with offset-the number of callee registers */
56 | #define STK_FRAME_R0 (0+NUM_CALLEE_REGS)
57 | #define STK_FRAME_R1 (1+NUM_CALLEE_REGS)
58 | #define STK_FRAME_R2 (2+NUM_CALLEE_REGS)
59 | #define STK_FRAME_R3 (3+NUM_CALLEE_REGS)
60 | #define STK_FRAME_R12 (4+NUM_CALLEE_REGS)
61 | #define STK_FRAME_LR (5+NUM_CALLEE_REGS)
62 | #define STK_FRAME_RET_ADDR (6+NUM_CALLEE_REGS)
63 | #define STK_FRAME_XPSR (7+NUM_CALLEE_REGS)
64 |
65 | /* Declaration for PSP stack */
66 | extern uint32_t Image$$PSP_STACK$$ZI$$Base;
67 |
68 | void TerminateTask(void);
69 | void InitTask(void* task, uint32_t TaskID);
70 | uint32_t PendSV_Handler_Main(uint32_t* sp, uint32_t* sp_lim, uint32_t exc_Return);
71 | void StartScheduler();
72 |
73 | #endif /* SCHEDULER_H_ */
74 |
--------------------------------------------------------------------------------
/Exception_model/context-switch-fp/scripts/paddron.ds:
--------------------------------------------------------------------------------
1 | set elf load-segments-at-p_paddr on
--------------------------------------------------------------------------------
/Exception_model/context-switch-fp/scripts/success.txt:
--------------------------------------------------------------------------------
1 | Example Project: context-switch-fp Start
2 | Start Scheduler
3 | we are in SysTick handler !
4 | The diagonal of a square with side=
5 | The area of a circle with r=
--------------------------------------------------------------------------------
/Exception_model/context-switch-fp/task1.c:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * MIT License
4 | * Copyright (c) 2023 ARM Limited.
5 | *
6 | * SPDX-License-Identifier: MIT
7 | *
8 | * Permission is hereby granted, free of charge, to any person obtaining a copy
9 | * of this software and associated documentation files (the "Software"), to deal
10 | * in the Software without restriction, including without limitation the rights
11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | * copies of the Software, and to permit persons to whom the Software is
13 | * furnished to do so, subject to the following conditions:
14 | *
15 | * The above copyright notice and this permission notice shall be included in all
16 | * copies or substantial portions of the Software.
17 | *
18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 | * SOFTWARE.
25 | *
26 | */
27 |
28 | #if defined (ARMv8MML)
29 | #include "ARMv8MML.h"
30 | #elif defined (ARMv8MML_DSP)
31 | #include "ARMv8MML_DSP.h"
32 | #elif defined (ARMv8MML_SP)
33 | #include "ARMv8MML_SP.h"
34 | #elif defined (ARMv8MML_DSP_SP)
35 | #include "ARMv8MML_DSP_SP.h"
36 | #elif defined (ARMv8MML_DP)
37 | #include "ARMv8MML_DP.h"
38 | #elif defined (ARMv8MML_DSP_DP)
39 | #include "ARMv8MML_DSP_DP.h"
40 | #else
41 | #error device not specified!
42 | #endif
43 |
44 |
45 | #include
46 | #include
47 | #include "scheduler.h"
48 |
49 |
50 | /**
51 | \brief Task 1 function
52 | \details Task1 will calculate the diagonal of a square.
53 | */
54 | void task1 (void) {
55 | uint32_t x = 0, y = 0;
56 | double distance;
57 |
58 | while(1){
59 | distance = sqrt(x * x + y * y);
60 | x++;
61 | y++;
62 | printf("\n The diagonal of a square with side=%d: %f \n", x, distance);
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/Exception_model/context-switch-fp/task2.c:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * MIT License
4 | * Copyright (c) 2023 ARM Limited.
5 | *
6 | * SPDX-License-Identifier: MIT
7 | *
8 | * Permission is hereby granted, free of charge, to any person obtaining a copy
9 | * of this software and associated documentation files (the "Software"), to deal
10 | * in the Software without restriction, including without limitation the rights
11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | * copies of the Software, and to permit persons to whom the Software is
13 | * furnished to do so, subject to the following conditions:
14 | *
15 | * The above copyright notice and this permission notice shall be included in all
16 | * copies or substantial portions of the Software.
17 | *
18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 | * SOFTWARE.
25 | *
26 | */
27 |
28 | #if defined (ARMv8MML)
29 | #include "ARMv8MML.h"
30 | #elif defined (ARMv8MML_DSP)
31 | #include "ARMv8MML_DSP.h"
32 | #elif defined (ARMv8MML_SP)
33 | #include "ARMv8MML_SP.h"
34 | #elif defined (ARMv8MML_DSP_SP)
35 | #include "ARMv8MML_DSP_SP.h"
36 | #elif defined (ARMv8MML_DP)
37 | #include "ARMv8MML_DP.h"
38 | #elif defined (ARMv8MML_DSP_DP)
39 | #include "ARMv8MML_DSP_DP.h"
40 | #else
41 | #error device not specified!
42 | #endif
43 |
44 |
45 | #include
46 | #include
47 | #include "scheduler.h"
48 |
49 |
50 | /**
51 | \brief Task 2 function
52 | \details Task2 will calculate the area of a circle.
53 | */
54 | void task2 (void) {
55 | float circle;
56 | uint32_t r = 1;
57 |
58 | while(1){
59 | circle = r * r * acos(-1.0);
60 | r++;
61 | printf("\n The area of a circle with r=%d: %f \n", r, circle);
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/Exception_model/interrupt-deprivileging/.gitignore:
--------------------------------------------------------------------------------
1 | /Debug/
2 |
--------------------------------------------------------------------------------
/Exception_model/interrupt-deprivileging/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | interrupt-deprivileging
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder
10 | clean,full,incremental,
11 |
12 |
13 |
14 |
15 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
16 | full,incremental,
17 |
18 |
19 |
20 |
21 |
22 | org.eclipse.cdt.core.cnature
23 | org.eclipse.cdt.managedbuilder.core.managedBuildNature
24 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
25 | com.arm.cmsis.pack.project.RteNature
26 |
27 |
28 |
--------------------------------------------------------------------------------
/Exception_model/interrupt-deprivileging/At_service_ini_depriv.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ARM-software/m-profile-user-guide-examples/1c961a98d1f5e8e92b7142403a2722d2e52be624/Exception_model/interrupt-deprivileging/At_service_ini_depriv.png
--------------------------------------------------------------------------------
/Exception_model/interrupt-deprivileging/Before_IRQ_state_ini_depriv.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ARM-software/m-profile-user-guide-examples/1c961a98d1f5e8e92b7142403a2722d2e52be624/Exception_model/interrupt-deprivileging/Before_IRQ_state_ini_depriv.png
--------------------------------------------------------------------------------
/Exception_model/interrupt-deprivileging/RTE/RTE_Components.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Auto generated Run-Time-Environment Component Configuration File
3 | * *** Do not modify ! ***
4 | *
5 | * Project: interrupt-deprivileging
6 | * RTE configuration: interrupt-deprivileging.rteconfig
7 | */
8 | #ifndef RTE_COMPONENTS_H
9 | #define RTE_COMPONENTS_H
10 |
11 | /*
12 | * Define the Device Header File:
13 | */
14 | #define CMSIS_device_header "ARMv81MML_DSP_DP_MVE_FP.h"
15 |
16 |
17 | #endif /* RTE_COMPONENTS_H */
18 |
--------------------------------------------------------------------------------
/Exception_model/interrupt-deprivileging/UnprivilegedFuncs.c:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * MIT License
4 | * Copyright (c) 2023 ARM Limited.
5 | *
6 | * SPDX-License-Identifier: MIT
7 | *
8 | * Permission is hereby granted, free of charge, to any person obtaining a copy
9 | * of this software and associated documentation files (the "Software"), to deal
10 | * in the Software without restriction, including without limitation the rights
11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | * copies of the Software, and to permit persons to whom the Software is
13 | * furnished to do so, subject to the following conditions:
14 | *
15 | * The above copyright notice and this permission notice shall be included in all
16 | * copies or substantial portions of the Software.
17 | *
18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 | * SOFTWARE.
25 | *
26 | */
27 |
28 | #if defined (ARMv81MML_DSP_DP_MVE_FP)
29 | #include "ARMv81MML_DSP_DP_MVE_FP.h"
30 | #else
31 | #error device not specified!
32 | #endif
33 |
34 | #include
35 | #include "excep_prog.h"
36 |
37 | /* Definition of variables used in deprivileged mode */
38 | uint32_t deprivThreadStack[PS_STACK_SIZE] __attribute__((aligned (8)));
39 | uint32_t *deprivThreadStackPtr = &deprivThreadStack[PS_STACK_SIZE];
40 |
41 |
42 | /**
43 | \brief Function to trigger deprivileging request
44 | \details Execute SVC #1 to trigger deprivileging request
45 | \Note depriv_return function will be executed in deprivileged mode
46 | */
47 | __attribute__((naked)) void depriv_return(){
48 | __asm volatile(
49 | "SVC #1 \n"
50 | );
51 | }
52 |
53 |
54 | /**
55 | \brief Deprivileged service
56 | \details Call depriv_return function in deprivileged thread mode.
57 | */
58 | void depriv_service(void){
59 | printf("we are in deprivileging thread mode !\n");
60 |
61 | depriv_return();
62 | }
63 |
64 |
--------------------------------------------------------------------------------
/Exception_model/interrupt-deprivileging/excep_prog.h:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * MIT License
4 | * Copyright (c) 2023 ARM Limited.
5 | *
6 | * SPDX-License-Identifier: MIT
7 | *
8 | * Permission is hereby granted, free of charge, to any person obtaining a copy
9 | * of this software and associated documentation files (the "Software"), to deal
10 | * in the Software without restriction, including without limitation the rights
11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | * copies of the Software, and to permit persons to whom the Software is
13 | * furnished to do so, subject to the following conditions:
14 | *
15 | * The above copyright notice and this permission notice shall be included in all
16 | * copies or substantial portions of the Software.
17 | *
18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 | * SOFTWARE.
25 | *
26 | */
27 |
28 | #ifndef EXCEP_PROG_H_
29 | #define EXCEP_PROG_H_
30 |
31 | /* Priority for exception */
32 | #define IRQ0_PRI 0x1F
33 | #define MEM_PRI 0x06
34 | #define SVC_PRI 0x02
35 |
36 |
37 | /* Parameters for context stack */
38 | #define PS_STACK_SIZE 0x100
39 | #define CalleeRegNum 8
40 |
41 | /* Index for caller register of SVC stack */
42 | #define STK_FRAME_R0 0
43 | #define STK_FRAME_R1 1
44 | #define STK_FRAME_R2 2
45 | #define STK_FRAME_R3 3
46 | #define STK_FRAME_R12 4
47 | #define STK_FRAME_LR 5
48 | #define STK_FRAME_RET_ADDR 6
49 | #define STK_FRAME_XPSR 7
50 |
51 | /* Declaration of variables used in unprivileged mode */
52 | extern uint32_t deprivThreadStack[];
53 | extern uint32_t *deprivThreadStackPtr;
54 |
55 | uint32_t SVCHandlerMain(uint32_t *svc_StackFrame, uint32_t *msp, uint32_t EXCReturn);
56 | void depriv_service(void);
57 |
58 | #endif /* EXCEP_PROG_H_ */
59 |
60 |
61 |
--------------------------------------------------------------------------------
/Exception_model/interrupt-deprivileging/interrupt-deprivileging.rteconfig:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/Exception_model/interrupt-deprivileging/main.c:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * MIT License
4 | * Copyright (c) 2023 ARM Limited.
5 | *
6 | * SPDX-License-Identifier: MIT
7 | *
8 | * Permission is hereby granted, free of charge, to any person obtaining a copy
9 | * of this software and associated documentation files (the "Software"), to deal
10 | * in the Software without restriction, including without limitation the rights
11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | * copies of the Software, and to permit persons to whom the Software is
13 | * furnished to do so, subject to the following conditions:
14 | *
15 | * The above copyright notice and this permission notice shall be included in all
16 | * copies or substantial portions of the Software.
17 | *
18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 | * SOFTWARE.
25 | *
26 | */
27 |
28 | #if defined (ARMv81MML_DSP_DP_MVE_FP)
29 | #include "ARMv81MML_DSP_DP_MVE_FP.h"
30 | #else
31 | #error device not specified!
32 | #endif
33 |
34 |
35 | #include
36 | #include "excep_prog.h"
37 | #include "mpu_prog.h"
38 |
39 |
40 | int main(){
41 | /* ===========================================
42 | * This example demonstrates the concept of
43 | * interrupt deprivileging. This concept is
44 | * useful for creating sandboxes and is
45 | * used to enable services of peripherals
46 | * where some of them communicate through interrupts.
47 | *
48 | * For platforms that use Arm7-M based devices,
49 | * enable CCR.NONBASETHRDENA bit
50 | * =========================================== */
51 |
52 | printf("Example Project: interrupt-deprivileging Start \n");
53 | /* Step1: in privileged background, set priority for IRQ, MemManage fault and SVC */
54 | setMPU();
55 | NVIC_SetPriority(Interrupt0_IRQn, IRQ0_PRI);
56 | NVIC_SetPriority(SVCall_IRQn, SVC_PRI);
57 | NVIC_SetPriority(MemoryManagement_IRQn, MEM_PRI);
58 |
59 | /* Step2: Enable and pend IRQ0. */
60 | NVIC_EnableIRQ(Interrupt0_IRQn);
61 | NVIC_SetPendingIRQ(Interrupt0_IRQn);
62 |
63 | /* Step3: print the status of execution mode */
64 | printf("we are back from IRQ!\n");
65 | printf("The status is 0x%01x \n", __get_CONTROL());
66 |
67 | printf("Example Project: interrupt-deprivileging End \n");
68 | }
69 |
--------------------------------------------------------------------------------
/Exception_model/interrupt-deprivileging/mpu_prog.h:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * MIT License
4 | * Copyright (c) 2023 ARM Limited.
5 | *
6 | * SPDX-License-Identifier: MIT
7 | *
8 | * Permission is hereby granted, free of charge, to any person obtaining a copy
9 | * of this software and associated documentation files (the "Software"), to deal
10 | * in the Software without restriction, including without limitation the rights
11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | * copies of the Software, and to permit persons to whom the Software is
13 | * furnished to do so, subject to the following conditions:
14 | *
15 | * The above copyright notice and this permission notice shall be included in all
16 | * copies or substantial portions of the Software.
17 | *
18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 | * SOFTWARE.
25 | *
26 | */
27 |
28 | /* These defines are used as input parameters for the ARM_MPU_RBAR macros in mpu_armv8.h (part of CMSIS-CORE).*/
29 | #define ARM_MPU_RO 1UL
30 | #define ARM_MPU_RW 0UL
31 | #define ARM_MPU_NON_PRIV 1UL
32 | #define ARM_MPU_PRIV 0UL
33 | #define ARM_MPU_XN 1UL
34 | #define ARM_MPU_EXEC 0UL
35 |
36 |
37 | /* Memory region symbols extracted from scatter file */
38 | extern unsigned int Image$$ER_ROM$$Base;
39 | extern unsigned int Image$$ER_ROM$$Limit;
40 | extern unsigned int Image$$RW_RAM$$Base;
41 | extern unsigned int Image$$ARM_LIB_STACK$$ZI$$Limit;
42 | extern unsigned int Image$$UNPRIV_ROM$$Base;
43 | extern unsigned int Image$$UNPRIV_ROM$$Limit;
44 | extern unsigned int Image$$UNPRIV_RAM$$Base;
45 | extern unsigned int Image$$PSP_STACK$$ZI$$Limit;
46 |
47 | void setMPU();
48 | void config_MPU(uint32_t PRI_ATTR);
49 |
--------------------------------------------------------------------------------
/Exception_model/interrupt-deprivileging/priority_setting.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ARM-software/m-profile-user-guide-examples/1c961a98d1f5e8e92b7142403a2722d2e52be624/Exception_model/interrupt-deprivileging/priority_setting.png
--------------------------------------------------------------------------------
/Exception_model/interrupt-deprivileging/scripts/paddron.ds:
--------------------------------------------------------------------------------
1 | set elf load-segments-at-p_paddr on
--------------------------------------------------------------------------------
/Exception_model/interrupt-deprivileging/scripts/success.txt:
--------------------------------------------------------------------------------
1 | Example Project: interrupt-deprivileging Start
2 | we are in deprivileging thread mode
3 | we are back from IRQ
4 | The status is 0xc
5 | Example Project: interrupt-deprivileging End
6 |
--------------------------------------------------------------------------------
/Exception_model/irq-priority-basic/.gitignore:
--------------------------------------------------------------------------------
1 | /Debug/
2 |
--------------------------------------------------------------------------------
/Exception_model/irq-priority-basic/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | irq-priority-basic
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder
10 | clean,full,incremental,
11 |
12 |
13 |
14 |
15 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
16 | full,incremental,
17 |
18 |
19 |
20 |
21 |
22 | org.eclipse.cdt.core.cnature
23 | org.eclipse.cdt.managedbuilder.core.managedBuildNature
24 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
25 | com.arm.cmsis.pack.project.RteNature
26 |
27 |
28 |
--------------------------------------------------------------------------------
/Exception_model/irq-priority-basic/RTE/RTE_Components.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Auto generated Run-Time-Environment Component Configuration File
3 | * *** Do not modify ! ***
4 | *
5 | * Project: irq-priority-basic
6 | * RTE configuration: irq-priority-basic.rteconfig
7 | */
8 | #ifndef RTE_COMPONENTS_H
9 | #define RTE_COMPONENTS_H
10 |
11 | /*
12 | * Define the Device Header File:
13 | */
14 | #define CMSIS_device_header "ARMv8MML.h"
15 |
16 |
17 | #endif /* RTE_COMPONENTS_H */
18 |
--------------------------------------------------------------------------------
/Exception_model/irq-priority-basic/group_prio_setting.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ARM-software/m-profile-user-guide-examples/1c961a98d1f5e8e92b7142403a2722d2e52be624/Exception_model/irq-priority-basic/group_prio_setting.png
--------------------------------------------------------------------------------
/Exception_model/irq-priority-basic/irq-priority-basic.rteconfig:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/Exception_model/irq-priority-basic/scripts/paddron.ds:
--------------------------------------------------------------------------------
1 | set elf load-segments-at-p_paddr on
--------------------------------------------------------------------------------
/Exception_model/irq-priority-basic/scripts/success.txt:
--------------------------------------------------------------------------------
1 | Example Project: irq-priority-basic Start
2 | Vector table address is
3 | The IRQ0's vector address is
4 | New vector table address is
5 | The new IRQ0's vector address is
6 | We are in IRQ 0 Handler!
7 | Setting IRQ 1 to pend
8 | We are in IRQ 1 Handler!
9 | Setting IRQ 2 to pend
10 | We are in IRQ 2 Handler!
11 | There is more than one active exception.
12 | The number of the highest priority active exception is
13 | There is only one active exception.
14 | Case:1 is completed!
15 | Case:2 is completed!
16 | Group priority test is completed!
17 | Sub priority test is completed!
18 | Case:3 is completed!
19 | Example Project: irq-priority-basic End
--------------------------------------------------------------------------------
/Exception_model/priority-boost-types/.gitignore:
--------------------------------------------------------------------------------
1 | /Debug/
2 |
--------------------------------------------------------------------------------
/Exception_model/priority-boost-types/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | priority-boost-types
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder
10 | clean,full,incremental,
11 |
12 |
13 |
14 |
15 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
16 | full,incremental,
17 |
18 |
19 |
20 |
21 |
22 | org.eclipse.cdt.core.cnature
23 | org.eclipse.cdt.managedbuilder.core.managedBuildNature
24 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
25 | com.arm.cmsis.pack.project.RteNature
26 |
27 |
28 |
--------------------------------------------------------------------------------
/Exception_model/priority-boost-types/IRQSet.h:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * MIT License
4 | * Copyright (c) 2023 ARM Limited.
5 | *
6 | * SPDX-License-Identifier: MIT
7 | *
8 | * Permission is hereby granted, free of charge, to any person obtaining a copy
9 | * of this software and associated documentation files (the "Software"), to deal
10 | * in the Software without restriction, including without limitation the rights
11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | * copies of the Software, and to permit persons to whom the Software is
13 | * furnished to do so, subject to the following conditions:
14 | *
15 | * The above copyright notice and this permission notice shall be included in all
16 | * copies or substantial portions of the Software.
17 | *
18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 | * SOFTWARE.
25 | *
26 | */
27 |
28 |
29 | #ifndef IRQSET_H_
30 | #define IRQSET_H_
31 |
32 | /* Parameters for new vector table */
33 | #define VECTORTABLE_SIZE 48
34 | #define VECTORTABLE_ALIGNMENT 0x100U
35 |
36 | /* Parameters for pending different interrupts at each IRQ handler */
37 | #define IRQ_PENDNum 3 /* Number of IRQs to trigger */
38 |
39 | #define InIRQ0Handler 0 /* Index for pending request array */
40 | #define InIRQ1Handler 1
41 | #define InIRQ2Handler 2
42 |
43 | #define IRQ_offset 16 /* Exception Number offset for external interrupts */
44 |
45 | /* Declaration of origin vector table and pend request array */
46 | extern uint32_t __VECTOR_TABLE[];
47 | extern uint32_t IRQPendRequests[];
48 |
49 | void Interrupt_Handler(void);
50 | void Vector_Table_Relocation(void);
51 | void Print_PendAndActiveStatus();
52 |
53 | #endif /* IRQSET_H_ */
54 |
--------------------------------------------------------------------------------
/Exception_model/priority-boost-types/RTE/RTE_Components.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Auto generated Run-Time-Environment Component Configuration File
3 | * *** Do not modify ! ***
4 | *
5 | * Project: priority-boost-types
6 | * RTE configuration: priority-boost-types.rteconfig
7 | */
8 | #ifndef RTE_COMPONENTS_H
9 | #define RTE_COMPONENTS_H
10 |
11 | /*
12 | * Define the Device Header File:
13 | */
14 | #define CMSIS_device_header "ARMv8MML.h"
15 |
16 |
17 | #endif /* RTE_COMPONENTS_H */
18 |
--------------------------------------------------------------------------------
/Exception_model/priority-boost-types/priority-boost-types.rteconfig:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/Exception_model/priority-boost-types/scripts/paddron.ds:
--------------------------------------------------------------------------------
1 | set elf load-segments-at-p_paddr on
--------------------------------------------------------------------------------
/Exception_model/priority-boost-types/scripts/success.txt:
--------------------------------------------------------------------------------
1 | Example Project: priority-boost-types Start
2 | BASEPRI is set with triggering IRQ0 and IRQ1!
3 | We are in IRQ 1 Handler!
4 | Setting IRQ 2 to pend
5 | The number of the highest priority pending exception is
6 | There is more than one active exception.
7 | The number of the highest priority active exception is
8 | BASEPRI is clear!
9 | There is only one active exception.
10 | Example Project: priority-boost-types End
--------------------------------------------------------------------------------
/Exception_model/svc-number-as-parameter/.gitignore:
--------------------------------------------------------------------------------
1 | /Debug/
2 |
--------------------------------------------------------------------------------
/Exception_model/svc-number-as-parameter/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | svc-number-as-parameter
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder
10 | clean,full,incremental,
11 |
12 |
13 |
14 |
15 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
16 | full,incremental,
17 |
18 |
19 |
20 |
21 |
22 | org.eclipse.cdt.core.cnature
23 | org.eclipse.cdt.managedbuilder.core.managedBuildNature
24 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
25 | com.arm.cmsis.pack.project.RteNature
26 |
27 |
28 |
--------------------------------------------------------------------------------
/Exception_model/svc-number-as-parameter/RTE/RTE_Components.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Auto generated Run-Time-Environment Component Configuration File
3 | * *** Do not modify ! ***
4 | *
5 | * Project: svc-number-as-parameter
6 | * RTE configuration: svc-number-as-parameter.rteconfig
7 | */
8 | #ifndef RTE_COMPONENTS_H
9 | #define RTE_COMPONENTS_H
10 |
11 | /*
12 | * Define the Device Header File:
13 | */
14 | #define CMSIS_device_header "ARMv8MML.h"
15 |
16 |
17 | #endif /* RTE_COMPONENTS_H */
18 |
--------------------------------------------------------------------------------
/Exception_model/svc-number-as-parameter/SelectSVCNumber.h:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * MIT License
4 | * Copyright (c) 2023 ARM Limited.
5 | *
6 | * SPDX-License-Identifier: MIT
7 | *
8 | * Permission is hereby granted, free of charge, to any person obtaining a copy
9 | * of this software and associated documentation files (the "Software"), to deal
10 | * in the Software without restriction, including without limitation the rights
11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | * copies of the Software, and to permit persons to whom the Software is
13 | * furnished to do so, subject to the following conditions:
14 | *
15 | * The above copyright notice and this permission notice shall be included in all
16 | * copies or substantial portions of the Software.
17 | *
18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 | * SOFTWARE.
25 | *
26 | */
27 |
28 |
29 | #ifndef SELECTSVCNUMBER_H_
30 | #define SELECTSVCNUMBER_H_
31 |
32 | /* Index for caller register of SVC stack */
33 | #define STK_FRAME_R0 0
34 | #define STK_FRAME_R1 1
35 | #define STK_FRAME_R2 2
36 | #define STK_FRAME_R3 3
37 | #define STK_FRAME_R12 4
38 | #define STK_FRAME_LR 5
39 | #define STK_FRAME_RET_ADDR 6
40 | #define STK_FRAME_XPSR 7
41 |
42 | void SVC_Handler_Main(uint32_t *svc_StackFrame, uint32_t EXC_return_value);
43 |
44 | #endif /* SELECTSVCNUMBER_H_ */
45 |
--------------------------------------------------------------------------------
/Exception_model/svc-number-as-parameter/main.c:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * MIT License
4 | * Copyright (c) 2023 ARM Limited.
5 | *
6 | * SPDX-License-Identifier: MIT
7 | *
8 | * Permission is hereby granted, free of charge, to any person obtaining a copy
9 | * of this software and associated documentation files (the "Software"), to deal
10 | * in the Software without restriction, including without limitation the rights
11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | * copies of the Software, and to permit persons to whom the Software is
13 | * furnished to do so, subject to the following conditions:
14 | *
15 | * The above copyright notice and this permission notice shall be included in all
16 | * copies or substantial portions of the Software.
17 | *
18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 | * SOFTWARE.
25 | *
26 | */
27 |
28 | #if defined (ARMv8MML)
29 | #include "ARMv8MML.h"
30 | #elif defined (ARMv8MML_DSP)
31 | #include "ARMv8MML_DSP.h"
32 | #elif defined (ARMv8MML_SP)
33 | #include "ARMv8MML_SP.h"
34 | #elif defined (ARMv8MML_DSP_SP)
35 | #include "ARMv8MML_DSP_SP.h"
36 | #elif defined (ARMv8MML_DP)
37 | #include "ARMv8MML_DP.h"
38 | #elif defined (ARMv8MML_DSP_DP)
39 | #include "ARMv8MML_DSP_DP.h"
40 | #else
41 | #error device not specified!
42 | #endif
43 |
44 |
45 | #include "SelectSVCNumber.h"
46 | #include
47 |
48 | int main(){
49 | /* ===========================================
50 | * The example demonstrates how to select different functions
51 | * by using a SVC as a parameter
52 | * =========================================== */
53 |
54 | printf("Example Project: svc-number-as-parameter Start \n");
55 |
56 | /* Step1: Call different SVC subroutine */
57 | __asm(
58 | "MOV R0, #4 \n"
59 | "MOV R1, #8 \n"
60 | "SVC #1 \n"
61 | );
62 | printf("The first routine is completed !\n");
63 |
64 |
65 | __asm(
66 | "MOV R0, #6 \n"
67 | "MOV R1, #6 \n"
68 | "SVC #2 \n"
69 | );
70 | printf("The second routine is completed !\n");
71 |
72 |
73 | __asm(
74 | "MOV R0, #83 \n"
75 | "MOV R1, #7 \n"
76 | "SVC #3 \n"
77 | );
78 | printf("The third routine is completed !\n");
79 |
80 |
81 | printf("Example Project: svc-number-as-parameter End \n");
82 | }
83 |
--------------------------------------------------------------------------------
/Exception_model/svc-number-as-parameter/scripts/paddron.ds:
--------------------------------------------------------------------------------
1 | set elf load-segments-at-p_paddr on
--------------------------------------------------------------------------------
/Exception_model/svc-number-as-parameter/scripts/success.txt:
--------------------------------------------------------------------------------
1 | Example Project: svc-number-as-parameter Start
2 | The return address is
3 | The stacked return state is
4 | svc_number is
5 | The result of R0+R1 is
6 | The first routine is completed
7 | The result of R0*R1 is
8 | The second routine is completed
9 | The result of R0 mod R1 is
10 | Example Project: svc-number-as-parameter End
--------------------------------------------------------------------------------
/Exception_model/svc-number-as-parameter/svc-number-as-parameter.rteconfig:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/Exception_model/synchronous-fault/.gitignore:
--------------------------------------------------------------------------------
1 | /Debug/
2 |
--------------------------------------------------------------------------------
/Exception_model/synchronous-fault/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | synchronous-fault
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder
10 | clean,full,incremental,
11 |
12 |
13 |
14 |
15 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
16 | full,incremental,
17 |
18 |
19 |
20 |
21 |
22 | org.eclipse.cdt.core.cnature
23 | org.eclipse.cdt.managedbuilder.core.managedBuildNature
24 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
25 | com.arm.cmsis.pack.project.RteNature
26 |
27 |
28 |
--------------------------------------------------------------------------------
/Exception_model/synchronous-fault/RTE/RTE_Components.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Auto generated Run-Time-Environment Component Configuration File
3 | * *** Do not modify ! ***
4 | *
5 | * Project: synchronous-fault
6 | * RTE configuration: synchronous-fault.rteconfig
7 | */
8 | #ifndef RTE_COMPONENTS_H
9 | #define RTE_COMPONENTS_H
10 |
11 | /*
12 | * Define the Device Header File:
13 | */
14 | #define CMSIS_device_header "ARMv8MML_DP.h"
15 |
16 |
17 | #endif /* RTE_COMPONENTS_H */
18 |
--------------------------------------------------------------------------------
/Exception_model/synchronous-fault/funcs.h:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * MIT License
4 | * Copyright (c) 2023 ARM Limited.
5 | *
6 | * SPDX-License-Identifier: MIT
7 | *
8 | * Permission is hereby granted, free of charge, to any person obtaining a copy
9 | * of this software and associated documentation files (the "Software"), to deal
10 | * in the Software without restriction, including without limitation the rights
11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | * copies of the Software, and to permit persons to whom the Software is
13 | * furnished to do so, subject to the following conditions:
14 | *
15 | * The above copyright notice and this permission notice shall be included in all
16 | * copies or substantial portions of the Software.
17 | *
18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 | * SOFTWARE.
25 | *
26 | */
27 |
28 | #ifndef FUNCS_H_
29 | #define FUNCS_H_
30 |
31 | int32_t Call_FPU(uint32_t flag);
32 |
33 | #endif /* FUNCS_H_ */
34 |
--------------------------------------------------------------------------------
/Exception_model/synchronous-fault/funcs.s:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * MIT License
4 | * Copyright (c) 2023 ARM Limited.
5 | *
6 | * SPDX-License-Identifier: MIT
7 | *
8 | * Permission is hereby granted, free of charge, to any person obtaining a copy
9 | * of this software and associated documentation files (the "Software"), to deal
10 | * in the Software without restriction, including without limitation the rights
11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | * copies of the Software, and to permit persons to whom the Software is
13 | * furnished to do so, subject to the following conditions:
14 | *
15 | * The above copyright notice and this permission notice shall be included in all
16 | * copies or substantial portions of the Software.
17 | *
18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 | * SOFTWARE.
25 | *
26 | */
27 |
28 | .global Call_FPU
29 | .type Call_FPU, "function"
30 |
31 | Call_FPU:
32 | MOV R1, #0x12
33 | MOVT R1, #0x5678
34 | VMOV S0, R1
35 | CMP R0, #1
36 | BNE print_status
37 | VMOV R0, S0
38 |
--------------------------------------------------------------------------------
/Exception_model/synchronous-fault/scripts/paddron.ds:
--------------------------------------------------------------------------------
1 | set elf load-segments-at-p_paddr on
--------------------------------------------------------------------------------
/Exception_model/synchronous-fault/scripts/success.txt:
--------------------------------------------------------------------------------
1 | Example Project: synchronous-fault Start
2 | UsageFault entered
3 | The floating result is 10.000000
4 | Example Project: synchronous-fault End
--------------------------------------------------------------------------------
/Exception_model/synchronous-fault/synchronous-fault.rteconfig:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/Exception_model/system-exceptions/.gitignore:
--------------------------------------------------------------------------------
1 | /Debug/
2 |
--------------------------------------------------------------------------------
/Exception_model/system-exceptions/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | system-exceptions
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder
10 | clean,full,incremental,
11 |
12 |
13 |
14 |
15 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
16 | full,incremental,
17 |
18 |
19 |
20 |
21 |
22 | org.eclipse.cdt.core.cnature
23 | org.eclipse.cdt.managedbuilder.core.managedBuildNature
24 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
25 | com.arm.cmsis.pack.project.RteNature
26 |
27 |
28 |
--------------------------------------------------------------------------------
/Exception_model/system-exceptions/RTE/RTE_Components.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Auto generated Run-Time-Environment Component Configuration File
3 | * *** Do not modify ! ***
4 | *
5 | * Project: system-exceptions
6 | * RTE configuration: system-exceptions.rteconfig
7 | */
8 | #ifndef RTE_COMPONENTS_H
9 | #define RTE_COMPONENTS_H
10 |
11 | /*
12 | * Define the Device Header File:
13 | */
14 | #define CMSIS_device_header "ARMv8MML.h"
15 |
16 |
17 | #endif /* RTE_COMPONENTS_H */
18 |
--------------------------------------------------------------------------------
/Exception_model/system-exceptions/scripts/paddron.ds:
--------------------------------------------------------------------------------
1 | set elf load-segments-at-p_paddr on
--------------------------------------------------------------------------------
/Exception_model/system-exceptions/scripts/success.txt:
--------------------------------------------------------------------------------
1 | Example Project: system-exceptions Start
2 | We are in SysTick_Handler!
3 | The pending and active status are
4 | SCB->ICSR =
5 | We are in SysTick_Handler end!
6 | We are in PendSV_Handler!
7 | SCB->ICSR = 0x0000080e
8 | Example Project: system-exceptions End
--------------------------------------------------------------------------------
/Exception_model/system-exceptions/system-exceptions.rteconfig:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2022 Arm Limited
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/Memory_model/TCM_implement/.gitignore:
--------------------------------------------------------------------------------
1 | /Debug/
2 |
--------------------------------------------------------------------------------
/Memory_model/TCM_implement/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | TCM_implement
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder
10 | clean,full,incremental,
11 |
12 |
13 |
14 |
15 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
16 | full,incremental,
17 |
18 |
19 |
20 |
21 |
22 | org.eclipse.cdt.core.cnature
23 | org.eclipse.cdt.managedbuilder.core.managedBuildNature
24 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
25 | com.arm.cmsis.pack.project.RteNature
26 |
27 |
28 |
--------------------------------------------------------------------------------
/Memory_model/TCM_implement/Excep_prog.c:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * MIT License
4 | * Copyright (c) 2023 ARM Limited.
5 | *
6 | * SPDX-License-Identifier: MIT
7 | *
8 | * Permission is hereby granted, free of charge, to any person obtaining a copy
9 | * of this software and associated documentation files (the "Software"), to deal
10 | * in the Software without restriction, including without limitation the rights
11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | * copies of the Software, and to permit persons to whom the Software is
13 | * furnished to do so, subject to the following conditions:
14 | *
15 | * The above copyright notice and this permission notice shall be included in all
16 | * copies or substantial portions of the Software.
17 | *
18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 | * SOFTWARE.
25 | *
26 | */
27 |
28 | #if defined (ARMCM55)
29 | #include "ARMCM55.h"
30 | #endif
31 |
32 | #include "Excep_prog.h"
33 | #include
34 | #include
35 |
36 | /* Definition of new vector table with attribute */
37 | VECTOR_TABLE_Type new_vectorTable[VECTORTABLE_SIZE] __attribute__((used, section(".NewVT")));
38 |
39 |
40 | /**
41 | \brief Relocate vector table
42 | \details Create a new vector table at ITCM and change the
43 | VTOR from origin vector table address to new one.
44 | */
45 | void Vector_Table_Relocation(void){
46 | /* Copy the original handler address into new vector table */
47 | memcpy(new_vectorTable, __VECTOR_TABLE, sizeof(VECTOR_TABLE_Type)*VECTORTABLE_SIZE);
48 |
49 | /* Get information about vector table */
50 | printf("Vector table address is 0x%08x\n", SCB->VTOR);
51 |
52 | /* Change the VTOR into new vector table address */
53 | SCB->VTOR = (uint32_t)&new_vectorTable;
54 | __DSB();
55 | __ISB();
56 |
57 | printf("New vector table address is 0x%08x\n", SCB->VTOR );
58 | }
59 |
--------------------------------------------------------------------------------
/Memory_model/TCM_implement/Excep_prog.h:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * MIT License
4 | * Copyright (c) 2023 ARM Limited.
5 | *
6 | * SPDX-License-Identifier: MIT
7 | *
8 | * Permission is hereby granted, free of charge, to any person obtaining a copy
9 | * of this software and associated documentation files (the "Software"), to deal
10 | * in the Software without restriction, including without limitation the rights
11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | * copies of the Software, and to permit persons to whom the Software is
13 | * furnished to do so, subject to the following conditions:
14 | *
15 | * The above copyright notice and this permission notice shall be included in all
16 | * copies or substantial portions of the Software.
17 | *
18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 | * SOFTWARE.
25 | *
26 | */
27 |
28 | #ifndef EXCEP_PROG_H_
29 | #define EXCEP_PROG_H_
30 |
31 | /* Parameters for new vector table */
32 | #define VECTORTABLE_SIZE 48
33 | #define VECTORTABLE_ALIGNMENT 0x100U
34 |
35 | extern const VECTOR_TABLE_Type __VECTOR_TABLE[];
36 |
37 | void Vector_Table_Relocation(void);
38 |
39 | #endif /* EXCEP_PROG_H_ */
40 |
--------------------------------------------------------------------------------
/Memory_model/TCM_implement/RTE/RTE_Components.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Auto generated Run-Time-Environment Component Configuration File
3 | * *** Do not modify ! ***
4 | *
5 | * Project: TCM_implement
6 | * RTE configuration: TCM_implement.rteconfig
7 | */
8 | #ifndef RTE_COMPONENTS_H
9 | #define RTE_COMPONENTS_H
10 |
11 | /*
12 | * Define the Device Header File:
13 | */
14 | #define CMSIS_device_header "ARMCM55.h"
15 |
16 |
17 | #endif /* RTE_COMPONENTS_H */
18 |
--------------------------------------------------------------------------------
/Memory_model/TCM_implement/TCM_implement.rteconfig:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/Memory_model/TCM_implement/check_is_full.c:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * MIT License
4 | * Copyright (c) 2023 ARM Limited.
5 | *
6 | * SPDX-License-Identifier: MIT
7 | *
8 | * Permission is hereby granted, free of charge, to any person obtaining a copy
9 | * of this software and associated documentation files (the "Software"), to deal
10 | * in the Software without restriction, including without limitation the rights
11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | * copies of the Software, and to permit persons to whom the Software is
13 | * furnished to do so, subject to the following conditions:
14 | *
15 | * The above copyright notice and this permission notice shall be included in all
16 | * copies or substantial portions of the Software.
17 | *
18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 | * SOFTWARE.
25 | *
26 | */
27 |
28 |
29 | /* As we use arm compiler, it will automatically relocate the latency critical
30 | * code from ROM to ITCM when doing scatter loading. However, if we use other
31 | * tool chains like GCC, it won't do the relocate automatically so that we need
32 | * to finish it manually like relocating vector table.
33 | */
34 | #if defined (ARMCM55)
35 | #include "ARMCM55.h"
36 | #endif
37 |
38 | #define DEP_LIMIT 100
39 | #define LITRES_TO_ADD 10
40 |
41 | #include
42 | #include
43 | #include
44 |
45 | int __attribute__((section(".dtcm"))) volume = 0;
46 | int __attribute__((section(".dtcm"))) checks = 0;
47 |
48 |
49 | /**
50 | \brief Checks if the volume of a deposit is beyond a limit
51 | \details Check if current volume with other to add is beyond limit
52 | \return 1, the deposit is full
53 | 0, the deposit is not full
54 | */
55 | bool check_is_full(){
56 | if ((volume + LITRES_TO_ADD)>= DEP_LIMIT)
57 | return true;
58 | else
59 | return false;
60 | }
61 |
62 |
63 | /**
64 | \brief Overwrite of SysTick handler
65 | \details Get the result of check_is_full() and go on the next step to fill
66 | or stop based on it.
67 | */
68 | extern void SysTick_Handler(void){
69 | printf("Number of checks in SysTick handler: %d \n", checks);
70 | checks += 1;
71 |
72 | /* Checks if the deposit is full */
73 | /* Fills or stops filling the deposit depending whether it is full or not */
74 | if (check_is_full()){
75 | volume = 0;
76 | }
77 | else{
78 | volume += LITRES_TO_ADD;
79 | }
80 |
81 | printf("Current volume: %d \n", volume);
82 | }
83 |
--------------------------------------------------------------------------------
/Memory_model/TCM_implement/flowchart.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ARM-software/m-profile-user-guide-examples/1c961a98d1f5e8e92b7142403a2722d2e52be624/Memory_model/TCM_implement/flowchart.png
--------------------------------------------------------------------------------
/Memory_model/TCM_implement/main.c:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * MIT License
4 | * Copyright (c) 2023 ARM Limited.
5 | *
6 | * SPDX-License-Identifier: MIT
7 | *
8 | * Permission is hereby granted, free of charge, to any person obtaining a copy
9 | * of this software and associated documentation files (the "Software"), to deal
10 | * in the Software without restriction, including without limitation the rights
11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | * copies of the Software, and to permit persons to whom the Software is
13 | * furnished to do so, subject to the following conditions:
14 | *
15 | * The above copyright notice and this permission notice shall be included in all
16 | * copies or substantial portions of the Software.
17 | *
18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 | * SOFTWARE.
25 | *
26 | */
27 |
28 | #if defined (ARMCM55)
29 | #include "ARMCM55.h"
30 | #endif
31 |
32 | #include
33 | #include "mpu_prog.h"
34 | #include "Excep_prog.h"
35 |
36 | #define MAX_RPMS 100
37 | #define RPMS_TO_INC 15
38 |
39 | int rpms = 0;
40 | int stir = 0;
41 |
42 | int main(){
43 | /* ===========================================
44 | * NOTE:
45 | * This example is to show how to configure TCM memory, and set up
46 | * latency critical code at TCM.
47 | * Please refer the configurations at RTE\Device\ARMCM55_ac6.sct
48 | * =========================================== */
49 |
50 | printf("Example Project: TCM-implement Start\n");
51 | /* Step1: Set MPU regions and enable MPU */
52 | setMPU();
53 | SCB_EnableDCache();
54 | SCB_EnableICache();
55 |
56 | /* Step2: relocate vector table into TCM */
57 | Vector_Table_Relocation();
58 |
59 | /* Step3: Generate SysTick interrupt */
60 | SystemCoreClockUpdate();
61 | SysTick_Config(SystemCoreClock/200);
62 |
63 | /* Start background sequence */
64 | while(1){
65 | if(rpms < MAX_RPMS){
66 | stir = 1;
67 | rpms += RPMS_TO_INC;
68 | }
69 | else{
70 | stir = 0;
71 | rpms = 0;
72 | }
73 | printf("Current revolutions per minute: %d \n", rpms);
74 | }
75 |
76 | return 0;
77 | }
78 |
--------------------------------------------------------------------------------
/Memory_model/TCM_implement/mpu_defs.h:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * MIT License
4 | * Copyright (c) 2023 ARM Limited.
5 | *
6 | * SPDX-License-Identifier: MIT
7 | *
8 | * Permission is hereby granted, free of charge, to any person obtaining a copy
9 | * of this software and associated documentation files (the "Software"), to deal
10 | * in the Software without restriction, including without limitation the rights
11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | * copies of the Software, and to permit persons to whom the Software is
13 | * furnished to do so, subject to the following conditions:
14 | *
15 | * The above copyright notice and this permission notice shall be included in all
16 | * copies or substantial portions of the Software.
17 | *
18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 | * SOFTWARE.
25 | *
26 | */
27 |
28 | /* These defines are used as input parameters for the ARM_MPU_RBAR macros in mpu_armv8.h (part of CMSIS-CORE). */
29 |
30 | #define ARM_MPU_RO 1UL
31 | #define ARM_MPU_RW 0UL
32 | #define ARM_MPU_NON_PRIV 1UL
33 | #define ARM_MPU_PRIV 0UL
34 | #define ARM_MPU_XN 1UL
35 | #define ARM_MPU_EXEC 0UL
36 |
--------------------------------------------------------------------------------
/Memory_model/TCM_implement/mpu_prog.h:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * MIT License
4 | * Copyright (c) 2023 ARM Limited.
5 | *
6 | * SPDX-License-Identifier: MIT
7 | *
8 | * Permission is hereby granted, free of charge, to any person obtaining a copy
9 | * of this software and associated documentation files (the "Software"), to deal
10 | * in the Software without restriction, including without limitation the rights
11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | * copies of the Software, and to permit persons to whom the Software is
13 | * furnished to do so, subject to the following conditions:
14 | *
15 | * The above copyright notice and this permission notice shall be included in all
16 | * copies or substantial portions of the Software.
17 | *
18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 | * SOFTWARE.
25 | *
26 | */
27 |
28 | /* Declaration of memory regions in linker scripts*/
29 | extern unsigned int Image$$ITCM$$Base;
30 | extern unsigned int Image$$ITCM$$Limit;
31 |
32 | extern unsigned int Image$$ITCM_Code$$Base;
33 | extern unsigned int Image$$ITCM_Code$$Limit;
34 |
35 | extern unsigned int Image$$RW_RAM$$Base;
36 | extern unsigned int Image$$RESET_MSP_STACK$$ZI$$Limit;
37 |
38 | extern unsigned int Image$$ER_ROM$$Base;
39 | extern unsigned int Image$$ER_ROM$$Limit;
40 |
41 | extern unsigned int Image$$DTCM$$Base;
42 | extern unsigned int Image$$ARM_LIB_STACK$$ZI$$Limit;
43 |
44 | int setMPU(void);
45 |
--------------------------------------------------------------------------------
/Memory_model/TCM_implement/scripts/paddron.ds:
--------------------------------------------------------------------------------
1 | set elf load-segments-at-p_paddr on
--------------------------------------------------------------------------------
/Memory_model/TCM_implement/scripts/success.txt:
--------------------------------------------------------------------------------
1 | Example Project: TCM-implement Start
2 | Vector table address is
3 | New vector table address is
4 | Current revolutions per minute:
5 | Number of checks in SysTick handler:
6 | Current volume:
--------------------------------------------------------------------------------
/Memory_model/rtos_context_switch/.gitignore:
--------------------------------------------------------------------------------
1 | /Debug/
2 |
--------------------------------------------------------------------------------
/Memory_model/rtos_context_switch/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | rtos_context_switch
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder
10 | clean,full,incremental,
11 |
12 |
13 |
14 |
15 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
16 | full,incremental,
17 |
18 |
19 |
20 |
21 |
22 | com.arm.debug.ds.nature
23 | org.eclipse.cdt.core.cnature
24 | org.eclipse.cdt.managedbuilder.core.managedBuildNature
25 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
26 | com.arm.cmsis.pack.project.RteNature
27 |
28 |
29 |
--------------------------------------------------------------------------------
/Memory_model/rtos_context_switch/RTE/RTE_Components.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Auto generated Run-Time-Environment Component Configuration File
3 | * *** Do not modify ! ***
4 | *
5 | * Project: rtos_context_switch
6 | * RTE configuration: rtos_context_switch.rteconfig
7 | */
8 | #ifndef RTE_COMPONENTS_H
9 | #define RTE_COMPONENTS_H
10 |
11 | /*
12 | * Define the Device Header File:
13 | */
14 | #define CMSIS_device_header "ARMv8MML.h"
15 |
16 |
17 | #endif /* RTE_COMPONENTS_H */
18 |
--------------------------------------------------------------------------------
/Memory_model/rtos_context_switch/main.c:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * MIT License
4 | * Copyright (c) 2022-2023 ARM Limited.
5 | *
6 | * SPDX-License-Identifier: MIT
7 | *
8 | * Permission is hereby granted, free of charge, to any person obtaining a copy
9 | * of this software and associated documentation files (the "Software"), to deal
10 | * in the Software without restriction, including without limitation the rights
11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | * copies of the Software, and to permit persons to whom the Software is
13 | * furnished to do so, subject to the following conditions:
14 | *
15 | * The above copyright notice and this permission notice shall be included in all
16 | * copies or substantial portions of the Software.
17 | *
18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 | * SOFTWARE.
25 | *
26 | */
27 |
28 |
29 |
30 | #if defined (ARMv8MML)
31 | #include "ARMv8MML.h"
32 | #elif defined (ARMv8MML_DSP)
33 | #include "ARMv8MML_DSP.h"
34 | #elif defined (ARMv8MML_SP)
35 | #include "ARMv8MML_SP.h"
36 | #elif defined (ARMv8MML_DSP_SP)
37 | #include "ARMv8MML_DSP_SP.h"
38 | #elif defined (ARMv8MML_DP)
39 | #include "ARMv8MML_DP.h"
40 | #elif defined (ARMv8MML_DSP_DP)
41 | #include "ARMv8MML_DSP_DP.h"
42 | #else
43 | #error device not specified!
44 | #endif
45 |
46 | #include
47 | #include "myRTOS.h"
48 | #include "mpu_defs.h"
49 | #include "mpu_configs.h"
50 |
51 | ThreadContext threadAContext;
52 | ThreadContext threadBContext;
53 |
54 |
55 | int main (void) {
56 |
57 | printf("Example Project: rtos_context_switch Start \n");
58 |
59 | initMPUConfigs();
60 |
61 | /* Create new threads */
62 | newThread(thrA, threadA_stk, &threadAContext, mpuCfgA, ID_THREAD_A);
63 | newThread(thrB, threadB_stk, &threadBContext, mpuCfgB, ID_THREAD_B);
64 |
65 | /* First thread to execute is Thread A. Hence, set the current context to Thread B,
66 | * so that it looks like as if Thread B was the last thread executed.
67 | * Now,the context switching routine handles thread A be executed up next. */
68 |
69 | currentContext = &threadBContext;
70 | __set_PSP((uint32_t)(currentContext -> sp));
71 | __set_PSPLIM ((uint32_t)(currentContext -> spLimit));
72 |
73 | startOS();
74 |
75 | return 0;
76 | }
77 |
--------------------------------------------------------------------------------
/Memory_model/rtos_context_switch/mpu_configs.h:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * MIT License
4 | * Copyright (c) 2022-2023 ARM Limited.
5 | *
6 | * SPDX-License-Identifier: MIT
7 | *
8 | * Permission is hereby granted, free of charge, to any person obtaining a copy
9 | * of this software and associated documentation files (the "Software"), to deal
10 | * in the Software without restriction, including without limitation the rights
11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | * copies of the Software, and to permit persons to whom the Software is
13 | * furnished to do so, subject to the following conditions:
14 | *
15 | * The above copyright notice and this permission notice shall be included in all
16 | * copies or substantial portions of the Software.
17 | *
18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 | * SOFTWARE.
25 | *
26 | */
27 |
28 |
29 | extern void initMPUConfigs();
30 |
31 | /* Memory region symbols extracted from scatter file*/
32 |
33 | extern unsigned int Image$$THREAD_A_ROM$$Base;
34 | extern unsigned int Image$$THREAD_A_ROM$$Limit;
35 | extern unsigned int Image$$THREAD_A_RAM$$Base;
36 | extern unsigned int Image$$THREAD_A_RAM$$ZI$$Limit;
37 |
38 | extern unsigned int Image$$THREAD_B_ROM$$Base;
39 | extern unsigned int Image$$THREAD_B_ROM$$Limit;
40 | extern unsigned int Image$$THREAD_B_RAM$$Base;
41 | extern unsigned int Image$$THREAD_B_RAM$$ZI$$Limit;
42 |
43 | extern unsigned int Image$$UNPRIV_ROM$$Base;
44 | extern unsigned int Image$$UNPRIV_ROM$$Limit;
45 | extern unsigned int Image$$UNPRIV_RAM$$Base;
46 | extern unsigned int Image$$ARM_LIB_HEAP$$ZI$$Limit;
47 |
--------------------------------------------------------------------------------
/Memory_model/rtos_context_switch/mpu_defs.h:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * MIT License
4 | * Copyright (c) 2022-2023 ARM Limited.
5 | *
6 | * SPDX-License-Identifier: MIT
7 | *
8 | * Permission is hereby granted, free of charge, to any person obtaining a copy
9 | * of this software and associated documentation files (the "Software"), to deal
10 | * in the Software without restriction, including without limitation the rights
11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | * copies of the Software, and to permit persons to whom the Software is
13 | * furnished to do so, subject to the following conditions:
14 | *
15 | * The above copyright notice and this permission notice shall be included in all
16 | * copies or substantial portions of the Software.
17 | *
18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 | * SOFTWARE.
25 | *
26 | */
27 |
28 |
29 | // These defines are used as input parameters for the ARM_MPU_RBAR macros in mpu_armv8.h (part of CMSIS-CORE).
30 |
31 | #define ARM_MPU_RO 1UL
32 | #define ARM_MPU_RW 0UL
33 | #define ARM_MPU_NON_PRIV 1UL
34 | #define ARM_MPU_PRIV 0UL
35 | #define ARM_MPU_XN 1UL
36 | #define ARM_MPU_EXEC 0UL
37 |
--------------------------------------------------------------------------------
/Memory_model/rtos_context_switch/mpu_prog.h:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * MIT License
4 | * Copyright (c) 2022-2023 ARM Limited.
5 | *
6 | * SPDX-License-Identifier: MIT
7 | *
8 | * Permission is hereby granted, free of charge, to any person obtaining a copy
9 | * of this software and associated documentation files (the "Software"), to deal
10 | * in the Software without restriction, including without limitation the rights
11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | * copies of the Software, and to permit persons to whom the Software is
13 | * furnished to do so, subject to the following conditions:
14 | *
15 | * The above copyright notice and this permission notice shall be included in all
16 | * copies or substantial portions of the Software.
17 | *
18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 | * SOFTWARE.
25 | *
26 | */
27 |
28 | /* Memory region symbols extacted from scatter file*/
29 |
30 | extern unsigned int Image$$ER_ROM$$Base;
31 | extern unsigned int Image$$ER_ROM$$Limit;
32 | extern unsigned int Image$$RW_RAM$$Base;
33 | extern unsigned int Image$$ARM_LIB_STACK$$ZI$$Limit;
34 |
35 | extern unsigned int Image$$UNPRIV_ROM$$Base;
36 | extern unsigned int Image$$UNPRIV_ROM$$Limit;
37 | extern unsigned int Image$$UNPRIV_RAM$$Base;
38 | extern unsigned int Image$$ARM_LIB_HEAP$$ZI$$Limit;
39 |
40 | int setMPU(void);
41 |
--------------------------------------------------------------------------------
/Memory_model/rtos_context_switch/mpu_reprog.c:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * MIT License
4 | * Copyright (c) 2022-2023 ARM Limited.
5 | *
6 | * SPDX-License-Identifier: MIT
7 | *
8 | * Permission is hereby granted, free of charge, to any person obtaining a copy
9 | * of this software and associated documentation files (the "Software"), to deal
10 | * in the Software without restriction, including without limitation the rights
11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | * copies of the Software, and to permit persons to whom the Software is
13 | * furnished to do so, subject to the following conditions:
14 | *
15 | * The above copyright notice and this permission notice shall be included in all
16 | * copies or substantial portions of the Software.
17 | *
18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 | * SOFTWARE.
25 | *
26 | */
27 |
28 |
29 | #if defined (ARMv8MML)
30 | #include "ARMv8MML.h"
31 | #elif defined (ARMv8MML_DSP)
32 | #include "ARMv8MML_DSP.h"
33 | #elif defined (ARMv8MML_SP)
34 | #include "ARMv8MML_SP.h"
35 | #elif defined (ARMv8MML_DSP_SP)
36 | #include "ARMv8MML_DSP_SP.h"
37 | #elif defined (ARMv8MML_DP)
38 | #include "ARMv8MML_DP.h"
39 | #elif defined (ARMv8MML_DSP_DP)
40 | #include "ARMv8MML_DSP_DP.h"
41 | #else
42 | #error device not specified!
43 | #endif
44 |
45 | #include "mpu_defs.h"
46 | #include "threadDefs.h"
47 | #include
48 | #include
49 | #include
50 |
51 |
52 | /**
53 | \brief Reconfigure MPU with new set of memory attributes
54 | \details Reprogram Base and limit address of MPU regions with new configuration
55 | \return 0, successfully set
56 | */
57 |
58 | int reprogMPU(MpuRegionCfg *mpuConf){
59 |
60 | for(unsigned int i = 0; i < MAX_MPU_REGIONS; i++){
61 |
62 | ARM_MPU_SetRegion(i,
63 | mpuConf[i].rbar,
64 | mpuConf[i].rlar
65 | );
66 |
67 | }
68 |
69 | __DSB();
70 |
71 | return 0;
72 | }
73 |
74 |
--------------------------------------------------------------------------------
/Memory_model/rtos_context_switch/mpu_reprog.h:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * MIT License
4 | * Copyright (c) 2022-2023 ARM Limited.
5 | *
6 | * SPDX-License-Identifier: MIT
7 | *
8 | * Permission is hereby granted, free of charge, to any person obtaining a copy
9 | * of this software and associated documentation files (the "Software"), to deal
10 | * in the Software without restriction, including without limitation the rights
11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | * copies of the Software, and to permit persons to whom the Software is
13 | * furnished to do so, subject to the following conditions:
14 | *
15 | * The above copyright notice and this permission notice shall be included in all
16 | * copies or substantial portions of the Software.
17 | *
18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 | * SOFTWARE.
25 | *
26 | */
27 |
28 |
29 | int reprogMPU(MpuRegionCfg *mpuConf);
30 |
--------------------------------------------------------------------------------
/Memory_model/rtos_context_switch/myRTOS.h:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * MIT License
4 | * Copyright (c) 2022-2023 ARM Limited.
5 | *
6 | * SPDX-License-Identifier: MIT
7 | *
8 | * Permission is hereby granted, free of charge, to any person obtaining a copy
9 | * of this software and associated documentation files (the "Software"), to deal
10 | * in the Software without restriction, including without limitation the rights
11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | * copies of the Software, and to permit persons to whom the Software is
13 | * furnished to do so, subject to the following conditions:
14 | *
15 | * The above copyright notice and this permission notice shall be included in all
16 | * copies or substantial portions of the Software.
17 | *
18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 | * SOFTWARE.
25 | *
26 | */
27 |
28 | #include
29 | #include "threadDefs.h"
30 |
31 | extern void startOS();
32 | extern int newThread(void * function, uint32_t * threadStackLim, ThreadContext *threadContext, MpuRegionCfg *mpuConf, unsigned int threadID);
33 | extern ThreadContext *currentContext;
34 |
--------------------------------------------------------------------------------
/Memory_model/rtos_context_switch/rtos_context_switch.rteconfig:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/Memory_model/rtos_context_switch/scripts/paddron.ds:
--------------------------------------------------------------------------------
1 | set elf load-segments-at-p_paddr on
--------------------------------------------------------------------------------
/Memory_model/rtos_context_switch/scripts/success.txt:
--------------------------------------------------------------------------------
1 | Example Project: rtos_context_switch Start
2 | Fibonacci number:
3 | Pentagonal number:
--------------------------------------------------------------------------------
/Memory_model/rtos_context_switch/threadA.c:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * MIT License
4 | * Copyright (c) 2022-2023 ARM Limited.
5 | *
6 | * SPDX-License-Identifier: MIT
7 | *
8 | * Permission is hereby granted, free of charge, to any person obtaining a copy
9 | * of this software and associated documentation files (the "Software"), to deal
10 | * in the Software without restriction, including without limitation the rights
11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | * copies of the Software, and to permit persons to whom the Software is
13 | * furnished to do so, subject to the following conditions:
14 | *
15 | * The above copyright notice and this permission notice shall be included in all
16 | * copies or substantial portions of the Software.
17 | *
18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 | * SOFTWARE.
25 | *
26 | */
27 |
28 | #include
29 | #include
30 |
31 | #include "threadDefs.h"
32 |
33 | uint32_t threadA_stk[THREAD_STACK_SIZE];
34 |
35 | uint32_t term1, term2;
36 | uint32_t fibo;
37 |
38 | /* This is Thread A, which calculates and prints the numbers in the Fibonacci sequence */
39 | void thrA (void) {
40 | term1 = 0;
41 | term2 = 1;
42 | fibo = 0;
43 |
44 | while(1){
45 |
46 | fibo = term1 + term2;
47 | term1 = term2;
48 | term2 = fibo;
49 | if(fibo > 0xFFFFFFF){
50 | term1 = 0;
51 | term2 = 1;
52 | fibo = 0;
53 | }
54 | printf("\nFibonacci number: %u \n", fibo);
55 |
56 | }
57 | }
58 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/Memory_model/rtos_context_switch/threadB.c:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * MIT License
4 | * Copyright (c) 2022-2023 ARM Limited.
5 | *
6 | * SPDX-License-Identifier: MIT
7 | *
8 | * Permission is hereby granted, free of charge, to any person obtaining a copy
9 | * of this software and associated documentation files (the "Software"), to deal
10 | * in the Software without restriction, including without limitation the rights
11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | * copies of the Software, and to permit persons to whom the Software is
13 | * furnished to do so, subject to the following conditions:
14 | *
15 | * The above copyright notice and this permission notice shall be included in all
16 | * copies or substantial portions of the Software.
17 | *
18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 | * SOFTWARE.
25 | *
26 | */
27 |
28 | #include
29 | #include
30 |
31 | #include "threadDefs.h"
32 |
33 | uint32_t threadB_stk[THREAD_STACK_SIZE];
34 |
35 | uint32_t pent;
36 | uint32_t idx_p;
37 |
38 |
39 | /* This is Thread B, which calculates and prints the numbers in the Pentagonal sequence */
40 | void thrB (void) {
41 | pent = 1;
42 | idx_p = 1;
43 |
44 | while(1){
45 |
46 | pent = (3*idx_p*idx_p - idx_p)/2;
47 | idx_p++;
48 | if(pent > 0xFFFFFFF){
49 | pent = 1;
50 | idx_p = 1;
51 | }
52 | printf("\nPentagonal number: %u \n", pent);
53 |
54 | // Uncomment to trigger MemManage fault
55 | // threadA_stk[1] = 0x0;
56 | }
57 |
58 | }
59 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/Memory_model/trap_access/.gitignore:
--------------------------------------------------------------------------------
1 | /Debug/
2 |
--------------------------------------------------------------------------------
/Memory_model/trap_access/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | trap_access
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder
10 | clean,full,incremental,
11 |
12 |
13 |
14 |
15 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
16 | full,incremental,
17 |
18 |
19 |
20 |
21 |
22 | com.arm.debug.ds.nature
23 | org.eclipse.cdt.core.cnature
24 | org.eclipse.cdt.managedbuilder.core.managedBuildNature
25 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
26 | com.arm.cmsis.pack.project.RteNature
27 |
28 |
29 |
--------------------------------------------------------------------------------
/Memory_model/trap_access/RTE/RTE_Components.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Auto generated Run-Time-Environment Component Configuration File
3 | * *** Do not modify ! ***
4 | *
5 | * Project: trap_access
6 | * RTE configuration: trap_access.rteconfig
7 | */
8 | #ifndef RTE_COMPONENTS_H
9 | #define RTE_COMPONENTS_H
10 |
11 | /*
12 | * Define the Device Header File:
13 | */
14 | #define CMSIS_device_header "ARMv8MML.h"
15 |
16 |
17 | #endif /* RTE_COMPONENTS_H */
18 |
--------------------------------------------------------------------------------
/Memory_model/trap_access/mpu_defs.h:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * MIT License
4 | * Copyright (c) 2022-2023 ARM Limited.
5 | *
6 | * SPDX-License-Identifier: MIT
7 | *
8 | * Permission is hereby granted, free of charge, to any person obtaining a copy
9 | * of this software and associated documentation files (the "Software"), to deal
10 | * in the Software without restriction, including without limitation the rights
11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | * copies of the Software, and to permit persons to whom the Software is
13 | * furnished to do so, subject to the following conditions:
14 | *
15 | * The above copyright notice and this permission notice shall be included in all
16 | * copies or substantial portions of the Software.
17 | *
18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 | * SOFTWARE.
25 | *
26 | */
27 |
28 |
29 | /* These defines are used as input parameters for the ARM_MPU_RBAR macros in mpu_armv8.h (part of CMSIS-CORE). */
30 |
31 | #define ARM_MPU_RO 1UL
32 | #define ARM_MPU_RW 0UL
33 | #define ARM_MPU_NON_PRIV 1UL
34 | #define ARM_MPU_PRIV 0UL
35 | #define ARM_MPU_EXEC 0UL
36 | #define ARM_MPU_XN 1UL
37 |
--------------------------------------------------------------------------------
/Memory_model/trap_access/mpu_prog.h:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * MIT License
4 | * Copyright (c) 2022-2023 ARM Limited.
5 | *
6 | * SPDX-License-Identifier: MIT
7 | *
8 | * Permission is hereby granted, free of charge, to any person obtaining a copy
9 | * of this software and associated documentation files (the "Software"), to deal
10 | * in the Software without restriction, including without limitation the rights
11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | * copies of the Software, and to permit persons to whom the Software is
13 | * furnished to do so, subject to the following conditions:
14 | *
15 | * The above copyright notice and this permission notice shall be included in all
16 | * copies or substantial portions of the Software.
17 | *
18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 | * SOFTWARE.
25 | *
26 | */
27 |
28 |
29 | /* Symbols extracted from scatter file for Arm Compiler 6 toolchain */
30 | extern unsigned int Image$$ER_ROM$$Base;
31 | extern unsigned int Image$$ER_ROM$$Limit;
32 | extern unsigned int Image$$RW_RAM$$Base;
33 | extern unsigned int Image$$ARM_LIB_STACK$$ZI$$Limit;
34 |
35 | int setMPU(void);
36 |
--------------------------------------------------------------------------------
/Memory_model/trap_access/scripts/paddron.ds:
--------------------------------------------------------------------------------
1 | set elf load-segments-at-p_paddr on
--------------------------------------------------------------------------------
/Memory_model/trap_access/scripts/success.txt:
--------------------------------------------------------------------------------
1 | Example Project: trap_access Start
2 | We are in the MemManage handler.
3 | MemManage Fault Address Register:
4 | SCB->MMFAR =
5 | MemManage Fault Status Register:
6 | SCB->CFSR->MMFSR =
7 | Example Project: trap_access End
--------------------------------------------------------------------------------
/Memory_model/trap_access/trap_access.rteconfig:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/security/basic-Non-secure-only-program/basic-Non-secure-only-program_ns/.gitignore:
--------------------------------------------------------------------------------
1 | /Debug/
2 |
--------------------------------------------------------------------------------
/security/basic-Non-secure-only-program/basic-Non-secure-only-program_ns/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | basic-Non-secure-only-program_ns
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder
10 | clean,full,incremental,
11 |
12 |
13 |
14 |
15 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
16 | full,incremental,
17 |
18 |
19 |
20 |
21 |
22 | org.eclipse.cdt.core.cnature
23 | org.eclipse.cdt.managedbuilder.core.managedBuildNature
24 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
25 | com.arm.cmsis.pack.project.RteNature
26 |
27 |
28 |
--------------------------------------------------------------------------------
/security/basic-Non-secure-only-program/basic-Non-secure-only-program_ns/.settings/language.settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/security/basic-Non-secure-only-program/basic-Non-secure-only-program_ns/RTE/RTE_Components.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Auto generated Run-Time-Environment Component Configuration File
3 | * *** Do not modify ! ***
4 | *
5 | * Project: no-secure-callback_ns
6 | * RTE configuration: no-secure-callback_ns.rteconfig
7 | */
8 | #ifndef RTE_COMPONENTS_H
9 | #define RTE_COMPONENTS_H
10 |
11 | /*
12 | * Define the Device Header File:
13 | */
14 | #define CMSIS_device_header "ARMv81MML_DSP_DP_MVE_FP.h"
15 |
16 |
17 | #endif /* RTE_COMPONENTS_H */
18 |
--------------------------------------------------------------------------------
/security/basic-Non-secure-only-program/basic-Non-secure-only-program_ns/basic-Non-secure-only-program_ns.rteconfig:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/security/basic-Non-secure-only-program/basic-Non-secure-only-program_ns/main_ns.c:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * MIT License
4 | * Copyright (c) 2025 ARM Limited.
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | *
24 | */
25 |
26 | #include
27 | #include
28 | #include
29 | #if defined (ARMv81MML_DSP_DP_MVE_FP)
30 | #include "ARMv81MML_DSP_DP_MVE_FP.h"
31 | #else
32 | #error device not specified!
33 | #endif
34 |
35 |
36 |
37 | int main(void)
38 | {
39 | printf("NS: hello from non-secure world \n");
40 | return 0;
41 | }
42 |
--------------------------------------------------------------------------------
/security/basic-Non-secure-only-program/basic-Non-secure-only-program_s/.gitignore:
--------------------------------------------------------------------------------
1 | /Debug/
2 |
--------------------------------------------------------------------------------
/security/basic-Non-secure-only-program/basic-Non-secure-only-program_s/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | basic-Non-secure-only-program_s
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder
10 | clean,full,incremental,
11 |
12 |
13 |
14 |
15 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
16 | full,incremental,
17 |
18 |
19 |
20 |
21 |
22 | org.eclipse.cdt.core.cnature
23 | org.eclipse.cdt.managedbuilder.core.managedBuildNature
24 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
25 | com.arm.cmsis.pack.project.RteNature
26 |
27 |
28 |
--------------------------------------------------------------------------------
/security/basic-Non-secure-only-program/basic-Non-secure-only-program_s/.settings/language.settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/security/basic-Non-secure-only-program/basic-Non-secure-only-program_s/RTE/RTE_Components.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Auto generated Run-Time-Environment Component Configuration File
3 | * *** Do not modify ! ***
4 | *
5 | * Project: no-secure-callback_s
6 | * RTE configuration: no-secure-callback_s.rteconfig
7 | */
8 | #ifndef RTE_COMPONENTS_H
9 | #define RTE_COMPONENTS_H
10 |
11 | /*
12 | * Define the Device Header File:
13 | */
14 | #define CMSIS_device_header "ARMv81MML_DSP_DP_MVE_FP.h"
15 |
16 |
17 | #endif /* RTE_COMPONENTS_H */
18 |
--------------------------------------------------------------------------------
/security/basic-Non-secure-only-program/basic-Non-secure-only-program_s/basic-Non-secure-only-program_s.rteconfig:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/security/basic-Non-secure-only-program/basic-Non-secure-only-program_s/main_s.c:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * MIT License
4 | * Copyright (c) 2025 ARM Limited.
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | *
24 | */
25 |
26 | #include
27 | #include
28 | #include
29 | #if defined (ARMv81MML_DSP_DP_MVE_FP)
30 | #include "ARMv81MML_DSP_DP_MVE_FP.h"
31 | #else
32 | #error device not specified!
33 | #endif
34 |
35 | /* VectorTable_NS: array of non-secure vector table */
36 | uint32_t *VectorTable_NS = (uint32_t *)0x00200000;
37 |
38 | /* typedef for non-secure callback functions */
39 | typedef void (*funcptr_void) (void) __attribute__((cmse_nonsecure_call));
40 |
41 | /* Secure main() */
42 | int32_t main(void) {
43 |
44 | funcptr_void NonSecure_ResetHandler;
45 |
46 | printf("S: hello from secure world \n");
47 |
48 | __TZ_set_MSP_NS((uint32_t)(VectorTable_NS[0]));
49 |
50 | /* Get non-secure reset handler from non-secure vector table */
51 | NonSecure_ResetHandler = (funcptr_void)(VectorTable_NS[1]);
52 |
53 | /* Start non-secure state software application */
54 | NonSecure_ResetHandler();
55 |
56 | return 0;
57 | }
58 |
--------------------------------------------------------------------------------
/security/basic-Non-secure-only-program/basic-Non-secure-only-program_s/region_defs.h:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * MIT License
4 | * Copyright (c) 2025 ARM Limited.
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | *
24 | */
25 | #ifndef REGION_DEFS_H
26 | #define REGION_DEFS_H
27 |
28 | /*--------------------- Flash Configuration ----------------------------------*/
29 |
30 | #define __ROM_BASE_S 0x10000000
31 | #define __ROM_SIZE_S 0x00200000
32 |
33 | /*--------------------- Embedded RAM Configuration ---------------------------*/
34 |
35 | #define __RAM_BASE_S 0x30000000
36 | #define __RAM_SIZE_S 0x00200000
37 |
38 | /*--------------------- Stack / Heap Configuration ---------------------------*/
39 |
40 | #define __STACK_SIZE 0x00000400
41 | #define __HEAP_SIZE 0x00000C00
42 |
43 |
44 | #define __CMSEVENEER_BASE 0x101FFC00 // NSC region
45 | #define __CMSEVENEER_SIZE 0x00000400
46 |
47 |
48 | #define __ROM_BASE_NS 0x00200000
49 | #define __ROM_SIZE_NS 0x00200000
50 |
51 |
52 | #define __RAM_BASE_NS 0x20200000
53 | #define __RAM_SIZE_NS 0x00200000
54 |
55 |
56 | #endif
57 |
--------------------------------------------------------------------------------
/security/basic-Non-secure-only-program/scripts/build_gcc.sh:
--------------------------------------------------------------------------------
1 | cd projects/m-profile/security/basic-Non-secure-only-program
2 | CMSIS=../../../../CMSIS_5
3 | RTE_S=basic-Non-secure-only-program_s/RTE/Device/ARMv81MML_DSP_DP_MVE_FP
4 | RTE_NS=basic-Non-secure-only-program_ns/RTE/Device/ARMv81MML_DSP_DP_MVE_FP
5 | INCLUDES_S="-I basic-Non-secure-only-program_s -I $RTE_S -I $CMSIS/Device/ARM/ARMv81MML/Include -I $CMSIS/CMSIS/Core/Include -I ."
6 | INCLUDES_NS="-I basic-Non-secure-only-program_ns -I $RTE_NS -I $CMSIS/Device/ARM/ARMv81MML/Include -I $CMSIS/CMSIS/Core/Include -I ."
7 |
8 |
9 | while getopts "c:" opt; do
10 | case "$opt" in
11 | c) COMPILER="$OPTARG";;
12 | esac
13 | done
14 |
15 | echo "Cleaning old files..."
16 | rm -f -v logs/*
17 | echo "Compiling secure main_s.c..."
18 | $COMPILER/arm-none-eabi-gcc -march=armv8.1-m.main+mve.fp+fp.dp -DARMv81MML_DSP_DP_MVE_FP -mfloat-abi=hard -mthumb -mcmse -O1 -g -mfpu=fpv5-sp-d16 -c basic-Non-secure-only-program_s/main_s.c -o logs/main_s.o $INCLUDES_S
19 | echo "Compiling secure startup file..."
20 | $COMPILER/arm-none-eabi-gcc -march=armv8.1-m.main+mve.fp+fp.dp -DARMv81MML_DSP_DP_MVE_FP -O1 -g -mfloat-abi=hard -mthumb -mcmse -c $RTE_S/startup_ARMv81MML.c -o logs/startup_s.o $INCLUDES_S
21 | echo "Compiling secure system file..."
22 | $COMPILER/arm-none-eabi-gcc -march=armv8.1-m.main+mve.fp+fp.dp -DARMv81MML_DSP_DP_MVE_FP -O1 -g -mfloat-abi=hard -mthumb -mcmse -c $RTE_S/system_ARMv81MML.c -o logs/system_s.o $INCLUDES_S
23 | echo "Compiling non-secure main_ns.c..."
24 | $COMPILER/arm-none-eabi-gcc -march=armv8.1-m.main+mve.fp+fp.dp -DARMv81MML_DSP_DP_MVE_FP -mfloat-abi=hard -O1 -g -mfpu=fpv5-sp-d16 -c basic-Non-secure-only-program_ns/main_ns.c -o logs/main_ns.o $INCLUDES_NS
25 | echo "Compiling non-secure startup file..."
26 | $COMPILER/arm-none-eabi-gcc -march=armv8.1-m.main+mve.fp+fp.dp -DARMv81MML_DSP_DP_MVE_FP -O1 -g -mfloat-abi=hard -c $RTE_NS/startup_ARMv81MML.c -o logs/startup_ns.o $INCLUDES_NS
27 | echo "Compiling non-secure system file..."
28 | $COMPILER/arm-none-eabi-gcc -march=armv8.1-m.main+mve.fp+fp.dp -DARMv81MML_DSP_DP_MVE_FP -O1 -g -mfloat-abi=hard -c $RTE_NS/system_ARMv81MML.c -o logs/system_ns.o $INCLUDES_NS
29 | echo "Linking secure image..."
30 | $COMPILER/arm-none-eabi-gcc -march=armv8.1-m.main+mve.fp+fp.dp -mfloat-abi=hard -mfpu=fpv5-sp-d16 --entry=Reset_Handler -T scripts/gcc_arm_s.ld -Wl,--gc-sections --specs=rdimon.specs logs/startup_s.o logs/system_s.o logs/main_s.o -o logs/basic-Non-secure-only-program_s.axf
31 | echo "Linking non-secure image..."
32 | $COMPILER/arm-none-eabi-gcc -march=armv8.1-m.main+mve.fp+fp.dp -mfloat-abi=hard -mfpu=fpv5-sp-d16 --entry=Reset_Handler -T scripts/gcc_arm_ns.ld -Wl,--gc-sections --specs=rdimon.specs logs/startup_ns.o logs/system_ns.o logs/main_ns.o -o logs/basic-Non-secure-only-program_ns.axf
33 | echo "Images built. Use \"make run search=basic-Non-secure-only-program\" to run the example on an FVP."
34 |
--------------------------------------------------------------------------------
/security/basic-Non-secure-only-program/scripts/gcc_arm_s.ld:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ARM-software/m-profile-user-guide-examples/1c961a98d1f5e8e92b7142403a2722d2e52be624/security/basic-Non-secure-only-program/scripts/gcc_arm_s.ld
--------------------------------------------------------------------------------
/security/basic-Non-secure-only-program/scripts/run.sh:
--------------------------------------------------------------------------------
1 | cd projects/m-profile/security/basic-Non-secure-only-program
2 |
3 | while getopts "f:k:" opt; do
4 | case "$opt" in
5 | f) FVP="$OPTARG";;
6 | k) KILLTIME="$OPTARG";;
7 | esac
8 | done
9 |
10 | $FVP/FVP_MPS2_Cortex-M55 -C fvp_mps2.DISABLE_GATING=1 -C NSC_CFG_0=1 -C cpu0.INITNSVTOR=0x00200000 -C cpu0.semihosting-heap_base=0x0 -C cpu0.semihosting-heap_limit=0x0 -C cpu0.semihosting-stack_base=0x0 -C cpu0.semihosting-stack_limit=0x0 -a logs/basic-Non-secure-only-program_ns.axf -a logs/basic-Non-secure-only-program_s.axf --stat -T $KILLTIME
11 |
12 |
--------------------------------------------------------------------------------
/security/basic-Non-secure-only-program/scripts/run_tarmac.sh:
--------------------------------------------------------------------------------
1 | cd projects/m-profile/security/basic-Non-secure-only-program
2 |
3 | while getopts "f:t:k:" opt; do
4 | case "$opt" in
5 | f) FVP="$OPTARG";;
6 | t) TARMAC="$OPTARG";;
7 | k) KILLTIME="$OPTARG";;
8 | esac
9 | done
10 |
11 | $FVP/FVP_MPS2_Cortex-M55 -C fvp_mps2.DISABLE_GATING=1 -C NSC_CFG_0=1 -C cpu0.INITNSVTOR=0x00200000 -a logs/basic-Non-secure-only-program_ns.axf -a logs/basic-Non-secure-only-program_s.axf --stat --plugin $TARMAC -C TRACE.TarmacTrace.trace-file=logs/tarmac.log -T $KILLTIME
12 |
--------------------------------------------------------------------------------
/security/basic-Non-secure-only-program/scripts/success.txt:
--------------------------------------------------------------------------------
1 | NS:
2 | S: hello from secure world
3 | NS: hello from non-secure world
--------------------------------------------------------------------------------
/security/exception-across-security-state/exception-across-security-state_ns/.gitignore:
--------------------------------------------------------------------------------
1 | /Debug/
2 |
--------------------------------------------------------------------------------
/security/exception-across-security-state/exception-across-security-state_ns/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | exception-across-security-state_ns
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder
10 | clean,full,incremental,
11 |
12 |
13 |
14 |
15 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
16 | full,incremental,
17 |
18 |
19 |
20 |
21 |
22 | org.eclipse.cdt.core.cnature
23 | org.eclipse.cdt.managedbuilder.core.managedBuildNature
24 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
25 | com.arm.cmsis.pack.project.RteNature
26 |
27 |
28 |
--------------------------------------------------------------------------------
/security/exception-across-security-state/exception-across-security-state_ns/.settings/language.settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/security/exception-across-security-state/exception-across-security-state_ns/IRQconfig_ns.h:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * MIT License
4 | * Copyright (c) 2025 ARM Limited.
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | *
24 | */
25 |
26 | #ifndef CALLBACK_NS_H
27 | #define CALLBACK_NS_H
28 |
29 | #include
30 |
31 | void NS_Exception_Config();
32 | void read_secure_data();
33 |
34 | #endif
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/security/exception-across-security-state/exception-across-security-state_ns/RTE/RTE_Components.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Auto generated Run-Time-Environment Component Configuration File
3 | * *** Do not modify ! ***
4 | *
5 | * Project: exception-across-security-state_ns
6 | * RTE configuration: exception-across-security-state_ns.rteconfig
7 | */
8 | #ifndef RTE_COMPONENTS_H
9 | #define RTE_COMPONENTS_H
10 |
11 | /*
12 | * Define the Device Header File:
13 | */
14 | #define CMSIS_device_header "ARMv81MML_DSP_DP_MVE_FP.h"
15 |
16 |
17 | #endif /* RTE_COMPONENTS_H */
18 |
--------------------------------------------------------------------------------
/security/exception-across-security-state/exception-across-security-state_ns/exceptions-across-security-states_ns.rteconfig:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/security/exception-across-security-state/exception-across-security-state_ns/interface.h:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * MIT License
4 | * Copyright (c) 2025 ARM Limited.
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | *
24 | */
25 |
26 | #include
27 |
28 | /* typedef for function pointer type */
29 | typedef void (*funcptr)(int32_t);
30 |
31 |
32 | void ns_callable_pend_IRQs();
33 | void Print_PendAndActiveStatus(void);
34 |
35 |
--------------------------------------------------------------------------------
/security/exception-across-security-state/exception-across-security-state_ns/main_ns.c:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * MIT License
4 | * Copyright (c) 2025 ARM Limited.
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | *
24 | */
25 |
26 |
27 | #include
28 | #include "interface.h"
29 | #include "IRQconfig_ns.h"
30 |
31 | int main(void)
32 | {
33 | /* ===========================================
34 | * This Non-secure example aims to show exception handling across the security state
35 | * Implement trigger exception at non-secure world and print the status of exceptions
36 | * and state
37 | =========================================== */
38 | NS_Exception_Config();
39 | ns_callable_pend_IRQs();
40 | return 0;
41 | }
42 |
--------------------------------------------------------------------------------
/security/exception-across-security-state/exception-across-security-state_s/.gitignore:
--------------------------------------------------------------------------------
1 | /Debug/
2 |
--------------------------------------------------------------------------------
/security/exception-across-security-state/exception-across-security-state_s/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | exception-across-security-state_s
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder
10 | clean,full,incremental,
11 |
12 |
13 |
14 |
15 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
16 | full,incremental,
17 |
18 |
19 |
20 |
21 |
22 | org.eclipse.cdt.core.cnature
23 | org.eclipse.cdt.managedbuilder.core.managedBuildNature
24 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
25 | com.arm.cmsis.pack.project.RteNature
26 |
27 |
28 |
--------------------------------------------------------------------------------
/security/exception-across-security-state/exception-across-security-state_s/.settings/language.settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/security/exception-across-security-state/exception-across-security-state_s/RTE/RTE_Components.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Auto generated Run-Time-Environment Component Configuration File
3 | * *** Do not modify ! ***
4 | *
5 | * Project: exception-across-security-state_s
6 | * RTE configuration: exception-across-security-state_s.rteconfig
7 | */
8 | #ifndef RTE_COMPONENTS_H
9 | #define RTE_COMPONENTS_H
10 |
11 | /*
12 | * Define the Device Header File:
13 | */
14 | #define CMSIS_device_header "ARMv81MML_DSP_DP_MVE_FP.h"
15 |
16 |
17 | #endif /* RTE_COMPONENTS_H */
18 |
--------------------------------------------------------------------------------
/security/exception-across-security-state/exception-across-security-state_s/exceptions-across-security-states_s.rteconfig:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/security/exception-across-security-state/exception-across-security-state_s/init.h:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * MIT License
4 | * Copyright (c) 2025 ARM Limited.
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | *
24 | */
25 | #ifndef INIT_H
26 | #define INIT_H
27 |
28 |
29 | /*CPPWR: SUS10 Position */
30 | #define SCnSCB_CPPWR_SUS10_Pos 21U
31 |
32 | /*CPPWR: SUS10 Enable: the SU10 field is only accessible from the Secure state.*/
33 | #define SCnSCB_CPPWR_SUS10_Msk (1UL << SCnSCB_CPPWR_SUS10_Pos)
34 |
35 | /*CPPWR: SUS11 Position */
36 | #define SCnSCB_CPPWR_SUS11_Pos 23U
37 |
38 | /*CPPWR: SUS11 Enable: the SU11 field is only accessible from the Secure state.*/
39 | #define SCnSCB_CPPWR_SUS11_Msk (1UL << SCnSCB_CPPWR_SUS11_Pos)
40 |
41 | /* Set 1 in each bit to target each interrupt to Secure*/
42 | #define NVIC_INIT_SECURE_VAL 0XFFFFFFFF
43 |
44 | /* Symbols extracted from scatter file for Arm Compiler 6 toolchain and linker script for
45 | * GNU toolchain */
46 | extern int32_t Image$$ER_CMSE_VENEER$$Base;
47 | extern int32_t Image$$ER_CMSE_VENEER$$Limit;
48 |
49 | extern int32_t Image$$PSP_STACK$$ZI$$Limit;
50 | extern int32_t Image$$PSP_STACK$$ZI$$Base;
51 | extern int32_t Image$$PSP_STACKSEAL$$Base;
52 |
53 | /* PSP Stack address*/
54 | #define INITIAL_PSP Image$$PSP_STACK$$ZI$$Limit
55 |
56 | #define PSP_STACK_LIMIT Image$$PSP_STACK$$ZI$$Base
57 |
58 | #define PSP_STACK_SEAL Image$$PSP_STACKSEAL$$Base
59 |
60 |
61 | void Secure_System_Init();
62 |
63 | #endif /* INIT_H */
64 |
--------------------------------------------------------------------------------
/security/exception-across-security-state/exception-across-security-state_s/interface.h:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * MIT License
4 | * Copyright (c) 2025 ARM Limited.
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | *
24 | */
25 |
26 | #include
27 |
28 | /* typedef for function pointer type */
29 | typedef void (*funcptr)(int32_t);
30 |
31 | #define get_state (cmse_nonsecure_caller()==0? "S": "NS")
32 |
33 | void ns_callable_pend_IRQs();
34 | void Print_PendAndActiveStatus(void);
35 |
36 |
37 |
--------------------------------------------------------------------------------
/security/exception-across-security-state/exception-across-security-state_s/main_s.c:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * MIT License
4 | * Copyright (c) 2025 ARM Limited.
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | *
24 | */
25 |
26 | #include
27 | #include
28 | #include
29 | #if defined (ARMv81MML_DSP_DP_MVE_FP)
30 | #include "ARMv81MML_DSP_DP_MVE_FP.h"
31 | #else
32 | #error device not specified!
33 | #endif
34 | #include "init.h"
35 | #include "interface.h"
36 |
37 |
38 | /* VectorTable_NS: array of non-secure vector table */
39 | uint32_t *VectorTable_NS = (uint32_t *)0x00200000;
40 |
41 | /* typedef for non-secure callback functions */
42 | typedef void (*funcptr_void) (void) __attribute__((cmse_nonsecure_call));
43 |
44 |
45 | /* Secure main() */
46 | int32_t main(void) {
47 |
48 | /* ===========================================
49 | * This Secure example aims to show exceptions handling between Secure and Non-secure states
50 | * Set up Secure system configuration
51 | * Implement Secure function ns_callable_pend_IRQs(), Print_PendAndActiveStatus()
52 | * Branch from Secure to Non-secure image
53 | * In Non-secure state, it triggers secure exceptions and non-secure exceptions firstly
54 | * in different cases
55 | * =========================================== */
56 |
57 | funcptr_void NonSecure_ResetHandler;
58 | printf("Example Project: exception-across-security-state Start\n");
59 |
60 | printf("S: Hello World in Secure State \n");
61 |
62 | /* Add user setup code for Secure part here*/
63 | Secure_System_Init();
64 |
65 | __TZ_set_MSP_NS((uint32_t)(VectorTable_NS[0]));
66 | SCB_NS->VTOR = (uint32_t)VectorTable_NS;
67 |
68 | /* Get Non-secure reset handler address from Non-secure vector table */
69 | NonSecure_ResetHandler = (funcptr_void)(VectorTable_NS[1]);
70 |
71 | /* Start Non-secure state software application */
72 | NonSecure_ResetHandler();
73 |
74 | return 0;
75 | }
76 |
--------------------------------------------------------------------------------
/security/exception-across-security-state/exception-across-security-state_s/region_defs.h:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * MIT License
4 | * Copyright (c) 2025 ARM Limited.
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | *
24 | */
25 | #ifndef REGION_DEFS_H
26 | #define REGION_DEFS_H
27 |
28 | /*--------------------- Secure Flash Configuration ----------------------------------*/
29 |
30 | #define __ROM_BASE_S 0x10000000
31 | #define __ROM_SIZE_S 0x00200000
32 |
33 | /*--------------------- Secure RAM Configuration ---------------------------*/
34 |
35 | #define __RAM_BASE_S 0x30000000
36 | #define __RAM_SIZE_S 0x00200000
37 |
38 | /*--------------------- Secure Stack / Heap Configuration ---------------------------*/
39 | #define __STACK_SIZE 0x00000400
40 | #define __HEAP_SIZE 0x00000C00
41 | #define __PSP_STACK_SIZE 0x00000400
42 |
43 | /*--------------------- Secure NSC Region Configuration ---------------------------*/
44 | #define __CMSEVENEER_BASE 0x101FFC00
45 | #define __CMSEVENEER_SIZE 0x00000400
46 |
47 | /*--------------------- Non-secure ROM Region Configuration ---------------------------*/
48 | #define __ROM_BASE_NS 0x00200000
49 | #define __ROM_SIZE_NS 0x00200000
50 |
51 | /*--------------------- NOn-secure RAM Region Configuration ---------------------------*/
52 | #define __RAM_BASE_NS 0x20200000
53 | #define __RAM_SIZE_NS 0x00200000
54 |
55 |
56 | #endif
57 |
--------------------------------------------------------------------------------
/security/exception-across-security-state/scripts/gcc_arm_s.ld:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ARM-software/m-profile-user-guide-examples/1c961a98d1f5e8e92b7142403a2722d2e52be624/security/exception-across-security-state/scripts/gcc_arm_s.ld
--------------------------------------------------------------------------------
/security/exception-across-security-state/scripts/run.sh:
--------------------------------------------------------------------------------
1 | cd projects/m-profile/security/exception-across-security-state
2 |
3 | while getopts "f:k:" opt; do
4 | case "$opt" in
5 | f) FVP="$OPTARG";;
6 | k) KILLTIME="$OPTARG";;
7 | esac
8 | done
9 |
10 | $FVP/FVP_MPS2_Cortex-M55 -C fvp_mps2.DISABLE_GATING=1 -C NSC_CFG_0=1 -C cpu0.INITNSVTOR=0x00200000 -C cpu0.semihosting-heap_base=0x0 -C cpu0.semihosting-heap_limit=0x0 -C cpu0.semihosting-stack_base=0x0 -C cpu0.semihosting-stack_limit=0x0 -a logs/exception-across-security-state_ns.axf -a logs/exception-across-security-state_s.axf --stat -T $KILLTIME
11 |
--------------------------------------------------------------------------------
/security/exception-across-security-state/scripts/run_tarmac.sh:
--------------------------------------------------------------------------------
1 | cd projects/m-profile/security/exception-across-security-state
2 | while getopts "f:k:" opt; do
3 | case "$opt" in
4 | f) FVP="$OPTARG";;
5 | k) KILLTIME="$OPTARG";;
6 | esac
7 | done
8 |
9 | $FVP/FVP_MPS2_Cortex-M55 -C fvp_mps2.DISABLE_GATING=1 -C NSC_CFG_0=1 -a logs/exception-across-security-state_ns.axf -a logs/exception-across-security-state_s.axf --stat -T $KILLTIME
10 |
11 |
--------------------------------------------------------------------------------
/security/exception-across-security-state/scripts/success.txt:
--------------------------------------------------------------------------------
1 | Example Project: exception-across-security-state Start
2 | S: Hello World in Secure State
3 |
4 | NS: Case1: start !
5 | S: The number of the highest priority pending exception is 16
6 | S: There is only one active exception.
7 | S: The number of the highest priority active exception is 17
8 | NS: There is only one active exception.
9 | NS: The number of the highest priority active exception is 16
10 |
--------------------------------------------------------------------------------
/security/hello-world-in-security-states/hello-world-in-security-states_ns/.gitignore:
--------------------------------------------------------------------------------
1 | /Debug/
2 |
--------------------------------------------------------------------------------
/security/hello-world-in-security-states/hello-world-in-security-states_ns/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | hello-world-in-security-states_ns
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder
10 | clean,full,incremental,
11 |
12 |
13 |
14 |
15 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
16 | full,incremental,
17 |
18 |
19 |
20 |
21 |
22 | org.eclipse.cdt.core.cnature
23 | org.eclipse.cdt.managedbuilder.core.managedBuildNature
24 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
25 | com.arm.cmsis.pack.project.RteNature
26 |
27 |
28 |
--------------------------------------------------------------------------------
/security/hello-world-in-security-states/hello-world-in-security-states_ns/.settings/language.settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/security/hello-world-in-security-states/hello-world-in-security-states_ns/RTE/RTE_Components.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Auto generated Run-Time-Environment Component Configuration File
3 | * *** Do not modify ! ***
4 | *
5 | * Project: hello-world-in-security-states_ns
6 | * RTE configuration: hello-world-in-security-states_ns.rteconfig
7 | */
8 | #ifndef RTE_COMPONENTS_H
9 | #define RTE_COMPONENTS_H
10 |
11 | /*
12 | * Define the Device Header File:
13 | */
14 | #define CMSIS_device_header "ARMv81MML_DSP_DP_MVE_FP.h"
15 |
16 |
17 | #endif /* RTE_COMPONENTS_H */
18 |
--------------------------------------------------------------------------------
/security/hello-world-in-security-states/hello-world-in-security-states_ns/hello-world-in-security-states-CMSE-Lib.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ARM-software/m-profile-user-guide-examples/1c961a98d1f5e8e92b7142403a2722d2e52be624/security/hello-world-in-security-states/hello-world-in-security-states_ns/hello-world-in-security-states-CMSE-Lib.o
--------------------------------------------------------------------------------
/security/hello-world-in-security-states/hello-world-in-security-states_ns/hello-world-in-security-states_ns.rteconfig:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/security/hello-world-in-security-states/hello-world-in-security-states_ns/interface.h:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * MIT License
4 | * Copyright (c) 2025 ARM Limited.
5 | *
6 | *
7 | * Permission is hereby granted, free of charge, to any person obtaining a copy
8 | * of this software and associated documentation files (the "Software"), to deal
9 | * in the Software without restriction, including without limitation the rights
10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | * copies of the Software, and to permit persons to whom the Software is
12 | * furnished to do so, subject to the following conditions:
13 | *
14 | * The above copyright notice and this permission notice shall be included in all
15 | * copies or substantial portions of the Software.
16 | *
17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 | * SOFTWARE.
24 | *
25 | */
26 |
27 | #ifndef INTERFACE_H
28 | #define INTERFACE_H
29 |
30 | void simple_secure_lib_call_from_nonsecure();
31 |
32 | #endif
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/security/hello-world-in-security-states/hello-world-in-security-states_ns/main_ns.c:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * MIT License
4 | * Copyright (c) 2025 ARM Limited.
5 | *
6 | *
7 | * Permission is hereby granted, free of charge, to any person obtaining a copy
8 | * of this software and associated documentation files (the "Software"), to deal
9 | * in the Software without restriction, including without limitation the rights
10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | * copies of the Software, and to permit persons to whom the Software is
12 | * furnished to do so, subject to the following conditions:
13 | *
14 | * The above copyright notice and this permission notice shall be included in all
15 | * copies or substantial portions of the Software.
16 | *
17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 | * SOFTWARE.
24 | *
25 | */
26 |
27 | #include
28 | #include
29 | #if defined (ARMv81MML_DSP_DP_MVE_FP)
30 | #include "ARMv81MML_DSP_DP_MVE_FP.h"
31 | #else
32 | #error device not specified!
33 | #endif
34 | #include "interface.h"
35 |
36 |
37 |
38 | int main(void)
39 | {
40 | /* The Non-secure example call secure function */
41 | printf("NS: Hello World in Non-secure State \n");
42 |
43 | /* call secure function */
44 | simple_secure_lib_call_from_nonsecure();
45 |
46 | printf("Example Project: hello-world-in-security-states End\n");
47 |
48 | return 0;
49 | }
50 |
--------------------------------------------------------------------------------
/security/hello-world-in-security-states/hello-world-in-security-states_s/.gitignore:
--------------------------------------------------------------------------------
1 | /Debug/
2 |
--------------------------------------------------------------------------------
/security/hello-world-in-security-states/hello-world-in-security-states_s/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | hello-world-in-security-states_s
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder
10 | clean,full,incremental,
11 |
12 |
13 |
14 |
15 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
16 | full,incremental,
17 |
18 |
19 |
20 |
21 |
22 | org.eclipse.cdt.core.cnature
23 | org.eclipse.cdt.managedbuilder.core.managedBuildNature
24 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
25 | com.arm.cmsis.pack.project.RteNature
26 |
27 |
28 |
--------------------------------------------------------------------------------
/security/hello-world-in-security-states/hello-world-in-security-states_s/.settings/language.settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/security/hello-world-in-security-states/hello-world-in-security-states_s/RTE/RTE_Components.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Auto generated Run-Time-Environment Component Configuration File
3 | * *** Do not modify ! ***
4 | *
5 | * Project: hello-world-in-security-states_s
6 | * RTE configuration: hello-world-in-security-states_s.rteconfig
7 | */
8 | #ifndef RTE_COMPONENTS_H
9 | #define RTE_COMPONENTS_H
10 |
11 | /*
12 | * Define the Device Header File:
13 | */
14 | #define CMSIS_device_header "ARMv81MML_DSP_DP_MVE_FP.h"
15 |
16 |
17 | #endif /* RTE_COMPONENTS_H */
18 |
--------------------------------------------------------------------------------
/security/hello-world-in-security-states/hello-world-in-security-states_s/hello-world-in-security-states_s.rteconfig:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/security/hello-world-in-security-states/hello-world-in-security-states_s/init.h:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * MIT License
4 | * Copyright (c) 2025 ARM Limited.
5 | *
6 | *
7 | * Permission is hereby granted, free of charge, to any person obtaining a copy
8 | * of this software and associated documentation files (the "Software"), to deal
9 | * in the Software without restriction, including without limitation the rights
10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | * copies of the Software, and to permit persons to whom the Software is
12 | * furnished to do so, subject to the following conditions:
13 | *
14 | * The above copyright notice and this permission notice shall be included in all
15 | * copies or substantial portions of the Software.
16 | *
17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 | * SOFTWARE.
24 | *
25 | */
26 | #ifndef INIT_H
27 | #define INIT_H
28 | #include "region_defs.h"
29 |
30 |
31 |
32 | /*SecureFault priority value*/
33 | #define SecureFaultPriority 0
34 |
35 | /* Set 1 in each bit to target each interrupt to Secure*/
36 | #define NVIC_INIT_SECURE_VAL 0xFFFFFFFF
37 |
38 |
39 |
40 | /* Symbols extracted from scatter file for Arm Compiler 6 and linker script for GNU toolchain */
41 | extern int32_t Image$$ER_CMSE_VENEER$$Base;
42 | extern int32_t Image$$ER_CMSE_VENEER$$Limit;
43 | extern int32_t Image$$PSP_STACK$$ZI$$Limit;
44 | extern int32_t Image$$PSP_STACK$$ZI$$Base;
45 | extern int32_t Image$$PSP_STACKSEAL$$Base;
46 |
47 |
48 | /* PSP Stack address*/
49 | #define INITIAL_PSP Image$$PSP_STACK$$ZI$$Limit
50 |
51 | #define PSP_STACK_LIMIT Image$$PSP_STACK$$ZI$$Base
52 |
53 | #define PSP_STACK_SEAL Image$$PSP_STACKSEAL$$Base
54 |
55 |
56 | void Secure_System_Init();
57 |
58 | #endif /* INIT_H */
59 |
--------------------------------------------------------------------------------
/security/hello-world-in-security-states/hello-world-in-security-states_s/interface.h:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * MIT License
4 | * Copyright (c) 2025 ARM Limited.
5 | *
6 | *
7 | * Permission is hereby granted, free of charge, to any person obtaining a copy
8 | * of this software and associated documentation files (the "Software"), to deal
9 | * in the Software without restriction, including without limitation the rights
10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | * copies of the Software, and to permit persons to whom the Software is
12 | * furnished to do so, subject to the following conditions:
13 | *
14 | * The above copyright notice and this permission notice shall be included in all
15 | * copies or substantial portions of the Software.
16 | *
17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 | * SOFTWARE.
24 | *
25 | */
26 |
27 | #ifndef INTERFACE_H
28 | #define INTERFACE_H
29 |
30 | void simple_secure_lib_call_from_nonsecure();
31 |
32 | #endif
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/security/hello-world-in-security-states/hello-world-in-security-states_s/region_defs.h:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * MIT License
4 | * Copyright (c) 2025 ARM Limited.
5 | *
6 | *
7 | * Permission is hereby granted, free of charge, to any person obtaining a copy
8 | * of this software and associated documentation files (the "Software"), to deal
9 | * in the Software without restriction, including without limitation the rights
10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | * copies of the Software, and to permit persons to whom the Software is
12 | * furnished to do so, subject to the following conditions:
13 | *
14 | * The above copyright notice and this permission notice shall be included in all
15 | * copies or substantial portions of the Software.
16 | *
17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 | * SOFTWARE.
24 | *
25 | */
26 | #ifndef REGION_DEFS_H
27 | #define REGION_DEFS_H
28 |
29 | /*--------------------- Secure Flash Configuration ----------------------------------*/
30 |
31 | #define __ROM_BASE_S 0x10000000
32 | #define __ROM_SIZE_S 0x00200000
33 |
34 | /*--------------------- Secure RAM Configuration ---------------------------*/
35 |
36 | #define __RAM_BASE_S 0x30000000
37 | #define __RAM_SIZE_S 0x00200000
38 |
39 | /*--------------------- Secure Stack / Heap Configuration ---------------------------*/
40 | #define __STACK_SIZE 0x00000400
41 | #define __HEAP_SIZE 0x00000C00
42 | #define __PSP_STACK_SIZE 0x00000400
43 |
44 | /*--------------------- Secure NSC Region Configuration ---------------------------*/
45 | #define __CMSEVENEER_BASE 0x101FFC00
46 | #define __CMSEVENEER_SIZE 0x00000400
47 |
48 | /*--------------------- Non-secure ROM Region Configuration ---------------------------*/
49 | #define __ROM_BASE_NS 0x00200000
50 | #define __ROM_SIZE_NS 0x00200000
51 |
52 | /*--------------------- NOn-secure RAM Region Configuration ---------------------------*/
53 | #define __RAM_BASE_NS 0x20200000
54 | #define __RAM_SIZE_NS 0x00200000
55 |
56 |
57 | #endif
58 |
--------------------------------------------------------------------------------
/security/hello-world-in-security-states/scripts/gcc_arm_s.ld:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ARM-software/m-profile-user-guide-examples/1c961a98d1f5e8e92b7142403a2722d2e52be624/security/hello-world-in-security-states/scripts/gcc_arm_s.ld
--------------------------------------------------------------------------------
/security/hello-world-in-security-states/scripts/run.sh:
--------------------------------------------------------------------------------
1 | cd projects/m-profile/security/hello-world-in-security-states
2 |
3 | while getopts "f:k:" opt; do
4 | case "$opt" in
5 | f) FVP="$OPTARG";;
6 | k) KILLTIME="$OPTARG";;
7 | esac
8 | done
9 |
10 | $FVP/FVP_MPS2_Cortex-M55 -C fvp_mps2.DISABLE_GATING=1 -C NSC_CFG_0=1 -C cpu0.INITNSVTOR=0x00200000 -C cpu0.semihosting-heap_base=0x0 -C cpu0.semihosting-heap_limit=0x0 -C cpu0.semihosting-stack_base=0x0 -C cpu0.semihosting-stack_limit=0x0 -a logs/hello-world-in-security-states_ns.axf -a logs/hello-world-in-security-states_s.axf --stat -T $KILLTIME
11 |
12 |
--------------------------------------------------------------------------------
/security/hello-world-in-security-states/scripts/run_tarmac.sh:
--------------------------------------------------------------------------------
1 | cd projects/m-profile/security/hello-world-in-security-states
2 |
3 | while getopts "f:t:k:" opt; do
4 | case "$opt" in
5 | f) FVP="$OPTARG";;
6 | t) TARMAC="$OPTARG";;
7 | k) KILLTIME="$OPTARG";;
8 | esac
9 | done
10 |
11 | $FVP/FVP_MPS2_Cortex-M55 -C fvp_mps2.DISABLE_GATING=1 -C NSC_CFG_0=1 -C cpu0.INITNSVTOR=0x00200000 -a logs/hello-world-in-security-states_ns.axf -a logs/hello-world-in-security-states_s.axf --stat --plugin $TARMAC -C TRACE.TarmacTrace.trace-file=logs/tarmac.log -T $KILLTIME
12 |
--------------------------------------------------------------------------------
/security/hello-world-in-security-states/scripts/success.txt:
--------------------------------------------------------------------------------
1 | Example Project: hello-world-in-security-states Start
2 | S: Hello World in Secure State
3 | NS: Hello World in Non-secure State
4 | S: Calling Secure function from Non-secure state
5 | Example Project: hello-world-in-security-states End
--------------------------------------------------------------------------------
/security/security-func-call-params-passing/scripts/gcc_arm_s.ld:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ARM-software/m-profile-user-guide-examples/1c961a98d1f5e8e92b7142403a2722d2e52be624/security/security-func-call-params-passing/scripts/gcc_arm_s.ld
--------------------------------------------------------------------------------
/security/security-func-call-params-passing/scripts/run.sh:
--------------------------------------------------------------------------------
1 | cd projects/m-profile/security/security-func-call-params-passing
2 |
3 | while getopts "f:k:" opt; do
4 | case "$opt" in
5 | f) FVP="$OPTARG";;
6 | k) KILLTIME="$OPTARG";;
7 | esac
8 | done
9 |
10 | $FVP/FVP_MPS2_Cortex-M55 -C fvp_mps2.DISABLE_GATING=1 -C NSC_CFG_0=1 -C cpu0.INITNSVTOR=0x00200000 -C cpu0.semihosting-heap_base=0x0 -C cpu0.semihosting-heap_limit=0x0 -C cpu0.semihosting-stack_base=0x0 -C cpu0.semihosting-stack_limit=0x0 -a logs/security-func-call-params-passing_ns.axf -a logs/security-func-call-params-passing_s.axf --stat -T $KILLTIME
11 |
12 |
--------------------------------------------------------------------------------
/security/security-func-call-params-passing/scripts/run_tarmac.sh:
--------------------------------------------------------------------------------
1 | cd projects/m-profile/security/security-func-call-params-passing
2 |
3 | while getopts "f:t:k:" opt; do
4 | case "$opt" in
5 | f) FVP="$OPTARG";;
6 | t) TARMAC="$OPTARG";;
7 | k) KILLTIME="$OPTARG";;
8 | esac
9 | done
10 |
11 | $FVP/FVP_MPS2_Cortex-M55 -C fvp_mps2.DISABLE_GATING=1 -C NSC_CFG_0=1 -C cpu0.INITNSVTOR=0x00200000 -a logs/security-func-call-params-passing_ns.axf -a logs/security-func-call-params-passing_s.axf --stat --plugin $TARMAC -C TRACE.TarmacTrace.trace-file=logs/tarmac.log -T $KILLTIME
12 |
13 |
--------------------------------------------------------------------------------
/security/security-func-call-params-passing/scripts/success.txt:
--------------------------------------------------------------------------------
1 | Example Project: security-func-call-params-passing Start
2 | S: Hello World in Secure State
3 | NS: Hello World in Non-secure State
4 | NS: call Secure function
5 | NS: get add result from Secure side: 1 + 2 + 3 + 5.800000 = 11.800000
6 | NS: call Secure function with more input parameters
7 | NS: get add result from Secure side: 1 + 2 + 3 + 4 + 5 = 15
8 | NS: call Secure function with Non-secure function pointer as input parameter
9 | NS: call Secure function with Non-secure data pointer as input parameter
10 | S: check Non-secure permission to read the data region
11 | S: process Non-secure data in Secure side
12 | NS: Non-secure callback function get Secure processing result = 15
13 | Example Project: security-func-call-params-passing End
14 |
--------------------------------------------------------------------------------
/security/security-func-call-params-passing/security-func-call-params-passing_ns/.gitignore:
--------------------------------------------------------------------------------
1 | /Debug/
2 |
--------------------------------------------------------------------------------
/security/security-func-call-params-passing/security-func-call-params-passing_ns/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | security-func-call-params-passing_ns
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder
10 | clean,full,incremental,
11 |
12 |
13 |
14 |
15 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
16 | full,incremental,
17 |
18 |
19 |
20 |
21 |
22 | org.eclipse.cdt.core.cnature
23 | org.eclipse.cdt.managedbuilder.core.managedBuildNature
24 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
25 | com.arm.cmsis.pack.project.RteNature
26 |
27 |
28 |
--------------------------------------------------------------------------------
/security/security-func-call-params-passing/security-func-call-params-passing_ns/.settings/language.settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/security/security-func-call-params-passing/security-func-call-params-passing_ns/RTE/RTE_Components.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Auto generated Run-Time-Environment Component Configuration File
3 | * *** Do not modify ! ***
4 | *
5 | * Project: security-func-call-params-passing_ns
6 | * RTE configuration: security-func-call-params-passing_ns.rteconfig
7 | */
8 | #ifndef RTE_COMPONENTS_H
9 | #define RTE_COMPONENTS_H
10 |
11 | /*
12 | * Define the Device Header File:
13 | */
14 | #define CMSIS_device_header "ARMv81MML_DSP_DP_MVE_FP.h"
15 |
16 |
17 | #endif /* RTE_COMPONENTS_H */
18 |
--------------------------------------------------------------------------------
/security/security-func-call-params-passing/security-func-call-params-passing_ns/callback_ns.c:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * MIT License
4 | * Copyright (c) 2025 ARM Limited.
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | *
24 | */
25 |
26 | #include
27 | #include
28 |
29 | /**
30 | \brief Non-secure function
31 | \details implement a Non-secure function that has one integer parameter, and print
32 | this value
33 | \param [in] arg1
34 | */
35 | void func_ns (int32_t arg1)
36 | {
37 | printf("NS: Non-secure callback function get Secure processing result = %d\n\r",arg1);
38 | }
39 |
40 |
--------------------------------------------------------------------------------
/security/security-func-call-params-passing/security-func-call-params-passing_ns/callback_ns.h:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * MIT License
4 | * Copyright (c) 2025 ARM Limited.
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | *
24 | */
25 |
26 | #ifndef CALLBACK_NS_H
27 | #define CALLBACK_NS_H
28 |
29 | #include
30 |
31 | void func_ns (int32_t arg1);
32 |
33 | #endif
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/security/security-func-call-params-passing/security-func-call-params-passing_ns/interface.h:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * MIT License
4 | * Copyright (c) 2025 ARM Limited.
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | *
24 | */
25 |
26 | #include
27 |
28 | /* typedef for function pointer type */
29 | typedef void (*funcptr)(int32_t);
30 |
31 |
32 | typedef struct {
33 | int32_t a;
34 | int32_t b;
35 | int32_t c;
36 | int32_t d;
37 | int32_t e;
38 | } S;
39 |
40 |
41 | float ns_callable_fn1(int32_t a, int32_t b, int32_t c, float d);
42 | int32_t ns_callable_fn2(S* ptr);
43 | void ns_callable_init(funcptr callback);
44 | void ns_callable_fn3(volatile uint32_t* ptr, uint32_t size);
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/security/security-func-call-params-passing/security-func-call-params-passing_ns/security-func-call-params-passing_ns.rteconfig:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/security/security-func-call-params-passing/security-func-call-params-passing_s/.gitignore:
--------------------------------------------------------------------------------
1 | /Debug/
2 |
--------------------------------------------------------------------------------
/security/security-func-call-params-passing/security-func-call-params-passing_s/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | security-func-call-params-passing_s
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder
10 | clean,full,incremental,
11 |
12 |
13 |
14 |
15 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
16 | full,incremental,
17 |
18 |
19 |
20 |
21 |
22 | org.eclipse.cdt.core.cnature
23 | org.eclipse.cdt.managedbuilder.core.managedBuildNature
24 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
25 | com.arm.cmsis.pack.project.RteNature
26 |
27 |
28 |
--------------------------------------------------------------------------------
/security/security-func-call-params-passing/security-func-call-params-passing_s/.settings/language.settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/security/security-func-call-params-passing/security-func-call-params-passing_s/RTE/RTE_Components.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Auto generated Run-Time-Environment Component Configuration File
3 | * *** Do not modify ! ***
4 | *
5 | * Project: security-func-call-params-passing_s
6 | * RTE configuration: security-func-call-params-passing_s.rteconfig
7 | */
8 | #ifndef RTE_COMPONENTS_H
9 | #define RTE_COMPONENTS_H
10 |
11 | /*
12 | * Define the Device Header File:
13 | */
14 | #define CMSIS_device_header "ARMv81MML_DSP_DP_MVE_FP.h"
15 |
16 |
17 | #endif /* RTE_COMPONENTS_H */
18 |
--------------------------------------------------------------------------------
/security/security-func-call-params-passing/security-func-call-params-passing_s/init.h:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * MIT License
4 | * Copyright (c) 2025 ARM Limited.
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | *
24 | */
25 | #ifndef INIT_H
26 | #define INIT_H
27 |
28 | /*SecureFault priority value*/
29 | #define SecureFaultPriority 0
30 |
31 |
32 | /*CPPWR: SUS10 Position */
33 | #define SCnSCB_CPPWR_SUS10_Pos 21U
34 |
35 | /*CPPWR: SUS10 Enable: the SU10 field is only accessible from the Secure state.*/
36 | #define SCnSCB_CPPWR_SUS10_Msk (1UL << SCnSCB_CPPWR_SUS10_Pos)
37 |
38 | /*CPPWR: SUS11 Position */
39 | #define SCnSCB_CPPWR_SUS11_Pos 23U
40 |
41 | /*CPPWR: SUS11 Enable: the SU11 field is only accessible from the Secure state.*/
42 | #define SCnSCB_CPPWR_SUS11_Msk (1UL << SCnSCB_CPPWR_SUS11_Pos)
43 |
44 | /* Set 1 in each bit to target each interrupt to Secure*/
45 | #define NVIC_INIT_SECURE_VAL 0XFFFFFFFF
46 |
47 | /* Symbols extracted from scatter file for Arm Compiler 6 toolchain and linker script for GNU
48 | * toolchain */
49 | extern int32_t Image$$ER_CMSE_VENEER$$Base;
50 | extern int32_t Image$$ER_CMSE_VENEER$$Limit;
51 |
52 | extern int32_t Image$$PSP_STACK$$ZI$$Limit;
53 | extern int32_t Image$$PSP_STACK$$ZI$$Base;
54 | extern int32_t Image$$PSP_STACKSEAL$$Base;
55 |
56 | /* PSP Stack address*/
57 | #define INITIAL_PSP Image$$PSP_STACK$$ZI$$Limit
58 |
59 | #define PSP_STACK_LIMIT Image$$PSP_STACK$$ZI$$Base
60 |
61 | #define PSP_STACK_SEAL Image$$PSP_STACKSEAL$$Base
62 |
63 |
64 | void Secure_System_Init();
65 |
66 | #endif /* INIT_H */
67 |
--------------------------------------------------------------------------------
/security/security-func-call-params-passing/security-func-call-params-passing_s/interface.h:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * MIT License
4 | * Copyright (c) 2025 ARM Limited.
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | *
24 | */
25 |
26 | #include
27 |
28 | /* typedef for function pointer type */
29 | typedef void (*funcptr)(int32_t);
30 |
31 |
32 | typedef struct {
33 | int32_t a;
34 | int32_t b;
35 | int32_t c;
36 | int32_t d;
37 | int32_t e;
38 | } S;
39 |
40 |
41 | float ns_callable_fn1(int32_t a, int32_t b, int32_t c, float d);
42 | int32_t ns_callable_fn2(S* ptr);
43 | void ns_callable_init(funcptr callback);
44 | void ns_callable_fn3(volatile uint32_t* ptr, uint32_t size);
45 |
--------------------------------------------------------------------------------
/security/security-func-call-params-passing/security-func-call-params-passing_s/region_defs.h:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * MIT License
4 | * Copyright (c) 2025 ARM Limited.
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | *
24 | */
25 | #ifndef REGION_DEFS_H
26 | #define REGION_DEFS_H
27 |
28 | /*--------------------- Secure Flash Configuration ----------------------------------*/
29 |
30 | #define __ROM_BASE_S 0x10000000
31 | #define __ROM_SIZE_S 0x00200000
32 |
33 | /*--------------------- Secure RAM Configuration ---------------------------*/
34 |
35 | #define __RAM_BASE_S 0x30000000
36 | #define __RAM_SIZE_S 0x00200000
37 |
38 | /*--------------------- Secure Stack / Heap Configuration ---------------------------*/
39 | #define __STACK_SIZE 0x00000400
40 | #define __HEAP_SIZE 0x00000C00
41 | #define __PSP_STACK_SIZE 0x00000400
42 |
43 | /*--------------------- Secure NSC Region Configuration ---------------------------*/
44 | #define __CMSEVENEER_BASE 0x101FFC00
45 | #define __CMSEVENEER_SIZE 0x00000400
46 |
47 | /*--------------------- Non-secure ROM Region Configuration ---------------------------*/
48 | #define __ROM_BASE_NS 0x00200000
49 | #define __ROM_SIZE_NS 0x00200000
50 |
51 | /*--------------------- NOn-secure RAM Region Configuration ---------------------------*/
52 | #define __RAM_BASE_NS 0x20200000
53 | #define __RAM_SIZE_NS 0x00200000
54 |
55 |
56 | #endif
57 |
--------------------------------------------------------------------------------
/security/security-func-call-params-passing/security-func-call-params-passing_s/security-func-call-params-passing_s.rteconfig:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------