Skip to content

Commit 54cda6e

Browse files
author
Scott Larson
committed
Add Cortex M55 and M85 to ports
1 parent 83b57ac commit 54cda6e

File tree

126 files changed

+27318
-0
lines changed

Some content is hidden

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

126 files changed

+27318
-0
lines changed

ports/cortex_m55/ac6/CmakeLists.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
target_sources(${PROJECT_NAME} PRIVATE
2+
${CMAKE_CURRENT_LIST_DIR}/src/txe_thread_secure_stack_allocate.c
3+
${CMAKE_CURRENT_LIST_DIR}/src/txe_thread_secure_stack_free.c
4+
${CMAKE_CURRENT_LIST_DIR}/src/tx_initialize_low_level.S
5+
${CMAKE_CURRENT_LIST_DIR}/src/tx_thread_context_restore.S
6+
${CMAKE_CURRENT_LIST_DIR}/src/tx_thread_context_save.S
7+
${CMAKE_CURRENT_LIST_DIR}/src/tx_thread_interrupt_control.S
8+
${CMAKE_CURRENT_LIST_DIR}/src/tx_thread_interrupt_disable.S
9+
${CMAKE_CURRENT_LIST_DIR}/src/tx_thread_interrupt_restore.S
10+
${CMAKE_CURRENT_LIST_DIR}/src/tx_thread_schedule.S
11+
${CMAKE_CURRENT_LIST_DIR}/src/tx_thread_secure_stack.c
12+
${CMAKE_CURRENT_LIST_DIR}/src/tx_thread_secure_stack_allocate.S
13+
${CMAKE_CURRENT_LIST_DIR}/src/tx_thread_secure_stack_free.S
14+
${CMAKE_CURRENT_LIST_DIR}/src/tx_thread_stack_build.S
15+
${CMAKE_CURRENT_LIST_DIR}/src/tx_thread_system_return.S
16+
${CMAKE_CURRENT_LIST_DIR}/src/tx_timer_interrupt.S
17+
)
18+
19+
target_include_directories(${PROJECT_NAME} PUBLIC
20+
inc
21+
)

ports/cortex_m55/ac6/inc/tx_port.h

