HARMcksL: ARM HAL toolbox (yet STM32 oriented) 1.6
SMFSW collection of HAL hacks for STM32
Loading...
Searching...
No Matches
stack_check.c File Reference

Memory check utilities: heap/stack stats and collision detection. More...

#include <stdint.h>
#include "sarmfsw.h"
#include "stack_check.h"
Include dependency graph for stack_check.c:

Macros

#define PTR(x)
 Cast uintptr_t integer to pointer of 32b.

Functions

FctERR stack_check (memory_res_t *const pMem)
 Stack check routine.

Variables

uint8_t * __sbrk_heap_end
 heap break address (sysmem.c)
const uintptr_t _sdata
 data section start address (linker defined reference)
const uintptr_t _sheap
 heap start address (linker defined reference)
const uintptr_t _estack
 stack end address (linker defined reference)
const size_t _Min_Heap_Size
 minimum heap size (linker defined reference)
const size_t _Min_Stack_Size
 minimum stack size (linker defined reference)
const uint32_t _Stack_Fill_Value
 stack pattern fill value (linker defined reference)

Detailed Description

Memory check utilities: heap/stack stats and collision detection.

Author
SMFSW
Note
Define STACK_CHECK symbol at project level to use stack analysis
_Stack_Fill_Value has to be defined in linker script with 32b value to fill stack with (eg: _Stack_Fill_Value = 0xB00BFACE;)

Macro Definition Documentation

◆ PTR

#define PTR ( x)
Value:
((const uint32_t *) (x))

Cast uintptr_t integer to pointer of 32b.

Function Documentation

◆ stack_check()

FctERR stack_check ( memory_res_t *const pMem)

Stack check routine.

Parameters
[in,out]pMem- Pointer to stack memory check results
Returns
Error code
Return values
ERROR_OKif stack is OK
ERROR_MEMORYif stack overflow detected
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ __sbrk_heap_end

uint8_t* __sbrk_heap_end
extern

heap break address (sysmem.c)

!

Warning
static qualifier of __sbrk_heap_end may need to be commented in sysmem.c

◆ _estack

const uintptr_t _estack
extern

stack end address (linker defined reference)

◆ _Min_Heap_Size

const size_t _Min_Heap_Size
extern

minimum heap size (linker defined reference)

◆ _Min_Stack_Size

const size_t _Min_Stack_Size
extern

minimum stack size (linker defined reference)

◆ _sdata

const uintptr_t _sdata
extern

data section start address (linker defined reference)

◆ _sheap

const uintptr_t _sheap
extern

heap start address (linker defined reference)

◆ _Stack_Fill_Value

const uint32_t _Stack_Fill_Value
extern

stack pattern fill value (linker defined reference)