diff --git a/ports/nrf/main.c b/ports/nrf/main.c index 1013005e19..bb3bcec36d 100644 --- a/ports/nrf/main.c +++ b/ports/nrf/main.c @@ -312,11 +312,6 @@ mp_lexer_t *mp_lexer_new_from_file(qstr filename) { mp_import_stat_t mp_import_stat(const char *path) { return MP_IMPORT_STAT_NO_EXIST; } - -mp_obj_t mp_builtin_open(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs) { - mp_raise_OSError(MP_EPERM); -} -MP_DEFINE_CONST_FUN_OBJ_KW(mp_builtin_open_obj, 1, mp_builtin_open); #endif #endif diff --git a/ports/nrf/mpconfigport.h b/ports/nrf/mpconfigport.h index 80e37bc4f7..cad839d0e9 100644 --- a/ports/nrf/mpconfigport.h +++ b/ports/nrf/mpconfigport.h @@ -353,10 +353,11 @@ long unsigned int rng_generate_random_word(void); #include "boardmodules.h" #endif // BOARD_SPECIFIC_MODULES -// extra built in names to add to the global namespace +#if MICROPY_MBFS +// The builtins.open function must be explicitly added when using the micro:bit filesystem. #define MICROPY_PORT_BUILTINS \ - { MP_ROM_QSTR(MP_QSTR_help), MP_ROM_PTR(&mp_builtin_help_obj) }, \ - { MP_ROM_QSTR(MP_QSTR_open), MP_ROM_PTR(&mp_builtin_open_obj) }, \ + { MP_ROM_QSTR(MP_QSTR_open), MP_ROM_PTR(&mp_builtin_open_obj) }, +#endif // extra constants #define MICROPY_PORT_CONSTANTS \