Address STM32 cppcheck warnings (#11314)
- Suppress GenericThreadModule warning when DEBUG_MUTE - Suppress warning stemming from check_skip_packages - Cast pointers to uint32_t before subtracting to avoid cppcheck warning
This commit is contained in:
3 files changed
+10
-1
No files matched your search
+4
-1
@@ -23,7 +23,10 @@ static uint32_t sbrkHeadroom()
|
||||
extern char _estack;
|
||||
extern char _Min_Stack_Size;
|
||||
|
||||
uint32_t max_sp = (uint32_t)(&_estack - &_Min_Stack_Size);
|
||||
// Both are linker-script symbols rather than real objects: _estack is the top-of-RAM address and
|
||||
// _Min_Stack_Size is a plain value. Convert each to an integer before subtracting - differencing the
|
||||
// pointers themselves is pointer arithmetic across unrelated objects.
|
||||
uint32_t max_sp = (uint32_t)&_estack - (uint32_t)&_Min_Stack_Size;
|
||||
uint32_t heap_end = (uint32_t)sbrk(0);
|
||||
return (max_sp > heap_end) ? (max_sp - heap_end) : 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user