Skip to content

Commit 2092e40

Browse files
authored
Merge pull request #8332 from SenRamakri/sen_RefactorFaultHandler
Refactoring fault handler implementation
2 parents 5b25b66 + 230ba03 commit 2092e40

File tree

5 files changed

+9
-18
lines changed

5 files changed

+9
-18
lines changed

rtos/TARGET_CORTEX/TARGET_CORTEX_M/TOOLCHAIN_ARM/except.S renamed to cmsis/TARGET_CORTEX_M/TOOLCHAIN_ARM/except.S

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ UsageFault_Handler\
6868
Fault_Handler PROC
6969
EXPORT Fault_Handler
7070
#if (DOMAIN_NS == 1)
71-
IMPORT osRtxInfo
7271
IMPORT mbed_fault_handler
7372
IMPORT mbed_fault_context
7473
@@ -149,11 +148,9 @@ Fault_Handler_Continue2
149148
ADDS R1,#4
150149
MRS R2,CONTROL ; Get CONTROL Reg
151150
STR R2,[R1]
152-
LDR R3,=mbed_fault_handler ; Load address of mbedFaultHandler
153151
MOV R0,R12
154152
LDR R1,=mbed_fault_context
155-
LDR R2,=osRtxInfo
156-
BLX R3
153+
BL mbed_fault_handler
157154
#endif
158155
B . ; Just in case we come back here
159156
ENDP

rtos/TARGET_CORTEX/TARGET_CORTEX_M/TOOLCHAIN_GCC/except.S renamed to cmsis/TARGET_CORTEX_M/TOOLCHAIN_GCC/except.S

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,11 +181,9 @@ Fault_Handler_Continue2:
181181
ADDS R1,#4
182182
MRS R2,CONTROL // Get CONTROL Reg
183183
STR R2,[R1]
184-
LDR R3,=mbed_fault_handler // Load address of mbedFaultHandler
185184
MOV R0,R12
186185
LDR R1,=mbed_fault_context
187-
LDR R2,=osRtxInfo
188-
BLX R3
186+
BL mbed_fault_handler
189187
#endif
190188
B . // Just in case we come back here
191189

rtos/TARGET_CORTEX/TARGET_CORTEX_M/TOOLCHAIN_IAR/except.S renamed to cmsis/TARGET_CORTEX_M/TOOLCHAIN_IAR/except.S

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ UsageFault_Handler
6363
Fault_Handler
6464
EXPORT Fault_Handler
6565
#if (DOMAIN_NS == 1)
66-
IMPORT osRtxInfo
6766
IMPORT mbed_fault_context
6867
IMPORT mbed_fault_handler
6968
@@ -144,11 +143,9 @@ Fault_Handler_Continue2
144143
ADDS R1,#4
145144
MRS R2,CONTROL ; Get CONTROL Reg
146145
STR R2,[R1]
147-
LDR R3,=mbed_fault_handler ; Load address of mbedFaultHandler
148146
MOV R0,R12
149147
LDR R1,=mbed_fault_context
150-
LDR R2,=osRtxInfo
151-
BLX R3
148+
BL mbed_fault_handler
152149
#endif
153150
B . ; Just in case we come back here
154151
#endif ; #if (MBED_FAULT_HANDLER_SUPPORT == 1)

rtos/TARGET_CORTEX/TARGET_CORTEX_M/mbed_rtx_fault_handler.c renamed to cmsis/TARGET_CORTEX_M/mbed_fault_handler.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,12 @@
1414
* limitations under the License.
1515
*/
1616

17-
#include "rtx_os.h"
1817
#include "device.h"
1918
#include "platform/mbed_error.h"
2019
#include "platform/mbed_interface.h"
2120

2221
#ifndef MBED_FAULT_HANDLER_DISABLED
23-
#include "mbed_rtx_fault_handler.h"
22+
#include "mbed_fault_handler.h"
2423

2524
//Functions Prototypes
2625
void print_context_info(void);
@@ -30,7 +29,7 @@ mbed_fault_context_t mbed_fault_context;
3029

3130
//This is a handler function called from Fault handler to print the error information out.
3231
//This runs in fault context and uses special functions(defined in mbed_rtx_fault_handler.c) to print the information without using C-lib support.
33-
void mbed_fault_handler (uint32_t fault_type, void *mbed_fault_context_in, void *osRtxInfoIn)
32+
void mbed_fault_handler (uint32_t fault_type, void *mbed_fault_context_in)
3433
{
3534
mbed_error_status_t faultStatus = MBED_SUCCESS;
3635

rtos/TARGET_CORTEX/TARGET_CORTEX_M/mbed_rtx_fault_handler.h renamed to cmsis/TARGET_CORTEX_M/mbed_fault_handler.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
* limitations under the License.
1515
*/
1616

17-
#ifndef MBED_RTX_FAULT_HANDLER_H
18-
#define MBED_RTX_FAULT_HANDLER_H
17+
#ifndef MBED_FAULT_HANDLER_H
18+
#define MBED_FAULT_HANDLER_H
1919

2020
//Fault context struct
2121
//WARNING: DO NOT CHANGE THIS STRUCT WITHOUT MAKING CORRESPONDING CHANGES in except.S files.
@@ -52,7 +52,7 @@ typedef struct {
5252
#define USAGE_FAULT_EXCEPTION (0x40)
5353

5454
//This is a handler function called from Fault handler to print the error information out.
55-
//This runs in fault context and uses special functions(defined in mbed_rtx_fault_handler.c) to print the information without using C-lib support.
56-
void mbed_fault_handler (uint32_t fault_type, void *mbed_fault_context_in, void *osRtxInfoIn);
55+
//This runs in fault context and uses special functions(defined in mbed_fault_handler.c) to print the information without using C-lib support.
56+
void mbed_fault_handler (uint32_t fault_type, void *mbed_fault_context_in);
5757

5858
#endif

0 commit comments

Comments
 (0)