summaryrefslogtreecommitdiffstatshomepage
path: root/py/mpconfig.h
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2015-02-08 13:42:00 +0000
committerDamien George <damien.p.george@gmail.com>2015-02-08 13:42:00 +0000
commit28631537bd14d0497c8d51d796cdda45b3719890 (patch)
tree36e7d73319ded08731ce67bb1d6884f5e408032e /py/mpconfig.h
parent5351a48185bef5abd935eb8ab06c2e12e9114d2f (diff)
downloadmicropython-28631537bd14d0497c8d51d796cdda45b3719890.tar.gz
micropython-28631537bd14d0497c8d51d796cdda45b3719890.zip
py: Add MICROPY_OBJ_BASE_ALIGNMENT to help with 16-bit ports.
Diffstat (limited to 'py/mpconfig.h')
-rw-r--r--py/mpconfig.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/py/mpconfig.h b/py/mpconfig.h
index e8c8fcc596..b235d6fe66 100644
--- a/py/mpconfig.h
+++ b/py/mpconfig.h
@@ -536,6 +536,14 @@ typedef double mp_float_t;
/*****************************************************************************/
/* Miscellaneous settings */
+// All uPy objects in ROM must be aligned on at least a 4 byte boundary
+// so that the small-int/qstr/pointer distinction can be made. For machines
+// that don't do this (eg 16-bit CPU), define the following macro to something
+// like __attribute__((aligned(4))).
+#ifndef MICROPY_OBJ_BASE_ALIGNMENT
+#define MICROPY_OBJ_BASE_ALIGNMENT
+#endif
+
// On embedded platforms, these will typically enable/disable irqs.
#ifndef MICROPY_BEGIN_ATOMIC_SECTION
#define MICROPY_BEGIN_ATOMIC_SECTION() (0)