diff options
Diffstat (limited to 'Projects/P-NUCLEO-WB55.Nucleo/Applications/Thread/Thread_RCP_Cli_Cmd/STM32CubeIDE/Application/User/sysmem.c')
-rw-r--r-- | Projects/P-NUCLEO-WB55.Nucleo/Applications/Thread/Thread_RCP_Cli_Cmd/STM32CubeIDE/Application/User/sysmem.c | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/Projects/P-NUCLEO-WB55.Nucleo/Applications/Thread/Thread_RCP_Cli_Cmd/STM32CubeIDE/Application/User/sysmem.c b/Projects/P-NUCLEO-WB55.Nucleo/Applications/Thread/Thread_RCP_Cli_Cmd/STM32CubeIDE/Application/User/sysmem.c new file mode 100644 index 000000000..e5f94e4e1 --- /dev/null +++ b/Projects/P-NUCLEO-WB55.Nucleo/Applications/Thread/Thread_RCP_Cli_Cmd/STM32CubeIDE/Application/User/sysmem.c @@ -0,0 +1,57 @@ +/** + ****************************************************************************** + * @file sysmem.c + * @author Auto-generated by STM32CubeIDE + * @brief STM32CubeIDE Minimal System Memory calls file + * + * For more information about which c-functions + * need which of these lowlevel functions + * please consult the Newlib libc-manual + ****************************************************************************** + * @attention + * + * Copyright (c) 2020-2021 STMicroelectronics. + * All rights reserved. + * + * This software is licensed under terms that can be found in the LICENSE file + * in the root directory of this software component. + * If no LICENSE file comes with this software, it is provided AS-IS. + * + ****************************************************************************** + */ + +/* Includes */ +#include <errno.h> +#include <stdio.h> + +/* Variables */ +extern int errno; +register char * stack_ptr asm("sp"); + +/* Functions */ + +/** + _sbrk + Increase program data space. Malloc and related functions depend on this +**/ +caddr_t _sbrk(int incr) +{ + extern char end asm("end"); + static char *heap_end; + char *prev_heap_end; + + if (heap_end == 0) + heap_end = &end; + + prev_heap_end = heap_end; + if (heap_end + incr > stack_ptr) + { + errno = ENOMEM; + return (caddr_t) -1; + } + + heap_end += incr; + + return (caddr_t) prev_heap_end; +} + |