Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fatal error handler #191

Merged
merged 3 commits into from
Jun 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,17 @@
// - external dependencies
// --------------------------------------------------------------------------------------------------------------------

#include "stdlib.h"
#include "hal_core.h"
#undef DONTUSE_EOtheFatalError

#if !defined(DONTUSE_EOtheFatalError)
#include "EOtheFatalError.h"
#else
#include "EOtheErrorManager.h"
#include "EoError.h"
#include "hal_trace.h"
#include "hal_led.h"
#endif

#include "EOtheErrorManager.h"
#include "EoError.h"


// --------------------------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -80,11 +86,17 @@ const hal_core_cfg_t hal_cfg =
const hal_core_cfg_t *hal_coreCFGptr = &hal_cfg;


#include "hal_trace.h"
#include "hal_led.h"

static void s_hal_core_cfg_on_fatalerror(hal_fatalerror_t errorcode, const char * errormsg)
{
#if !defined(DONTUSE_EOtheFatalError)
// in here there is just a test of emission of ipc data w/ a restart
fatal_error_descriptor_t *des = eo_fatalerror_GetDescriptor(eo_fatalerror_GetHandle());
des->handlertype = fatalerror_handler_hal;
des->handlererrorcode = errorcode;
des->param = NULL;
eo_fatalerror_Restart(eo_fatalerror_GetHandle(), des);
#else
#warning DONTUSE_EOtheFatalError is defined, are you sure?
if(eobool_true == eo_errman_IsErrorHandlerConfigured(eo_errman_GetHandle()))
{
// ok ... use the error manager, either in its simple form or in its networked form
Expand Down Expand Up @@ -135,6 +147,8 @@ static void s_hal_core_cfg_on_fatalerror(hal_fatalerror_t errorcode, const char
hal_led_toggle(hal_led5);
}
}
#endif

}

#include "osal_base.h"
Expand All @@ -143,12 +157,66 @@ static void* myheap_new(uint32_t size)
{
return(osal_base_memory_new(size));
}

static void myheap_delete(void* mem)
{
osal_base_memory_del(mem);
}

#if !defined(DONTUSE_EOtheFatalError)

void hw_handler(fatal_error_handler_t feh)
{
fatal_error_descriptor_t *des = eo_fatalerror_GetDescriptor(eo_fatalerror_GetHandle());
des->handlertype = feh;
des->handlererrorcode = 100;
des->forfutureuse0 = 0x12;
des->forfutureuse1 = 0x23;
des->param = NULL;
eo_fatalerror_Restart(eo_fatalerror_GetHandle(), des);
}

void NMI_Handler(void)
{
hw_handler(fatalerror_handler_hw_NMI);
}

void HardFault_Handler(void)
{
hw_handler(fatalerror_handler_hw_HardFault);
}

void MemManage_Handler(void)
{
hw_handler(fatalerror_handler_hw_MemManage);
}

void BusFault_Handler(void)
{
hw_handler(fatalerror_handler_hw_BusFault);
}

void UsageFault_Handler(void)
{
hw_handler(fatalerror_handler_hw_UsageFault);
}

void DebugMon_Handler(void)
{
hw_handler(fatalerror_handler_hw_DebugMon);
}

void Default_Handler(void)
{
hw_handler(fatalerror_handler_hw_Default);
}

void RTC_Alarm_IRQHandler(void)
{
hw_handler(fatalerror_handler_hw_Default);
}

#endif


// --------------------------------------------------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,22 @@
// - external dependencies
// --------------------------------------------------------------------------------------------------------------------

#include "EOtheErrorManager.h"
#include "EoError.h"
#undef DONTUSE_EOtheFatalError


#include "ipal.h"
#if !defined(DONTUSE_EOtheFatalError)
#include "EOtheFatalError.h"
#else
#include "EOtheErrorManager.h"
#include "EoError.h"
#include "hal_trace.h"
#include "hal_led.h"
#endif


#include "ipal.h"
#include "hal.h"
#include "osal.h"


// --------------------------------------------------------------------------------------------------------------------
// - declaration of extern public interface
// --------------------------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -169,7 +174,14 @@ static void onethframerx(void)

