Merge pull request #8332 from SenRamakri/sen_RefactorFaultHandler

Refactoring fault handler implementation
pull/8531/head
Martin Kojtal 2018-10-24 14:12:45 +01:00 committed by GitHub
commit 2092e40b30
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 9 additions and 18 deletions

View File

@ -68,7 +68,6 @@ UsageFault_Handler\
Fault_Handler PROC Fault_Handler PROC
EXPORT Fault_Handler EXPORT Fault_Handler
#if (DOMAIN_NS == 1) #if (DOMAIN_NS == 1)
IMPORT osRtxInfo
IMPORT mbed_fault_handler IMPORT mbed_fault_handler
IMPORT mbed_fault_context IMPORT mbed_fault_context
@ -149,11 +148,9 @@ Fault_Handler_Continue2
ADDS R1,#4 ADDS R1,#4
MRS R2,CONTROL ; Get CONTROL Reg MRS R2,CONTROL ; Get CONTROL Reg
STR R2,[R1] STR R2,[R1]
LDR R3,=mbed_fault_handler ; Load address of mbedFaultHandler
MOV R0,R12 MOV R0,R12
LDR R1,=mbed_fault_context LDR R1,=mbed_fault_context
LDR R2,=osRtxInfo BL mbed_fault_handler
BLX R3
#endif #endif
B . ; Just in case we come back here B . ; Just in case we come back here
ENDP ENDP

View File

@ -181,11 +181,9 @@ Fault_Handler_Continue2:
ADDS R1,#4 ADDS R1,#4
MRS R2,CONTROL // Get CONTROL Reg MRS R2,CONTROL // Get CONTROL Reg
STR R2,[R1] STR R2,[R1]
LDR R3,=mbed_fault_handler // Load address of mbedFaultHandler
MOV R0,R12 MOV R0,R12
LDR R1,=mbed_fault_context LDR R1,=mbed_fault_context
LDR R2,=osRtxInfo BL mbed_fault_handler
BLX R3
#endif #endif
B . // Just in case we come back here B . // Just in case we come back here

View File

@ -63,7 +63,6 @@ UsageFault_Handler
Fault_Handler Fault_Handler
EXPORT Fault_Handler EXPORT Fault_Handler
#if (DOMAIN_NS == 1) #if (DOMAIN_NS == 1)
IMPORT osRtxInfo
IMPORT mbed_fault_context IMPORT mbed_fault_context
IMPORT mbed_fault_handler IMPORT mbed_fault_handler
@ -144,11 +143,9 @@ Fault_Handler_Continue2
ADDS R1,#4 ADDS R1,#4
MRS R2,CONTROL ; Get CONTROL Reg MRS R2,CONTROL ; Get CONTROL Reg
STR R2,[R1] STR R2,[R1]
LDR R3,=mbed_fault_handler ; Load address of mbedFaultHandler
MOV R0,R12 MOV R0,R12
LDR R1,=mbed_fault_context LDR R1,=mbed_fault_context
LDR R2,=osRtxInfo BL mbed_fault_handler
BLX R3
#endif #endif
B . ; Just in case we come back here B . ; Just in case we come back here
#endif ; #if (MBED_FAULT_HANDLER_SUPPORT == 1) #endif ; #if (MBED_FAULT_HANDLER_SUPPORT == 1)

View File

@ -14,13 +14,12 @@
* limitations under the License. * limitations under the License.
*/ */
#include "rtx_os.h"
#include "device.h" #include "device.h"
#include "platform/mbed_error.h" #include "platform/mbed_error.h"
#include "platform/mbed_interface.h" #include "platform/mbed_interface.h"
#ifndef MBED_FAULT_HANDLER_DISABLED #ifndef MBED_FAULT_HANDLER_DISABLED
#include "mbed_rtx_fault_handler.h" #include "mbed_fault_handler.h"
//Functions Prototypes //Functions Prototypes
void print_context_info(void); void print_context_info(void);
@ -30,7 +29,7 @@ mbed_fault_context_t mbed_fault_context;
//This is a handler function called from Fault handler to print the error information out. //This is a handler function called from Fault handler to print the error information out.
//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. //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.
void mbed_fault_handler (uint32_t fault_type, void *mbed_fault_context_in, void *osRtxInfoIn) void mbed_fault_handler (uint32_t fault_type, void *mbed_fault_context_in)
{ {
mbed_error_status_t faultStatus = MBED_SUCCESS; mbed_error_status_t faultStatus = MBED_SUCCESS;

View File

@ -14,8 +14,8 @@
* limitations under the License. * limitations under the License.
*/ */
#ifndef MBED_RTX_FAULT_HANDLER_H #ifndef MBED_FAULT_HANDLER_H
#define MBED_RTX_FAULT_HANDLER_H #define MBED_FAULT_HANDLER_H
//Fault context struct //Fault context struct
//WARNING: DO NOT CHANGE THIS STRUCT WITHOUT MAKING CORRESPONDING CHANGES in except.S files. //WARNING: DO NOT CHANGE THIS STRUCT WITHOUT MAKING CORRESPONDING CHANGES in except.S files.
@ -52,7 +52,7 @@ typedef struct {
#define USAGE_FAULT_EXCEPTION (0x40) #define USAGE_FAULT_EXCEPTION (0x40)
//This is a handler function called from Fault handler to print the error information out. //This is a handler function called from Fault handler to print the error information out.
//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. //This runs in fault context and uses special functions(defined in mbed_fault_handler.c) to print the information without using C-lib support.
void mbed_fault_handler (uint32_t fault_type, void *mbed_fault_context_in, void *osRtxInfoIn); void mbed_fault_handler (uint32_t fault_type, void *mbed_fault_context_in);
#endif #endif