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

feat: provide default functions only if requested #71

Merged
merged 1 commit into from
Jul 25, 2024
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
13 changes: 11 additions & 2 deletions src/FreeRTOSConfig_Default.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,16 @@
* -1 for heap_useNewlib_ST.c
* Default -1 see heap.c
*/
/*#define configMEMMANG_HEAP_NB 3*/
/* #define configMEMMANG_HEAP_NB 3 */

/* Set to 1 to use default blink hook if configUSE_MALLOC_FAILED_HOOK is 1 */
#ifndef configUSE_MALLOC_FAILED_HOOK_BLINK
#define configUSE_MALLOC_FAILED_HOOK_BLINK 0
#endif
/* Set to 1 to used default blink if configCHECK_FOR_STACK_OVERFLOW is 1 or 2 */
#ifndef configCHECK_FOR_STACK_OVERFLOW_BLINK
#define configCHECK_FOR_STACK_OVERFLOW_BLINK 0
#endif

/* configUSE_CMSIS_RTOS_V2 has to be defined and set to 1 to use CMSIS-RTOSv2 */
/*#define configUSE_CMSIS_RTOS_V2 1*/
Expand Down Expand Up @@ -218,7 +227,7 @@ header file. */
/*
* IMPORTANT:
* SysTick_Handler() from stm32duino core is calling weak osSystickHandler().
* Both CMSIS-RTOSv2 and CMSIS-RTOS override osSystickHandler()
* Both CMSIS-RTOSv2 and CMSIS-RTOS override osSystickHandler()
* which is calling xPortSysTickHandler(), defined in respective CortexM-x port
*/
/* #define xPortSysTickHandler SysTick_Handler */
Expand Down
18 changes: 9 additions & 9 deletions src/STM32FreeRTOS.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,12 @@ void assertBlink() {
errorBlink(1);
}
//------------------------------------------------------------------------------
#if ( configUSE_MALLOC_FAILED_HOOK == 1 )
#if ( ( configUSE_MALLOC_FAILED_HOOK == 1 ) && ( configUSE_MALLOC_FAILED_HOOK_BLINK == 1 ) )
/** vApplicationMallocFailedHook()
Blink two short pulses if malloc fails.

will only be called if
configUSE_MALLOC_FAILED_HOOK is set to 1 in FreeRTOSConfig.h. It is a hook
function that will get called if a call to pvPortMalloc() fails.
Blink two short pulses if malloc fails. Itwill only be called if
configUSE_MALLOC_FAILED_HOOK is set to 1 and
configUSE_MALLOC_FAILED_HOOK_BLINK defined in FreeRTOSConfig.h.
It is a hook function that will get called if a call to pvPortMalloc() fails.
pvPortMalloc() is called internally by the kernel whenever a task, queue,
timer or semaphore is created. It is also called by various parts of the
demo application. If heap_1.c or heap_2.c are used, then the size of the
Expand Down Expand Up @@ -87,11 +86,12 @@ void __attribute__((weak)) vApplicationIdleHook( void ) {
#endif /* configUSE_IDLE_HOOK == 1 */

/*-----------------------------------------------------------*/
#if ( configCHECK_FOR_STACK_OVERFLOW >= 1 )
#if ( ( configCHECK_FOR_STACK_OVERFLOW >= 1 ) && ( configCHECK_FOR_STACK_OVERFLOW_BLINK == 1 ) )
/** Blink three short pulses if stack overflow is detected.
Run time stack overflow checking is performed if
configCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2. This hook
function is called if a stack overflow is detected.
configCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2 and
configCHECK_FOR_STACK_OVERFLOW_BLINK is defined.
This hook function is called if a stack overflow is detected.
\param[in] pxTask Task handle
\param[in] pcTaskName Task name
*/
Expand Down