move causeHardFault() to arm_common.cpp

This commit is contained in:
andreika-git 2023-11-14 23:05:22 +02:00 committed by rusefillc
parent 08b6c3e25a
commit 04779c374f
6 changed files with 24 additions and 30 deletions

View File

@ -15,6 +15,7 @@ HW_LAYER_CPP = \
$(PROJECT_DIR)/hw_layer/digital_input/trigger/trigger_input_exti.cpp \
$(PROJECT_DIR)/hw_layer/digital_input/trigger/trigger_input_adc.cpp \
$(PROJECT_DIR)/hw_layer/hardware.cpp \
$(PROJECT_DIR)/hw_layer/ports/arm_common.cpp \
$(PROJECT_DIR)/hw_layer/kline.cpp \
$(PROJECT_DIR)/hw_layer/mmc_card.cpp \
$(PROJECT_DIR)/hw_layer/adc/adc_inputs.cpp \

View File

@ -0,0 +1,23 @@
/**
* @file arm_common.cpp
* @brief Low level common ARM code
*
* @date Nov 14, 2023
* @author Andrey Belomutskiy, (c) 2012-2023
* @author andreika <prometheus.pcb@gmail.com>
*/
#include "pch.h"
#if EFI_PROD_CODE
#include "mpu_util.h"
#endif /* EFI_PROD_CODE */
void causeHardFault() {
#if EFI_PROD_CODE
// Set the function pointer to an invalid address
void (*invalidFunction)() = (void(*)())0xDEADBEEF;
// Calling the invalid function will trigger a hard fault
invalidFunction();
#endif /* EFI_PROD_CODE */
}

View File

@ -138,13 +138,6 @@ void baseMCUInit(void) {
BOR_Set(BOR_Level_1); // one step above default value
}
void causeHardFault() {
// Set the function pointer to an invalid address
void (*invalidFunction)() = (void(*)())0xDEADBEEF;
// Calling the invalid function will trigger a hard fault
invalidFunction();
}
/* used to detect additional RAM available for LUA
* TODO: find RAM on AT32
* TODO: better name */

View File

@ -24,13 +24,6 @@ extern "C" {
void baseMCUInit(void) {
}
void causeHardFault() {
// Set the function pointer to an invalid address
void (*invalidFunction)() = (void(*)())0xDEADBEEF;
// Calling the invalid function will trigger a hard fault
invalidFunction();
}
void _unhandled_exception(void) {
/*lint -restore*/

View File

@ -16,13 +16,6 @@
void baseMCUInit(void) {
}
void causeHardFault() {
// Set the function pointer to an invalid address
void (*invalidFunction)() = (void(*)())0xDEADBEEF;
// Calling the invalid function will trigger a hard fault
invalidFunction();
}
void _unhandled_exception(void) {
/*lint -restore*/

View File

@ -110,15 +110,6 @@ void baseMCUInit(void) {
BOR_Set(BOR_Level_1); // one step above default value
}
void causeHardFault() {
#if EFI_PROD_CODE
// Set the function pointer to an invalid address
void (*invalidFunction)() = (void(*)())0xDEADBEEF;
// Calling the invalid function will trigger a hard fault
invalidFunction();
#endif /* EFI_PROD_CODE */
}
extern uint32_t __main_stack_base__;
typedef struct port_intctx intctx_t;