diff options
author | Damien George <damien.p.george@gmail.com> | 2014-03-13 10:17:51 +0000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-03-13 10:17:51 +0000 |
commit | 659c19c67c00b156cb6890f926d5cc012d129f24 (patch) | |
tree | 303a4e00c9612951c8ab3cfbe926121724173fd1 /stmhal/malloc0.c | |
parent | 19438fd30a3184b656221a59062ea32453d0fd16 (diff) | |
parent | f14b92b9e13c9cb9f54a1d740dbea1eeedeccb5b (diff) | |
download | micropython-659c19c67c00b156cb6890f926d5cc012d129f24.tar.gz micropython-659c19c67c00b156cb6890f926d5cc012d129f24.zip |
Merge pull request #342 from dhylands/stmhal-repl
REPL working on UART6 with STMHAL
Diffstat (limited to 'stmhal/malloc0.c')
-rw-r--r-- | stmhal/malloc0.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/stmhal/malloc0.c b/stmhal/malloc0.c new file mode 100644 index 0000000000..85a643f72d --- /dev/null +++ b/stmhal/malloc0.c @@ -0,0 +1,36 @@ +#include <stdint.h> +#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 (;;) { + } +} |