aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarti Bolivar <mbolivar@leaflabs.com>2011-09-20 18:19:34 -0400
committerMarti Bolivar <mbolivar@leaflabs.com>2011-09-20 18:36:06 -0400
commitea004e377421d6b9142ef1a8a3ba0193c2888918 (patch)
treeb8aa8918a4cbc8828a55cb210be8284d411c643b
parent06e210a109333edc5c5deb8df52b28f6a23ff075 (diff)
downloadlibrambutan-ea004e377421d6b9142ef1a8a3ba0193c2888918.tar.gz
librambutan-ea004e377421d6b9142ef1a8a3ba0193c2888918.zip
faq: Fix question on dynamic memory.
As of libmaple v0.0.12, dynamic memory is officially supported. Fix the FAQ on malloc() etc. not working to reflect this.
-rw-r--r--source/faq.rst24
1 files changed, 19 insertions, 5 deletions
diff --git a/source/faq.rst b/source/faq.rst
index 4b5b605..da67370 100644
--- a/source/faq.rst
+++ b/source/faq.rst
@@ -21,11 +21,25 @@ of its headers.
.. _faq-dynamic-memory:
-Why don't ``malloc()``/``new`` work?
-------------------------------------
-
-Due to our newlib configuration, dynamic memory allocation is
-currently not available.
+How can I use ``malloc()``/``new``?
+-----------------------------------
+
+For ``malloc()``, just ``#include <stdlib.h>``, and everything should
+work fine. Be careful, though! This isn't like C programming on a
+PC. You're on the bare metal, and probably shouldn't be using dynamic
+memory unless you know what you're doing.
+
+``new`` should work out of the box (the warning about knowing what
+you're doing applies here as well). If you find that ``new`` (or
+``new[]``, ``delete``, etc.) is broken in some way, that's a bug;
+please let us know in the `forum`_.
+
+Some information on the heap: on boards with an external SRAM chip
+(like Maple Native), the heap is located on external SRAM by default.
+For other boards, the heap is located immediately after ``.bss``, and
+grows towards the stack. (In all cases, statically allocated
+variables and the stack are located on internal SRAM, for performance
+reasons).
.. _faq-flash-tables: