init
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
# yaml-language-server: $schema=https://raw.githubusercontent.com/Open-CMSIS-Pack/devtools/schemas/projmgr/1.3.0/tools/projmgr/schemas/clayer.schema.json
|
||||
|
||||
layer:
|
||||
# type: App
|
||||
# name: CMSIS-Core_Validation (Bootloader)
|
||||
description: Validation of CMSIS-Core implementation (Bootloader part)
|
||||
|
||||
# packs:
|
||||
# - pack: ARM::CMSIS
|
||||
|
||||
groups:
|
||||
- group: Source Files
|
||||
files:
|
||||
- file: ./bootloader.c
|
||||
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2016 ARM Limited. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* ----------------------------------------------------------------------
|
||||
*
|
||||
* $Date: 15. October 2016
|
||||
* $Revision: 1.1.0
|
||||
*
|
||||
* Project: TrustZone for ARMv8-M
|
||||
* Title: Code template for secure main function
|
||||
*
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/* Use CMSE intrinsics */
|
||||
#include <arm_cmse.h>
|
||||
|
||||
#include "RTE_Components.h"
|
||||
#include CMSIS_device_header
|
||||
|
||||
/* TZ_START_NS: Start address of non-secure application */
|
||||
#ifndef TZ_START_NS
|
||||
#define TZ_START_NS (0x200000U)
|
||||
#endif
|
||||
|
||||
#if 1
|
||||
/* Dummy Non-secure callable (entry) function */
|
||||
__attribute__((cmse_nonsecure_entry)) int validationDummy(int x) {
|
||||
return x;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* typedef for non-secure callback functions */
|
||||
typedef void (*funcptr_void) (void) __attribute__((cmse_nonsecure_call));
|
||||
|
||||
/* Secure main() */
|
||||
int main(void) {
|
||||
funcptr_void NonSecure_ResetHandler;
|
||||
|
||||
/* Add user setup code for secure part here*/
|
||||
|
||||
/* Set non-secure main stack (MSP_NS) */
|
||||
__TZ_set_MSP_NS(*((uint32_t *)(TZ_START_NS)));
|
||||
|
||||
/* Get non-secure reset handler */
|
||||
NonSecure_ResetHandler = (funcptr_void)(*((uint32_t *)((TZ_START_NS) + 4U)));
|
||||
|
||||
/* Start non-secure state software application */
|
||||
NonSecure_ResetHandler();
|
||||
|
||||
/* Non-secure software does not return, this code is not executed */
|
||||
while (1) {
|
||||
__NOP();
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(__CORTEX_M)
|
||||
__NO_RETURN
|
||||
extern void HardFault_Handler(void);
|
||||
void HardFault_Handler(void) {
|
||||
printf("Bootloader HardFault!\n");
|
||||
#ifdef __MICROLIB
|
||||
for(;;) {}
|
||||
#else
|
||||
exit(1);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,48 @@
|
||||
# yaml-language-server: $schema=https://raw.githubusercontent.com/Open-CMSIS-Pack/devtools/schemas/projmgr/1.3.0/tools/projmgr/schemas/clayer.schema.json
|
||||
|
||||
layer:
|
||||
# type: App
|
||||
# name: CMSIS-Core_Validation
|
||||
description: Validation of CMSIS-Core implementation
|
||||
|
||||
# packs:
|
||||
# - pack: ARM::CMSIS
|
||||
|
||||
define:
|
||||
- PRINT_XML_REPORT: 1
|
||||
|
||||
add-path:
|
||||
- ../../../Include
|
||||
- ../../../Source/ConfigA
|
||||
|
||||
misc:
|
||||
- for-compiler: AC6
|
||||
C-CPP:
|
||||
- -Wno-declaration-after-statement
|
||||
- -Wno-covered-switch-default
|
||||
- for-compiler: GCC
|
||||
C-CPP:
|
||||
- -Wno-declaration-after-statement
|
||||
- -Wno-covered-switch-default
|
||||
|
||||
groups:
|
||||
- group: Documentation
|
||||
files:
|
||||
- file: ../../../README.md
|
||||
|
||||
- group: Source Files
|
||||
files:
|
||||
- file: ./main.c
|
||||
|
||||
- group: CMSIS-Core_Validation
|
||||
files:
|
||||
- file: ../../../Source/cmsis_cv.c
|
||||
- file: ../../../Source/CV_CoreAFunc.c
|
||||
- file: ../../../Source/CV_CoreInstr.c
|
||||
- file: ../../../Source/CV_CAL1Cache.c
|
||||
# - file: ../../../Source/ConfigA/mmu.c
|
||||
|
||||
- group: Validation Framework
|
||||
files:
|
||||
- file: ../../../Source/CV_Framework.c
|
||||
- file: ../../../Source/CV_Report.c
|
||||
@@ -0,0 +1,133 @@
|
||||
/*
|
||||
* Copyright (C) 2022 ARM Limited or its affiliates. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "RTE_Components.h"
|
||||
#include CMSIS_device_header
|
||||
|
||||
#ifdef RTE_Compiler_EventRecorder
|
||||
#include "EventRecorder.h"
|
||||
#endif
|
||||
|
||||
#include "cmsis_cv.h"
|
||||
#include "CV_Report.h"
|
||||
|
||||
//lint -e970 allow using int for main
|
||||
|
||||
int main (void)
|
||||
{
|
||||
|
||||
// System Initialization
|
||||
SystemCoreClockUpdate();
|
||||
|
||||
#ifdef RTE_Compiler_EventRecorder
|
||||
// Initialize and start Event Recorder
|
||||
(void)EventRecorderInitialize(EventRecordError, 1U);
|
||||
(void)EventRecorderEnable(EventRecordAll, 0xFEU, 0xFEU);
|
||||
#endif
|
||||
|
||||
cmsis_cv();
|
||||
|
||||
#ifdef __MICROLIB
|
||||
for(;;) {}
|
||||
#else
|
||||
exit(0);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(__CORTEX_A)
|
||||
#include "irq_ctrl.h"
|
||||
|
||||
#if (defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)) || \
|
||||
(defined ( __GNUC__ ))
|
||||
#define __IRQ __attribute__((interrupt("IRQ")))
|
||||
#elif defined ( __CC_ARM )
|
||||
#define __IRQ __irq
|
||||
#elif defined ( __ICCARM__ )
|
||||
#define __IRQ __irq __arm
|
||||
#else
|
||||
#error "Unsupported compiler!"
|
||||
#endif
|
||||
|
||||
|
||||
__IRQ
|
||||
void IRQ_Handler(void);
|
||||
__IRQ
|
||||
void IRQ_Handler(void) {
|
||||
const IRQn_ID_t irqn = IRQ_GetActiveIRQ();
|
||||
IRQHandler_t const handler = IRQ_GetHandler(irqn);
|
||||
if (handler != NULL) {
|
||||
__enable_irq();
|
||||
handler();
|
||||
__disable_irq();
|
||||
}
|
||||
IRQ_EndOfInterrupt(irqn);
|
||||
}
|
||||
|
||||
__IRQ __NO_RETURN
|
||||
void Undef_Handler (void);
|
||||
__IRQ __NO_RETURN
|
||||
void Undef_Handler (void) {
|
||||
cmsis_cv_abort(__FILENAME__, __LINE__, "Undefined Instruction!");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
__IRQ
|
||||
void SVC_Handler (void);
|
||||
__IRQ
|
||||
void SVC_Handler (void) {
|
||||
}
|
||||
|
||||
__IRQ __NO_RETURN
|
||||
void PAbt_Handler (void);
|
||||
__IRQ __NO_RETURN
|
||||
void PAbt_Handler (void) {
|
||||
cmsis_cv_abort(__FILENAME__, __LINE__, "Prefetch Abort!");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
__IRQ __NO_RETURN
|
||||
void DAbt_Handler (void);
|
||||
__IRQ __NO_RETURN
|
||||
void DAbt_Handler (void) {
|
||||
cmsis_cv_abort(__FILENAME__, __LINE__, "Data Abort!");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
__IRQ
|
||||
void FIQ_Handler (void);
|
||||
__IRQ
|
||||
void FIQ_Handler (void) {
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(__CORTEX_M)
|
||||
__NO_RETURN
|
||||
void HardFault_Handler(void);
|
||||
__NO_RETURN
|
||||
void HardFault_Handler(void) {
|
||||
cmsis_cv_abort(__FILENAME__, __LINE__, "HardFault!");
|
||||
#ifdef __MICROLIB
|
||||
for(;;) {}
|
||||
#else
|
||||
exit(0);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,73 @@
|
||||
# yaml-language-server: $schema=https://raw.githubusercontent.com/Open-CMSIS-Pack/devtools/schemas/projmgr/1.3.0/tools/projmgr/schemas/clayer.schema.json
|
||||
|
||||
layer:
|
||||
# type: App
|
||||
# name: CMSIS-Core_Validation
|
||||
description: Validation of CMSIS-Core implementation
|
||||
|
||||
# packs:
|
||||
# - pack: ARM::CMSIS
|
||||
|
||||
define:
|
||||
- PRINT_XML_REPORT: 1
|
||||
|
||||
add-path:
|
||||
- ../../../Include
|
||||
- ../../../Source/Config
|
||||
|
||||
misc:
|
||||
- for-compiler: AC6
|
||||
C-CPP:
|
||||
- -Wno-declaration-after-statement
|
||||
- -Wno-covered-switch-default
|
||||
- for-compiler: GCC
|
||||
C-CPP:
|
||||
- -Wno-declaration-after-statement
|
||||
- -Wno-covered-switch-default
|
||||
|
||||
groups:
|
||||
- group: Documentation
|
||||
files:
|
||||
- file: ../../../README.md
|
||||
|
||||
- group: Source Files
|
||||
files:
|
||||
- file: ./main.c
|
||||
|
||||
- group: CMSIS-Core_Validation
|
||||
files:
|
||||
- file: ../../../Source/cmsis_cv.c
|
||||
- file: ../../../Source/CV_CoreFunc.c
|
||||
- file: ../../../Source/CV_CoreInstr.c
|
||||
- file: ../../../Source/CV_CoreSimd.c
|
||||
- file: ../../../Source/CV_CML1Cache.c
|
||||
- file: ../../../Source/CV_MPU_ARMv7.c
|
||||
for-context:
|
||||
- +CM0
|
||||
- +CM0plus
|
||||
- +CM3
|
||||
- +CM4
|
||||
- +CM4FP
|
||||
- +CM7
|
||||
- +CM7SP
|
||||
- +CM7DP
|
||||
- file: ../../../Source/CV_MPU_ARMv8.c
|
||||
for-context:
|
||||
- +CM23
|
||||
- +CM23S
|
||||
- +CM23NS
|
||||
- +CM33
|
||||
- +CM33S
|
||||
- +CM33NS
|
||||
- +CM35P
|
||||
- +CM35PS
|
||||
- +CM35PNS
|
||||
- +CM55S
|
||||
- +CM55NS
|
||||
- +CM85S
|
||||
- +CM85NS
|
||||
|
||||
- group: Validation Framework
|
||||
files:
|
||||
- file: ../../../Source/CV_Framework.c
|
||||
- file: ../../../Source/CV_Report.c
|
||||
@@ -0,0 +1,143 @@
|
||||
/*
|
||||
* Copyright (C) 2022 ARM Limited or its affiliates. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "RTE_Components.h"
|
||||
#include CMSIS_device_header
|
||||
|
||||
#ifdef RTE_Compiler_EventRecorder
|
||||
#include "EventRecorder.h"
|
||||
#endif
|
||||
|
||||
#include "cmsis_cv.h"
|
||||
#include "CV_Report.h"
|
||||
|
||||
//lint -e970 allow using int for main
|
||||
|
||||
|
||||
#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
|
||||
#include <arm_cmse.h>
|
||||
|
||||
/* Dummy Non-secure callable (entry) function */
|
||||
__attribute__((cmse_nonsecure_entry)) int validationDummy(int x) {
|
||||
return x;
|
||||
}
|
||||
#endif
|
||||
|
||||
int main (void)
|
||||
{
|
||||
|
||||
// System Initialization
|
||||
SystemCoreClockUpdate();
|
||||
|
||||
#ifdef RTE_Compiler_EventRecorder
|
||||
// Initialize and start Event Recorder
|
||||
(void)EventRecorderInitialize(EventRecordError, 1U);
|
||||
(void)EventRecorderEnable(EventRecordAll, 0xFEU, 0xFEU);
|
||||
#endif
|
||||
|
||||
cmsis_cv();
|
||||
|
||||
#ifdef __MICROLIB
|
||||
for(;;) {}
|
||||
#else
|
||||
exit(0);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(__CORTEX_A)
|
||||
#include "irq_ctrl.h"
|
||||
|
||||
#if (defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)) || \
|
||||
(defined ( __GNUC__ ))
|
||||
#define __IRQ __attribute__((interrupt("IRQ")))
|
||||
#elif defined ( __CC_ARM )
|
||||
#define __IRQ __irq
|
||||
#elif defined ( __ICCARM__ )
|
||||
#define __IRQ __irq __arm
|
||||
#else
|
||||
#error "Unsupported compiler!"
|
||||
#endif
|
||||
|
||||
|
||||
__IRQ
|
||||
void IRQ_Handler(void);
|
||||
__IRQ
|
||||
void IRQ_Handler(void) {
|
||||
const IRQn_ID_t irqn = IRQ_GetActiveIRQ();
|
||||
IRQHandler_t const handler = IRQ_GetHandler(irqn);
|
||||
if (handler != NULL) {
|
||||
__enable_irq();
|
||||
handler();
|
||||
__disable_irq();
|
||||
}
|
||||
IRQ_EndOfInterrupt(irqn);
|
||||
}
|
||||
|
||||
__IRQ __NO_RETURN
|
||||
void Undef_Handler (void);
|
||||
__IRQ __NO_RETURN
|
||||
void Undef_Handler (void) {
|
||||
cmsis_cv_abort(__FILENAME__, __LINE__, "Undefined Instruction!");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
__IRQ
|
||||
void SVC_Handler (void);
|
||||
__IRQ
|
||||
void SVC_Handler (void) {
|
||||
}
|
||||
|
||||
__IRQ __NO_RETURN
|
||||
void PAbt_Handler (void);
|
||||
__IRQ __NO_RETURN
|
||||
void PAbt_Handler (void) {
|
||||
cmsis_cv_abort(__FILENAME__, __LINE__, "Prefetch Abort!");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
__IRQ __NO_RETURN
|
||||
void DAbt_Handler (void);
|
||||
__IRQ __NO_RETURN
|
||||
void DAbt_Handler (void) {
|
||||
cmsis_cv_abort(__FILENAME__, __LINE__, "Data Abort!");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
__IRQ
|
||||
void FIQ_Handler (void);
|
||||
__IRQ
|
||||
void FIQ_Handler (void) {
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(__CORTEX_M)
|
||||
__NO_RETURN
|
||||
void HardFault_Handler(void);
|
||||
__NO_RETURN
|
||||
void HardFault_Handler(void) {
|
||||
cmsis_cv_abort(__FILENAME__, __LINE__, "HardFault!");
|
||||
#ifdef __MICROLIB
|
||||
for(;;) {}
|
||||
#else
|
||||
exit(0);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user