Skip to content

Added _Error_Handler(const char *, int) #164

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

Merged
merged 1 commit into from
Nov 30, 2017
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
8 changes: 0 additions & 8 deletions cores/arduino/pins_arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,6 @@

#include "PeripheralPins.h"

/**
* Libc porting layers
*/
#if defined ( __GNUC__ ) /* GCC CS3 */
#include <syscalls.h> /** RedHat Newlib minimal stub */
#define WEAK __attribute__ ((weak))
#endif

// Arduino digital pin alias
// GPIO port (A to K) * 16 pins: 176
enum {
Expand Down
23 changes: 23 additions & 0 deletions cores/arduino/stm32/stm32_def.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#include "stm32_def.h"

#ifdef __cplusplus
extern "C" {
#endif

/**
* @brief This function is executed in case of error occurrence.
* @param None
* @retval None
*/
WEAK void _Error_Handler(const char * msg, int val)
{
/* User can add his own implementation to report the HAL error return state */
printf("Error: %s (%i)\n", msg, val);
while(1)
{
}
}

#ifdef __cplusplus
}
#endif
14 changes: 14 additions & 0 deletions cores/arduino/stm32/stm32_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,25 @@
#define CAN1 CAN
#endif

/**
* Libc porting layers
*/
#if defined ( __GNUC__ ) /* GCC CS3 */
#include <syscalls.h> /** RedHat Newlib minimal stub */
#define WEAK __attribute__ ((weak))
#endif

#ifdef __cplusplus
extern "C"{
#endif // __cplusplus

// weaked functions declaration
void SystemClock_Config(void);

void _Error_Handler(const char *, int);

#define Error_Handler() _Error_Handler(__FILE__, __LINE__)

#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus
Expand Down