summaryrefslogtreecommitdiff
path: root/sw/Core/Src/sysmem.c
diff options
context:
space:
mode:
Diffstat (limited to 'sw/Core/Src/sysmem.c')
-rwxr-xr-xsw/Core/Src/sysmem.c58
1 files changed, 58 insertions, 0 deletions
diff --git a/sw/Core/Src/sysmem.c b/sw/Core/Src/sysmem.c
new file mode 100755
index 0000000..4665417
--- /dev/null
+++ b/sw/Core/Src/sysmem.c
@@ -0,0 +1,58 @@
+/**
+ ******************************************************************************
+ * @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
+ *
+ * <h2><center>&copy; Copyright (c) 2020 STMicroelectronics.
+ * All rights reserved.</center></h2>
+ *
+ * This software component is licensed by ST under BSD 3-Clause license,
+ * the "License"; You may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at:
+ * opensource.org/licenses/BSD-3-Clause
+ *
+ ******************************************************************************
+ */
+
+/* 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;
+}
+