• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..--

inc/11-Mar-2024-510204

src/11-Mar-2024-4,0311,629

readme_threadx.txtD11-Mar-20245.5 KiB159103

readme_threadx.txt

1                       Microsoft's Azure RTOS ThreadX for Cortex-M23
2
3                                   Using the IAR Tools
4
5
61.  Building the ThreadX run-time Library
7
8Import all ThreadX common and port-specific source files into an IAR project.
9Configure the project to build a library rather than an executable. This
10results in the ThreadX run-time library file tx.a, which is needed by
11the application.
12Files tx_thread_stack_error_handler.c and tx_thread_stack_error_notify.c
13replace the common files of the same name.
14
152.  Demonstration System
16
17No demonstration is provided because the IAR EWARM 8.50 simulator does
18not simulate the Cortex-M23 correctly.
19
20
213.  System Initialization
22
23The entry point in ThreadX for the Cortex-M23 using IAR tools is at label
24__iar_program_start. This is defined within the IAR compiler's startup code.
25In addition, this is where all static and global preset C variable
26initialization processing takes place.
27
28The ThreadX tx_initialize_low_level.s file is responsible for setting up
29various system data structures, and a periodic timer interrupt source.
30
31The _tx_initialize_low_level function inside of tx_initialize_low_level.s
32also determines the first available address for use by the application, which
33is supplied as the sole input parameter to your application definition function,
34tx_application_define. To accomplish this, a section is created in
35tx_initialize_low_level.s called FREE_MEM, which must be located after all
36other RAM sections in memory.
37
38
394.  Register Usage and Stack Frames
40
41The following defines the saved context stack frames for context switches
42that occur as a result of interrupt handling or from thread-level API calls.
43All suspended threads have the same stack frame in the Cortex-M23 version of
44ThreadX. The top of the suspended thread's stack is pointed to by
45tx_thread_stack_ptr in the associated thread control block TX_THREAD.
46
47  Stack Offset     Stack Contents
48
49     0x00               LR          Interrupted LR (LR at time of PENDSV)
50     0x04               r8
51     0x08               r9
52     0x0C               r10
53     0x10               r11
54     0x14               r4
55     0x18               r5
56     0x1C               r6
57     0x20               r7
58     0x24               r0          (Hardware stack starts here!!)
59     0x28               r1
60     0x2C               r2
61     0x30               r3
62     0x34               r12
63     0x38               lr
64     0x3C               pc
65     0x40               xPSR
66
67
685.  Improving Performance
69
70To make ThreadX and the application(s) run faster, you can enable
71all compiler optimizations.
72
73In addition, you can eliminate the ThreadX basic API error checking by
74compiling your application code with the symbol TX_DISABLE_ERROR_CHECKING
75defined.
76
77
786.  Interrupt Handling
79
80The Cortex-M23 vectors start at the label __vector_table and is typically defined in a
81startup.s file (or similar). The application may modify the vector area according to its needs.
82
83
846.1 Managed Interrupts
85
86ISRs for Cortex-M using the IAR tools can be written completely in C (or assembly
87language) without any calls to _tx_thread_context_save or _tx_thread_context_restore.
88These ISRs are allowed access to the ThreadX API that is available to ISRs.
89
90ISRs written in C will take the form (where "your_C_isr" is an entry in the vector table):
91
92void    your_C_isr(void)
93{
94
95    /* ISR processing goes here, including any needed function calls.  */
96}
97
98ISRs written in assembly language will take the form:
99
100    PUBLIC  your_assembly_isr
101your_assembly_isr:
102
103    PUSH    {r0, lr}
104
105    ; ISR processing goes here, including any needed function calls.
106
107    POP     {r0, r1}
108    MOV     lr, r1
109    BX      lr
110
111
1127.  IAR Thread-safe Library Support
113
114Thread-safe support for the IAR tools is easily enabled by building the ThreadX library
115and the application with TX_ENABLE_IAR_LIBRARY_SUPPORT. Also, the linker control file
116should have the following line added (if not already in place):
117
118initialize by copy with packing = none { section __DLIB_PERTHREAD }; // Required in a multi-threaded application
119
120
1217.  IAR Thread-safe Library Support
122
123Thread-safe support for the IAR tools is easily enabled by building the ThreadX library
124and the application with TX_ENABLE_IAR_LIBRARY_SUPPORT. Also, the linker control file
125should have the following line added (if not already in place):
126
127initialize by copy with packing = none { section __DLIB_PERTHREAD }; // Required in a multi-threaded application
128
129The project options "General Options -> Library Configuration" should also have the
130"Enable thread support in library" box selected.
131
132
1338.  Revision History
134
135For generic code revision information, please refer to the readme_threadx_generic.txt
136file, which is included in your distribution. The following details the revision
137information associated with this specific port of ThreadX:
138
13906-02-2021  Release 6.1.7 changes:
140            tx_thread_secure_stack_initialize.s New file
141            tx_thread_schedule.s                Added secure stack initialize to SVC hander
142            tx_thread_secure_stack.c            Fixed stack pointer save, initialize in handler mode
143
14404-02-2021  Release 6.1.6 changes:
145            tx_port.h                           Updated macro definition
146            tx_thread_schedule.s                Added low power support
147
14803-02-2021  The following files were changed/added for version 6.1.5:
149            tx_port.h                       Added ULONG64_DEFINED
150
15109-30-2020  Initial ThreadX 6.1 version for Cortex-M23 using IAR's ARM tools.
152
153
154Copyright(c) 1996-2020 Microsoft Corporation
155
156
157https://azure.com/rtos
158
159