Skip to content

Commit e08d973

Browse files
committed
Update the ARM Cortex-M core and peripherals configuration declaration.
1 parent 18d9675 commit e08d973

File tree

7 files changed

+154
-49
lines changed

7 files changed

+154
-49
lines changed

include/arch.h

Lines changed: 52 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -28,37 +28,67 @@ typedef enum IRQn {
2828
SysTick_IRQn = -1, /*!< 15 Cortex-Mx System Tick Interrupt */
2929
} IRQn_Type;
3030

31-
#if ( (defined ( __CC_ARM ) && defined ( __TARGET_FPU_VFP )) \
32-
|| (defined ( __CLANG_ARM ) && defined ( __VFP_FP__ ) && !defined(__SOFTFP__)) \
33-
|| (defined ( __ICCARM__ ) && defined ( __ARMVFP__ )) \
34-
|| (defined ( __GNUC__ ) && defined ( __VFP_FP__ ) && !defined(__SOFTFP__)) )
35-
#define __FPU_PRESENT 1
36-
#else
37-
#define __FPU_PRESENT 0
31+
/* Configuration of the Cortex-M Processor and Core Peripherals */
32+
/* SAU regions present */
33+
#if !defined ( __SAUREGION_PRESENT )
34+
#if defined ( ARCH_SAUREGION_PRESENT )
35+
#define __SAUREGION_PRESENT ARCH_SAUREGION_PRESENT
36+
#endif
3837
#endif
3938

40-
/* Default Setting */
41-
#if defined ( ARCH_MPU_PRESENT )
42-
#define __MPU_PRESENT 1
39+
/* MPU present */
40+
#if !defined ( __MPU_PRESENT )
41+
#if defined ( ARCH_MPU_PRESENT )
42+
#define __MPU_PRESENT ARCH_MPU_PRESENT
43+
#endif
4344
#endif
4445

45-
#if !defined ( __MPU_PRESENT )
46-
#define __MPU_PRESENT 1
46+
/* MPU present */
47+
#if !defined ( __VTOR_PRESENT )
48+
#if defined ( ARCH_VTOR_PRESENT )
49+
#define __VTOR_PRESENT ARCH_VTOR_PRESENT
50+
#endif
4751
#endif
4852

49-
#if !defined ( __NVIC_PRIO_BITS )
50-
#define __NVIC_PRIO_BITS 8
53+
/* VTOR present */
54+
#if !defined ( __VTOR_PRESENT )
55+
#if defined ( ARCH_VTOR_PRESENT )
56+
#define __VTOR_PRESENT ARCH_VTOR_PRESENT
57+
#endif
5158
#endif
5259

53-
#if !defined ( __Vendor_SysTickConfig )
54-
#define __Vendor_SysTickConfig 0
60+
61+
/* DSP extension present */
62+
#if !defined ( __DSP_PRESENT )
63+
#if defined ( ARCH_DSP_PRESENT )
64+
#define __DSP_PRESENT ARCH_DSP_PRESENT
65+
#endif
5566
#endif
5667

57-
#if !defined ( __VTOR_PRESENT )
58-
#define __VTOR_PRESENT 1
68+
/* FPU present */
69+
#if !defined ( __FPU_PRESENT )
70+
#if defined ( ARCH_FPU_PRESENT )
71+
#define __FPU_PRESENT ARCH_FPU_PRESENT
72+
#endif
73+
#endif
74+
75+
/* Number of Bits used for Priority Levels */
76+
#if !defined ( __NVIC_PRIO_BITS )
77+
#if defined ( ARCH_NVIC_PRIO_BITS )
78+
#define __NVIC_PRIO_BITS ARCH_NVIC_PRIO_BITS
79+
#else
80+
#error "No __NVIC_PRIO_BITS or ARCH_NVIC_PRIO_BITS is defined in head of this file"
81+
#endif
82+
#endif
83+
84+
/* Set to 1 if different SysTick Config is used */
85+
#if !defined ( __Vendor_SysTickConfig )
86+
#if defined ( ARCH_Vendor_SysTickConfig )
87+
#define __Vendor_SysTickConfig ARCH_Vendor_SysTickConfig
88+
#else
89+
#error "No __Vendor_SysTickConfig or ARCH_Vendor_SysTickConfig is defined in head of this file"
90+
#endif
5991
#endif
60-
61-
#define __DSP_PRESENT 1
6292

