diff options
| author | Damien George | 2014-08-24 16:28:17 +0100 |
|---|---|---|
| committer | Damien George | 2014-08-24 16:28:17 +0100 |
| commit | 3c658a4e755a75e495303957208486e583ddb270 (patch) | |
| tree | 6418fea9bf3dcf4aed2145db94fda4c0de1d0321 /stmhal | |
| parent | 25fc41dd316c38df3e2a6cfe4b53322d76dc92fc (diff) | |
py: Fix bug where GC collected native/viper/asm function data.
Because (for Thumb) a function pointer has the LSB set, pointers to
dynamic functions in RAM (eg native, viper or asm functions) were not
being traced by the GC. This patch is a comprehensive fix for this.
Addresses issue #820.
Diffstat (limited to 'stmhal')
| -rw-r--r-- | stmhal/help.c | 1 | ||||
| -rw-r--r-- | stmhal/mpconfigport.h | 8 |
2 files changed, 5 insertions, 4 deletions
diff --git a/stmhal/help.c b/stmhal/help.c index 598b6f4e3..fe143441d 100644 --- a/stmhal/help.c +++ b/stmhal/help.c @@ -119,5 +119,4 @@ STATIC mp_obj_t pyb_help(uint n_args, const mp_obj_t *args) { return mp_const_none; } - MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_help_obj, 0, 1, pyb_help); diff --git a/stmhal/mpconfigport.h b/stmhal/mpconfigport.h index f51ba0d62..5ace34ff1 100644 --- a/stmhal/mpconfigport.h +++ b/stmhal/mpconfigport.h @@ -64,9 +64,9 @@ void disable_irq(void); #define MICROPY_END_ATOMIC_SECTION() enable_irq() // extra built in names to add to the global namespace -extern const struct _mp_obj_fun_native_t mp_builtin_help_obj; -extern const struct _mp_obj_fun_native_t mp_builtin_input_obj; -extern const struct _mp_obj_fun_native_t mp_builtin_open_obj; +extern const struct _mp_obj_fun_builtin_t mp_builtin_help_obj; +extern const struct _mp_obj_fun_builtin_t mp_builtin_input_obj; +extern const struct _mp_obj_fun_builtin_t mp_builtin_open_obj; #define MICROPY_PORT_BUILTINS \ { MP_OBJ_NEW_QSTR(MP_QSTR_help), (mp_obj_t)&mp_builtin_help_obj }, \ { MP_OBJ_NEW_QSTR(MP_QSTR_input), (mp_obj_t)&mp_builtin_input_obj }, \ @@ -92,6 +92,8 @@ extern const struct _mp_obj_module_t time_module; #define BYTES_PER_WORD (4) +#define MICROPY_MAKE_POINTER_CALLABLE(p) ((void*)((mp_uint_t)(p) | 1)) + #define UINT_FMT "%u" #define INT_FMT "%d" |
