File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -536,6 +536,14 @@ typedef double mp_float_t;
536536/*****************************************************************************/
537537/* Miscellaneous settings */
538538
539+ // All uPy objects in ROM must be aligned on at least a 4 byte boundary
540+ // so that the small-int/qstr/pointer distinction can be made. For machines
541+ // that don't do this (eg 16-bit CPU), define the following macro to something
542+ // like __attribute__((aligned(4))).
543+ #ifndef MICROPY_OBJ_BASE_ALIGNMENT
544+ #define MICROPY_OBJ_BASE_ALIGNMENT
545+ #endif
546+
539547// On embedded platforms, these will typically enable/disable irqs.
540548#ifndef MICROPY_BEGIN_ATOMIC_SECTION
541549#define MICROPY_BEGIN_ATOMIC_SECTION () (0)
Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ typedef machine_const_ptr_t mp_const_obj_t;
4646
4747struct _mp_obj_type_t ;
4848struct _mp_obj_base_t {
49- const struct _mp_obj_type_t * type ;
49+ const struct _mp_obj_type_t * type MICROPY_OBJ_BASE_ALIGNMENT ;
5050};
5151typedef struct _mp_obj_base_t mp_obj_base_t ;
5252
You can’t perform that action at this time.
0 commit comments