static void s_ipal_cfg_on_fatal_error(ipal_fatalerror_t errorcode, const char * errormsg)
{

#if !defined(DONTUSE_EOtheFatalError)
fatal_error_descriptor_t *des = eo_fatalerror_GetDescriptor(eo_fatalerror_GetHandle());
des->handlertype = fatalerror_handler_ipal;
des->handlererrorcode = errorcode;
des->param = NULL;
eo_fatalerror_Restart(eo_fatalerror_GetHandle(), des);
#else
#warning DONTUSE_EOtheFatalError is defined, are you sure?
char str[256];

if(eobool_true == eo_errman_IsErrorHandlerConfigured(eo_errman_GetHandle()))
Expand Down Expand Up @@ -218,6 +230,7 @@ static void s_ipal_cfg_on_fatal_error(ipal_fatalerror_t errorcode, const char *
hal_led_toggle(hal_led5);
}
}
#endif
}


Expand Down
34 changes: 22 additions & 12 deletions emBODY/eBcode/arch-arm/board/ems004/appl/v2/cfg/abslayer/osal_cfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,22 @@
// - external dependencies
// --------------------------------------------------------------------------------------------------------------------

#include "stdio.h"
#include "string.h"
#include "osal.h"
#include "osal_arch_arm.h"
#include "hal_trace.h"
#include "stdlib.h"
#undef DONTUSE_EOtheFatalError

#if !defined(DONTUSE_EOtheFatalError)
#include "EOtheFatalError.h"
#else
#include "EOtheErrorManager.h"
#include "EoError.h"
#include "hal_trace.h"
#include "hal_sys.h"
#include "hal_led.h"
#endif

#include "hal_led.h"
#include "hal_sys.h"

#include "EOtheErrorManager.h"
#include "EoError.h"
#include "osal.h"
#include "osal_arch_arm.h"

#include "embOBJporting.h"

// --------------------------------------------------------------------------------------------------------------------
// - declaration of extern public interface
Expand Down Expand Up @@ -112,6 +114,14 @@ const osal_cfg_t *osal_cfgMINEX = &osal_cfg;

static void s_osal_cfg_on_fatal_error(void* task, osal_fatalerror_t errorcode, const char * errormsg)
{
#if !defined(DONTUSE_EOtheFatalError)
fatal_error_descriptor_t *des = eo_fatalerror_GetDescriptor(eo_fatalerror_GetHandle());
des->handlertype = fatalerror_handler_osal;
des->handlererrorcode = errorcode;
des->param = task;
eo_fatalerror_Restart(eo_fatalerror_GetHandle(), des);
#else
#warning DONTUSE_EOtheFatalError is defined, are you sure?
uint8_t tskid = 0;
char str[64];
osal_task_id_get((osal_task_t*)task, &tskid);
Expand Down Expand Up @@ -163,7 +173,7 @@ static void s_osal_cfg_on_fatal_error(void* task, osal_fatalerror_t errorcode, c
hal_led_toggle(hal_led5);
}
}

#endif
}

static void s_osal_cfg_on_idle(void)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ extern "C" {
#define EOMTHEEMSAPPLCFG_VERSION_MAJOR 3
// <o> minor <0-255>
// <o> minor <0-255>
#define EOMTHEEMSAPPLCFG_VERSION_MINOR 41
#define EOMTHEEMSAPPLCFG_VERSION_MINOR 42

// </h>version

Expand All @@ -85,9 +85,9 @@ extern "C" {
// <o> month <1-12>
#define EOMTHEEMSAPPLCFG_BUILDDATE_MONTH 6
// <o> day <1-31>
#define EOMTHEEMSAPPLCFG_BUILDDATE_DAY 9
#define EOMTHEEMSAPPLCFG_BUILDDATE_DAY 22
// <o> hour <0-23>
#define EOMTHEEMSAPPLCFG_BUILDDATE_HOUR 17
#define EOMTHEEMSAPPLCFG_BUILDDATE_HOUR 10
// <o> minute <0-59>
#define EOMTHEEMSAPPLCFG_BUILDDATE_MIN 11
// </h>build date
Expand Down
Loading