Permalink
Browse files

Added syscalls.c file

  • Loading branch information...
1 parent 4302a78 commit 8c99ca616436361a7116a31f3bdafa1ad4372798 @markusk committed Jan 15, 2012
Showing with 23 additions and 2 deletions.
  1. +0 −1 .gitignore
  2. +1 −1 direcsstm/stm32f4/Projects/usart/Makefile
  3. +22 −0 direcsstm/stm32f4/Projects/usart/syscalls.c
View
@@ -12,7 +12,6 @@ moc_*.cpp
*.bin
*.list
*.srec
-*.ld
*.lss
*.lst
*.map
@@ -26,7 +26,7 @@ all: $(BIN_IMAGE)
$(BIN_IMAGE): $(EXECUTABLE)
$(OBJCOPY) -O binary $^ $@
-$(EXECUTABLE): main.c usart.c system_stm32f4xx.c startup_stm32f4xx.s stm32f4xx_it.c
+$(EXECUTABLE): main.c usart.c system_stm32f4xx.c startup_stm32f4xx.s stm32f4xx_it.c syscalls.c
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
clean:
@@ -0,0 +1,22 @@
+/* based on a example-code from Keil for CS G++ */
+
+/* for caddr_t (typedef char * caddr_t;) */
+#include <sys/types.h>
+
+extern int __HEAP_START;
+
+caddr_t _sbrk ( int incr )
+{
+ static unsigned char *heap = NULL;
+ unsigned char *prev_heap;
+
+ if (heap == NULL) {
+ heap = (unsigned char *)&__HEAP_START;
+ }
+ prev_heap = heap;
+ /* check removed to show basic approach */
+
+ heap += incr;
+
+ return (caddr_t) prev_heap;
+}

0 comments on commit 8c99ca6

Please sign in to comment.