6393
#if defined ( ARCH_ARM_CORTEX_CM0 )
6494
#include "../arch/arch32/arm/cmsis/include/core_cm0.h"
@@ -76,15 +106,6 @@ typedef enum IRQn {
76106
#include "../arch/arch32/arm/cmsis/include/core_cm23.h"
77107

78108
#elif defined ( ARCH_ARM_CORTEX_CM33 )
79-
// #define __CM33_REV 0x0000U /*!< Core revision r0p1 */
80-
// #define __SAUREGION_PRESENT 1U /*!< SAU regions present */
81-
// #define __MPU_PRESENT 1U /*!< MPU present */
82-
// #define __VTOR_PRESENT 1U /*!< VTOR present */
83-
// #define __NVIC_PRIO_BITS 4U /*!< Number of Bits used for Priority Levels */
84-
// #define __Vendor_SysTickConfig 0U /*!< Set to 1 if different SysTick Config is used */
85-
// #define __FPU_PRESENT 1U /*!< FPU present */
86-
// #define __DSP_PRESENT 1U /*!< DSP extension present */
87-
88109
#include "../arch/arch32/arm/cmsis/include/core_cm33.h"
89110

90111
#elif defined ARCH_ARM_CORTEX_CM7
@@ -93,10 +114,10 @@ typedef enum IRQn {
93114
#elif defined ARCH_NATIVE_GCC
94115
// Nothing to do
95116
#else
96-
#error "No ARM Arch is defined"
117+
#error "No ARM Arch is defined in head of this file"
97118
#endif
98119

99-
#if !defined ARCH_NATIVE_GCC
120+
#if !defined( ARCH_NATIVE_GCC )
100121
#define ARCH_ENTER_CRITICAL_SECTION() vu32_t PRIMASK_Bit = __get_PRIMASK(); \
101122
__disable_irq(); \
102123
__DSB(); \

include/kernal/configuration.h

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,31 @@ extern "C" {
7878
#define KERNAL_THREAD_STACK_SIZE (1024u)
7979
#endif
8080

81+
/* Configuration of the Cortex-M Processor and Core Peripherals.
82+
* You should check the chip header file or datasheet to check the following declaration symbol that support ARM Cortex-M Processor and Core Peripherals, and put it here.
83+
* It looks like this.
84+
*
85+
* #define __SAUREGION_PRESENT (1u) // SAU regions present
86+
* #define __MPU_PRESENT (1u) // MPU present
87+
* #define __VTOR_PRESENT (1u) // VTOR present
88+
* #define __NVIC_PRIO_BITS (4u) // Number of Bits used for Priority Levels
89+
* #define __Vendor_SysTickConfig (0u) // Set to 1 if different SysTick Config is used
90+
* #define __FPU_PRESENT (1u) // FPU present
91+
* #define __DSP_PRESENT (1u) // DSP extension present
92+
*
93+
* Or you can manually defined it according to your using ARM Cortex M seiral chip here with the following declaration symbol.
94+
*
95+
* #define ARCH_SAUREGION_PRESENT (1u) // SAU regions present
96+
* #define ARCH_MPU_PRESENT (1u) // MPU present
97+
* #define ARCH_VTOR_PRESENT (1u) // VTOR present
98+
* #define ARCH_NVIC_PRIO_BITS (4u) // Number of Bits used for Priority Levels
99+
* #define ARCH_Vendor_SysTickConfig (0u) // Set to 1 if different SysTick Config is used
100+
* #define ARCH_FPU_PRESENT (1u) // FPU present
101+
* #define ARCH_DSP_PRESENT (1u) // DSP extension present
102+
*
103+
* There is no default setting, which must be set in the atos_configuration.h file.
104+
*/
105+
81106
#if !defined __CC_ARM && \
82107
!defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) && \
83108
!defined __ICCARM__ && \
@@ -87,7 +112,6 @@ extern "C" {
87112
!defined ARCH_NATIVE_GCC
88113

89114
#warning Not supported compiler type
90-
91115
#endif
92116

93117
#ifdef __cplusplus

include/template/atos_configuration.h

Lines changed: 39 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,37 @@ extern "C" {
2222
* ARCH_ARM_CORTEX_CM33
2323
* ARCH_ARM_CORTEX_CM7
2424
**/
25-
#define ARCH_ARM_CORTEX_CM4
25+
#define ARCH_ARM_CORTEX_CM33
26+
27+
/* Configuration of the Cortex-M Processor and Core Peripherals.
28+
* You should check the chip header file or datasheet to check the following declaration symbol that support ARM Cortex-M Processor and Core Peripherals, and put it here.
29+
* It looks like this.
30+
*
31+
* #define __SAUREGION_PRESENT (1u) // SAU regions present
32+
* #define __MPU_PRESENT (1u) // MPU present
33+
* #define __VTOR_PRESENT (1u) // VTOR present
34+
* #define __NVIC_PRIO_BITS (4u) // Number of Bits used for Priority Levels
35+
* #define __Vendor_SysTickConfig (0u) // Set to 1 if different SysTick Config is used
36+
* #define __FPU_PRESENT (1u) // FPU present
37+
* #define __DSP_PRESENT (1u) // DSP extension present
38+
*
39+
* Or you can manually defined it according to your using ARM Cortex M seiral chip here with the following declaration symbol.
40+
*
41+
* #define ARCH_SAUREGION_PRESENT (1u) // SAU regions present
42+
* #define ARCH_MPU_PRESENT (1u) // MPU present
43+
* #define ARCH_VTOR_PRESENT (1u) // VTOR present
44+
* #define ARCH_NVIC_PRIO_BITS (4u) // Number of Bits used for Priority Levels
45+
* #define ARCH_Vendor_SysTickConfig (0u) // Set to 1 if different SysTick Config is used
46+
* #define ARCH_FPU_PRESENT (1u) // FPU present
47+
* #define ARCH_DSP_PRESENT (1u) // DSP extension present
48+
*/
49+
#define ARCH_SAUREGION_PRESENT (1u) // SAU regions present
50+
#define ARCH_MPU_PRESENT (1u) // MPU present
51+
#define ARCH_VTOR_PRESENT (1u) // VTOR present
52+
#define ARCH_NVIC_PRIO_BITS (4u) // Number of Bits used for Priority Levels
53+
#define ARCH_Vendor_SysTickConfig (0u) // Set to 1 if different SysTick Config is used
54+
#define ARCH_FPU_PRESENT (1u) // FPU present
55+
#define ARCH_DSP_PRESENT (1u) // DSP extension present
2656

2757
/**
2858
* If you are use ARM Cortex M seiral architecture and use the system tick as the kernal timer.
@@ -31,7 +61,7 @@ extern "C" {
3161
* The default value is set to 120mhz. Your application will certainly need a different value so set this correctly.
3262
* This is very often, but not always, equal to the main system clock frequency.
3363
**/
34-
#define PORTAL_SYSTEM_CORE_CLOCK_MHZ (120u)
64+
#define PORTAL_SYSTEM_CORE_CLOCK_MHZ (180u)
3565

3666
/**
3767
* If you are use ARM Cortex M seiral architecture and use the system tick as the kernal timer.
@@ -46,49 +76,49 @@ extern "C" {
4676
* The defaule value is set to 3. Your application will certainly need a different value so set this correctly.
4777
* This is very often, but not always, according to the actual thread instance number that you created.
4878
**/
49-
#define THREAD_INSTANCE_SUPPORTED_NUMBER (3u)
79+
#define THREAD_INSTANCE_SUPPORTED_NUMBER (20u)
5080

5181
/**
5282
* This symbol defined the semaphore instance number that your application is using.
5383
* The defaule value is set to 3. Your application will certainly need a different value so set this correctly.
5484
* This is very often, but not always, according to the actual semaphore instance number that you created.
5585
**/
56-
#define SEMAPHORE_INSTANCE_SUPPORTED_NUMBER (3u)
86+
#define SEMAPHORE_INSTANCE_SUPPORTED_NUMBER (10u)
5787

5888
/**
5989
* This symbol defined the event instance number that your application is using.
6090
* The defaule value is set to 3. Your application will certainly need a different value so set this correctly.
6191
* This is very often, but not always, according to the actual event instance number that you created.
6292
**/
63-
#define EVENT_INSTANCE_SUPPORTED_NUMBER (3u)
93+
#define EVENT_INSTANCE_SUPPORTED_NUMBER (10u)
6494

6595
/**
6696
* This symbol defined the mutex instance number that your application is using.
6797
* The defaule value is set to 3. Your application will certainly need a different value so set this correctly.
6898
* This is very often, but not always, according to the actual mutex instance number that you created.
6999
**/
70-
#define MUTEX_INSTANCE_SUPPORTED_NUMBER (3u)
100+
#define MUTEX_INSTANCE_SUPPORTED_NUMBER (10u)
71101

72102
/**
73103
* This symbol defined the queue instance number that your application is using.
74104
* The defaule value is set to 5. Your application will certainly need a different value so set this correctly.
75105
* This is very often, but not always, according to the actual queue instance number that you created.
76106
**/
77-
#define QUEUE_INSTANCE_SUPPORTED_NUMBER (3u)
107+
#define QUEUE_INSTANCE_SUPPORTED_NUMBER (10u)
78108

79109
/**
80110
* This symbol defined the timer instance number that your application is using.
81111
* The defaule value is set to 5. Your application will certainly need a different value so set this correctly.
82112
* This is very often, but not always, according to the actual timer instance number that you created.
83113
**/
84-
#define TIMER_INSTANCE_SUPPORTED_NUMBER (3u)
114+
#define TIMER_INSTANCE_SUPPORTED_NUMBER (10u)
85115

86116
/**
87117
* This symbol defined your thread running mode, if the thread runs at the privileged mode.
88118
* The defaule value is set to 0. Your application will certainly need a different value so set this correctly.
89119
* This is very often, but not always, according to the security level that you want.
90120
**/
91-
#define THREAD_PSP_WITH_PRIVILEGED (3u)
121+
#define THREAD_PSP_WITH_PRIVILEGED (10u)
92122

93123
#ifdef __cplusplus
94124
}

include/template/native_gcc/atos_configuration.h

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,36 @@ extern "C" {
2525
**/
2626
#define ARCH_NATIVE_GCC
2727

28+
/* Configuration of the Cortex-M Processor and Core Peripherals.
29+
* You should check the chip header file or datasheet to check the following declaration symbol that support ARM Cortex-M Processor and Core Peripherals, and put it here.
30+
* It looks like this.
31+
*
32+
* #define __SAUREGION_PRESENT (1u) // SAU regions present
33+
* #define __MPU_PRESENT (1u) // MPU present
34+
* #define __VTOR_PRESENT (1u) // VTOR present
35+
* #define __NVIC_PRIO_BITS (4u) // Number of Bits used for Priority Levels
36+
* #define __Vendor_SysTickConfig (0u) // Set to 1 if different SysTick Config is used
37+
* #define __FPU_PRESENT (1u) // FPU present
38+
* #define __DSP_PRESENT (1u) // DSP extension present
39+
*
40+
* Or you can manually defined it according to your using ARM Cortex M seiral chip here with the following declaration symbol.
41+
*
42+
* #define ARCH_SAUREGION_PRESENT (1u) // SAU regions present
43+
* #define ARCH_MPU_PRESENT (1u) // MPU present
44+
* #define ARCH_VTOR_PRESENT (1u) // VTOR present
45+
* #define ARCH_NVIC_PRIO_BITS (4u) // Number of Bits used for Priority Levels
46+
* #define ARCH_Vendor_SysTickConfig (0u) // Set to 1 if different SysTick Config is used
47+
* #define ARCH_FPU_PRESENT (1u) // FPU present
48+
* #define ARCH_DSP_PRESENT (1u) // DSP extension present
49+
*/
50+
#define ARCH_SAUREGION_PRESENT (1u) // SAU regions present
51+
#define ARCH_MPU_PRESENT (1u) // MPU present
52+
#define ARCH_VTOR_PRESENT (1u) // VTOR present
53+
#define ARCH_NVIC_PRIO_BITS (4u) // Number of Bits used for Priority Levels
54+
#define ARCH_Vendor_SysTickConfig (0u) // Set to 1 if different SysTick Config is used
55+
#define ARCH_FPU_PRESENT (1u) // FPU present
56+
#define ARCH_DSP_PRESENT (1u) // DSP extension present
57+
2858
/**
2959
* If you are use ARM Cortex M seiral architecture and use the system tick as the kernal timer.
3060
* In most cases, PORTAL_SYSTEM_CORE_CLOCK_MHZ must be set to the frequency of the clock

kernal_version.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212
extern "C" {
1313
#endif
1414

15-
#define ATOS_BUILD_TIME "2024-02-15,11:24"
16-
#define ATOS_COMMIT_HEAD_ID "b8344c54828813787ac4cafa0a177ff7c0741796"
15+
#define ATOS_BUILD_TIME "2024-02-15,20:56"
16+
#define ATOS_COMMIT_HEAD_ID "5c95f1a3f050128d4a5c180e8f9b93f6737421f4"
1717
#define ATOS_VERSION_MAJOR_NUMBER (0u)
1818
#define ATOS_VERSION_MINOR_NUMBER (3u)
19-
#define ATOS_VERSION_PATCH_NUMBER (6u)
19+
#define ATOS_VERSION_PATCH_NUMBER (7u)
2020

2121
#define ATOS_VERSION_MAJOR_NUMBER_MASK (0x03FFu)
2222
#define ATOS_VERSION_MAJOR_NUMBER_POS (22u)

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "At-RTOS",
3-
"version": "0.3.6",
4-
"timestamp": "2024-02-15,11:24",
5-
"commit_id": "b8344c54828813787ac4cafa0a177ff7c0741797"
3+
"version": "0.3.7",
4+
"timestamp": "2024-02-15,20:56",
5+
"commit_id": "b8344c54828813787ac4cafa0a177ff7c0741796"
66
}

port/port_keil_ac5.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ extern "C" {
1515
#include "compiler.h"
1616
#include "port.h"
1717

18-
#if defined ( __TARGET_FPU_VFP )
19-
#define FPU_ENABLED __TARGET_FPU_VFP
18+
#if defined ( __FPU_PRESENT )
19+
#define FPU_ENABLED __FPU_PRESENT
2020
#else
2121
#define FPU_ENABLED 0
2222
#endif

0 commit comments

Comments
 (0)