Lines changed: 649 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/**************************************************************************/
2+
/* */
3+
/* Copyright (c) Microsoft Corporation. All rights reserved. */
4+
/* */
5+
/* This software is licensed under the Microsoft Software License */
6+
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
7+
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
8+
/* and in the root directory of this software. */
9+
/* */
10+
/**************************************************************************/
11+
12+
13+
/**************************************************************************/
14+
/**************************************************************************/
15+
/** */
16+
/** ThreadX Component */
17+
/** */
18+
/** Thread */
19+
/** */
20+
/**************************************************************************/
21+
/**************************************************************************/
22+
23+
24+
/**************************************************************************/
25+
/* */
26+
/* COMPONENT DEFINITION RELEASE */
27+
/* */
28+
/* tx_secure_interface.h PORTABLE C */
29+
/* 6.1 */
30+
/* AUTHOR */
31+
/* */
32+
/* Scott Larson, Microsoft Corporation */
33+
/* */
34+
/* DESCRIPTION */
35+
/* */
36+
/* This file defines the ThreadX secure thread stack components, */
37+
/* including data types and external references. */
38+
/* It is assumed that tx_api.h and tx_port.h have already been */
39+
/* included. */
40+
/* */
41+
/* RELEASE HISTORY */
42+
/* */
43+
/* DATE NAME DESCRIPTION */
44+
/* */
45+
/* 09-30-2020 Scott Larson Initial Version 6.1 */
46+
/* */
47+
/**************************************************************************/
48+
49+
#ifndef TX_SECURE_INTERFACE_H
50+
#define TX_SECURE_INTERFACE_H
51+
52+
/* Define internal secure thread stack function prototypes. */
53+
54+
extern UINT _tx_thread_secure_mode_stack_initialize(void);
55+
extern UINT _tx_thread_secure_mode_stack_allocate(TX_THREAD *thread_ptr, ULONG stack_size);
56+
extern UINT _tx_thread_secure_mode_stack_free(TX_THREAD *thread_ptr);
57+
extern void _tx_thread_secure_stack_initialize(void);
58+
extern void _tx_thread_secure_stack_context_save(TX_THREAD *thread_ptr);
59+
extern void _tx_thread_secure_stack_context_restore(TX_THREAD *thread_ptr);
60+
61+
#endif
Lines changed: 228 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,228 @@
1+
Microsoft's Azure RTOS ThreadX for Cortex-M55
2+
3+
Using the AC6 Tools in Keil uVision
4+
5+
1. Import the ThreadX Projects
6+
7+
In order to build the ThreadX library and the ThreadX demonstration, first open
8+
the AzureRTOS.uvmpw workspace (located in the "example_build" directory)
9+
into Keil.
10+
11+
12+
2. Building the ThreadX run-time Library
13+
14+
Building the ThreadX library is easy; simply set the ThreadX_Library project
15+
as active, then then build the library. You should now observe the compilation
16+
and assembly of the ThreadX library. This project build produces the ThreadX
17+
library file ThreadX_Library.lib.
18+
Files tx_thread_stack_error_handler.c and tx_thread_stack_error_notify.c
19+
replace the common files of the same name.
20+
21+
3. Demonstration System
22+
23+
The ThreadX demonstration is designed to execute under the Keil debugger on the
24+
FVP_MPS2_Cortex-M55_MDK simulator.
25+
26+
Building the demonstration is easy; simply select the "Batch Build" button.
27+
You should now observe the compilation and assembly of the ThreadX demonstration of
28+
both the demo_secure_zone and demo_threadx_non-secure_zone projects.
29+
Then click the Start/Stop Debug Session button to start the simulator and begin debugging.
30+
You are now ready to execute the ThreadX demonstration.
31+
32+
33+
4. System Initialization
34+
35+
The entry point in ThreadX for the Cortex-M55 using AC6 tools uses the standard AC6
36+
Cortex-M55 reset sequence. From the reset vector the C runtime will be initialized.
37+
38+
The ThreadX tx_initialize_low_level.s file is responsible for setting up
39+
various system data structures, the vector area, and a periodic timer interrupt
40+
source.
41+
42+
In addition, _tx_initialize_low_level determines the first available
43+
address for use by the application, which is supplied as the sole input
44+
parameter to your application definition function, tx_application_define.
45+
46+
47+
5. Register Usage and Stack Frames
48+
49+
The following defines the saved context stack frames for context switches
50+
that occur as a result of interrupt handling or from thread-level API calls.
51+
All suspended threads have the same stack frame in the Cortex-M55 version of
52+
ThreadX. The top of the suspended thread's stack is pointed to by
53+
tx_thread_stack_ptr in the associated thread control block TX_THREAD.
54+
55+
Non-FPU Stack Frame:
56+
57+
Stack Offset Stack Contents
58+
59+
0x00 LR Interrupted LR (LR at time of PENDSV)
60+
0x04 r4 Software stacked GP registers
61+
0x08 r5
62+
0x0C r6
63+
0x10 r7
64+
0x14 r8
65+
0x18 r9
66+
0x1C r10
67+
0x20 r11
68+
0x24 r0 Hardware stacked registers
69+
0x28 r1
70+
0x2C r2
71+
0x30 r3
72+
0x34 r12
73+
0x38 lr
74+
0x3C pc
75+
0x40 xPSR
76+
77+
FPU Stack Frame (only interrupted thread with FPU enabled):
78+
79+
Stack Offset Stack Contents
80+
81+
0x00 LR Interrupted LR (LR at time of PENDSV)
82+
0x04 s16 Software stacked FPU registers
83+
0x08 s17
84+
0x0C s18
85+
0x10 s19
86+
0x14 s20
87+
0x18 s21
88+
0x1C s22
89+
0x20 s23
90+
0x24 s24
91+
0x28 s25
92+
0x2C s26
93+
0x30 s27
94+
0x34 s28
95+
0x38 s29
96+
0x3C s30
97+
0x40 s31
98+
0x44 r4 Software stacked registers
99+
0x48 r5
100+
0x4C r6
101+
0x50 r7
102+
0x54 r8
103+
0x58 r9
104+
0x5C r10
105+
0x60 r11
106+
0x64 r0 Hardware stacked registers
107+
0x68 r1
108+
0x6C r2
109+
0x70 r3
110+
0x74 r12
111+
0x78 lr
112+
0x7C pc
113+
0x80 xPSR
114+
0x84 s0 Hardware stacked FPU registers
115+
0x88 s1
116+
0x8C s2
117+
0x90 s3
118+
0x94 s4
119+
0x98 s5
120+
0x9C s6
121+
0xA0 s7
122+
0xA4 s8
123+
0xA8 s9
124+
0xAC s10
125+
0xB0 s11
126+
0xB4 s12
127+
0xB8 s13
128+
0xBC s14
129+
0xC0 s15
130+
0xC4 fpscr
131+
132+
133+
6. Improving Performance
134+
135+
To make ThreadX and the application(s) run faster, you can enable
136+
all compiler optimizations.
137+
138+
In addition, you can eliminate the ThreadX basic API error checking by
139+
compiling your application code with the symbol TX_DISABLE_ERROR_CHECKING
140+
defined.
141+
142+
143+
7. Interrupt Handling
144+
145+
ThreadX provides complete and high-performance interrupt handling for Cortex-M55
146+
targets. There are a certain set of requirements that are defined in the
147+
following sub-sections:
148+
149+
150+
7.1 Vector Area
151+
152+
The Cortex-M55 vectors start at the label __Vectors or similar. The application may modify
153+
the vector area according to its needs. There is code in tx_initialize_low_level() that will
154+
configure the vector base register.
155+
156+
157+
7.2 Managed Interrupts
158+
159+
ISRs can be written completely in C (or assembly language) without any calls to
160+
_tx_thread_context_save or _tx_thread_context_restore. These ISRs are allowed access to the
161+
ThreadX API that is available to ISRs.
162+
163+
ISRs written in C will take the form (where "your_C_isr" is an entry in the vector table):
164+
165+
void your_C_isr(void)
166+
{
167+
168+
/* ISR processing goes here, including any needed function calls. */
169+
}
170+
171+
ISRs written in assembly language will take the form:
172+
173+
174+
.global your_assembly_isr
175+
.thumb_func
176+
your_assembly_isr:
177+
; VOID your_assembly_isr(VOID)
178+
; {
179+
PUSH {r0, lr}
180+
;
181+
; /* Do interrupt handler work here */
182+
; /* BL <your interrupt routine in C> */
183+
184+
POP {r0, lr}
185+
BX lr
186+
; }
187+
188+
Note: the Cortex-M55 requires exception handlers to be thumb labels, this implies bit 0 set.
189+
To accomplish this, the declaration of the label has to be preceded by the assembler directive
190+
.thumb_func to instruct the linker to create thumb labels. The label __tx_IntHandler needs to
191+
be inserted in the correct location in the interrupt vector table. This table is typically
192+
located in either your runtime startup file or in the tx_initialize_low_level.s file.
193+
194+
195+
8. FPU Support
196+
197+
ThreadX for Cortex-M55 supports automatic ("lazy") VFP support, which means that applications threads
198+
can simply use the VFP and ThreadX automatically maintains the VFP registers as part of the thread
199+
context.
200+
201+
202+
9. Revision History
203+
204+
For generic code revision information, please refer to the readme_threadx_generic.txt
205+
file, which is included in your distribution. The following details the revision
206+
information associated with this specific port of ThreadX:
207+
208+
06-02-2021 Release 6.1.7 changes:
209+
tx_port.h Remove unneeded include file
210+
tx_thread_secure_stack_initialize.S New file
211+
tx_thread_schedule.S Added secure stack initialize to SVC hander
212+
tx_thread_secure_stack.c Fixed stack pointer save, initialize in handler mode
213+
214+
04-02-2021 Release 6.1.6 changes:
215+
tx_port.h Updated macro definition
216+
tx_thread_schedule.s Added low power support
217+
218+
03-02-2021 The following files were changed/added for version 6.1.5:
219+
tx_port.h Added ULONG64_DEFINED
220+
221+
09-30-2020 Initial ThreadX 6.1 version for Cortex-M55 using AC6 tools.
222+
223+
224+
Copyright(c) 1996-2020 Microsoft Corporation
225+
226+
227+
https://azure.com/rtos
228+

0 commit comments

Comments
 (0)