aboutsummaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/arm-gcc.rst23
1 files changed, 17 insertions, 6 deletions
diff --git a/source/arm-gcc.rst b/source/arm-gcc.rst
index e97bb2f..5fb9a17 100644
--- a/source/arm-gcc.rst
+++ b/source/arm-gcc.rst
@@ -74,12 +74,23 @@ including Arduino) for use on the Maple.
.. _arm-gcc-attribute-flash:
-- Replacing ``PROGMEM``: You can direct the linker script provided
- with libmaple to store a variable in Flash (instead of RAM) by using
- the libmaple macro ``__FLASH__``, like so::
+- Replacing ``PROGMEM``: If you need to store a lot of constant data,
+ you can store variables in Flash (instead of RAM) by using the
+ libmaple macro ``__FLASH__``. Here's an example::
uint32 array[] __FLASH__ = {0, 1, 2};
- Be aware, however, that if you do that, you can only store values
- which are compile-time constants, and that if you attempt to change
- a variable stored in Flash, your program will crash.
+ This will help you save RAM when you need to store large amounts of
+ data, like look-up tables.
+
+ You can only store values which are compile-time constants (like
+ numbers and strings, and arrays of numbers and strings) in this way.
+ Also, if you try to change a variable stored in Flash, your program
+ will crash.
+
+ If you need to port over AVR/Arduino code that uses pgmspace.h,
+ these declarations may help you::
+
+ typedef const unsigned char prog_uchar;
+ #define pgm_read_byte_near(x) (*(prog_uchar*)x)
+ #define pgm_read_byte(x) (*(prog_uchar*)x)