From f14b92b9e13c9cb9f54a1d740dbea1eeedeccb5b Mon Sep 17 00:00:00 2001 From: Dave Hylands Date: Wed, 12 Mar 2014 18:06:26 -0700 Subject: REPl working on UART6 with STMHAL --- stmhal/malloc0.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 stmhal/malloc0.c (limited to 'stmhal/malloc0.c') diff --git a/stmhal/malloc0.c b/stmhal/malloc0.c new file mode 100644 index 000000000..85a643f72 --- /dev/null +++ b/stmhal/malloc0.c @@ -0,0 +1,36 @@ +#include +#include "std.h" +#include "mpconfig.h" +#include "gc.h" + +#if 0 +static uint32_t mem = 0; + +void *malloc(size_t n) { + if (mem == 0) { + extern uint32_t _heap_start; + mem = (uint32_t)&_heap_start; // need to use big ram block so we can execute code from it (is it true that we can't execute from CCM?) + } + void *ptr = (void*)mem; + mem = (mem + n + 3) & (~3); + if (mem > 0x20000000 + 0x18000) { + void __fatal_error(const char*); + __fatal_error("out of memory"); + } + return ptr; +} + +void free(void *ptr) { +} + +void *realloc(void *ptr, size_t n) { + return malloc(n); +} + +#endif + +void __assert_func(void) { + printf("\nASSERT FAIL!"); + for (;;) { + } +} -- cgit v1.2.3