Skip to content

Commit fbd47fc

Browse files
committed
ports: Consolidate inclusion of umachine module in built-ins.
The inclusion of `umachine` in the list of built-in modules is now done centrally in py/objmodule.c. Enabling MICROPY_PY_MACHINE will include this module. As part of this, all ports now have `umachine` as the core module name (previously some had only `machine` as the name). Signed-off-by: Damien George <[email protected]>
1 parent 102cc12 commit fbd47fc

File tree

16 files changed

+11
-32
lines changed

16 files changed

+11
-32
lines changed

ports/cc3200/mods/modmachine.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ STATIC const mp_rom_map_elem_t machine_module_globals_table[] = {
209209

210210
STATIC MP_DEFINE_CONST_DICT(machine_module_globals, machine_module_globals_table);
211211

212-
const mp_obj_module_t machine_module = {
212+
const mp_obj_module_t mp_module_machine = {
213213
.base = { &mp_type_module },
214214
.globals = (mp_obj_dict_t*)&machine_module_globals,
215215
};

ports/cc3200/mpconfigport.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,6 @@
145145
{ MP_ROM_QSTR(MP_QSTR_open), MP_ROM_PTR(&mp_builtin_open_obj) }, \
146146

147147
// extra built in modules to add to the list of known ones
148-
extern const struct _mp_obj_module_t machine_module;
149148
extern const struct _mp_obj_module_t wipy_module;
150149
extern const struct _mp_obj_module_t mp_module_ure;
151150
extern const struct _mp_obj_module_t mp_module_ujson;
@@ -158,7 +157,6 @@ extern const struct _mp_obj_module_t mp_module_ubinascii;
158157
extern const struct _mp_obj_module_t mp_module_ussl;
159158

160159
#define MICROPY_PORT_BUILTIN_MODULES \
161-
{ MP_ROM_QSTR(MP_QSTR_umachine), MP_ROM_PTR(&machine_module) }, \
162160
{ MP_ROM_QSTR(MP_QSTR_wipy), MP_ROM_PTR(&wipy_module) }, \
163161
{ MP_ROM_QSTR(MP_QSTR_uos), MP_ROM_PTR(&mp_module_uos) }, \
164162
{ MP_ROM_QSTR(MP_QSTR_utime), MP_ROM_PTR(&mp_module_utime) }, \
@@ -170,7 +168,7 @@ extern const struct _mp_obj_module_t mp_module_ussl;
170168

171169
// extra constants
172170
#define MICROPY_PORT_CONSTANTS \
173-
{ MP_ROM_QSTR(MP_QSTR_umachine), MP_ROM_PTR(&machine_module) }, \
171+
{ MP_ROM_QSTR(MP_QSTR_umachine), MP_ROM_PTR(&mp_module_machine) }, \
174172

175173
// vm state and root pointers for the gc
176174
#define MP_STATE_PORT MP_STATE_VM

ports/esp32/mpconfigport.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,6 @@ extern const struct _mp_obj_module_t esp32_module;
224224
extern const struct _mp_obj_module_t utime_module;
225225
extern const struct _mp_obj_module_t uos_module;
226226
extern const struct _mp_obj_module_t mp_module_usocket;
227-
extern const struct _mp_obj_module_t mp_module_machine;
228227
extern const struct _mp_obj_module_t mp_module_network;
229228
extern const struct _mp_obj_module_t mp_module_onewire;
230229

@@ -234,7 +233,6 @@ extern const struct _mp_obj_module_t mp_module_onewire;
234233
{ MP_OBJ_NEW_QSTR(MP_QSTR_utime), (mp_obj_t)&utime_module }, \
235234
{ MP_OBJ_NEW_QSTR(MP_QSTR_uos), (mp_obj_t)&uos_module }, \
236235
{ MP_OBJ_NEW_QSTR(MP_QSTR_usocket), (mp_obj_t)&mp_module_usocket }, \
237-
{ MP_OBJ_NEW_QSTR(MP_QSTR_machine), (mp_obj_t)&mp_module_machine }, \
238236
{ MP_OBJ_NEW_QSTR(MP_QSTR_network), (mp_obj_t)&mp_module_network }, \
239237
{ MP_OBJ_NEW_QSTR(MP_QSTR__onewire), (mp_obj_t)&mp_module_onewire }, \
240238

ports/esp8266/mpconfigport.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,6 @@ extern const struct _mp_obj_module_t network_module;
174174
extern const struct _mp_obj_module_t utime_module;
175175
extern const struct _mp_obj_module_t uos_module;
176176
extern const struct _mp_obj_module_t mp_module_lwip;
177-
extern const struct _mp_obj_module_t mp_module_machine;
178177
extern const struct _mp_obj_module_t mp_module_onewire;
179178

180179
#define MICROPY_PORT_BUILTIN_MODULES \
@@ -183,7 +182,6 @@ extern const struct _mp_obj_module_t mp_module_onewire;
183182
{ MP_ROM_QSTR(MP_QSTR_network), MP_ROM_PTR(&network_module) }, \
184183
{ MP_ROM_QSTR(MP_QSTR_utime), MP_ROM_PTR(&utime_module) }, \
185184
{ MP_ROM_QSTR(MP_QSTR_uos), MP_ROM_PTR(&uos_module) }, \
186-
{ MP_ROM_QSTR(MP_QSTR_machine), MP_ROM_PTR(&mp_module_machine) }, \
187185
{ MP_ROM_QSTR(MP_QSTR__onewire), MP_ROM_PTR(&mp_module_onewire) }, \
188186

189187
#define MP_STATE_PORT MP_STATE_VM

ports/mimxrt/mpconfigport.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,6 @@ static inline void restore_irq_pri(uint32_t basepri) {
217217
#define MICROPY_PORT_BUILTINS \
218218
{ MP_ROM_QSTR(MP_QSTR_open), MP_ROM_PTR(&mp_builtin_open_obj) },
219219

220-
extern const struct _mp_obj_module_t mp_module_machine;
221220
extern const struct _mp_obj_module_t mp_module_mimxrt;
222221
extern const struct _mp_obj_module_t mp_module_onewire;
223222
extern const struct _mp_obj_module_t mp_module_uos;
@@ -256,7 +255,6 @@ extern const struct _mp_obj_type_t network_lan_type;
256255
#endif
257256

258257
#define MICROPY_PORT_BUILTIN_MODULES \
259-
{ MP_ROM_QSTR(MP_QSTR_machine), MP_ROM_PTR(&mp_module_machine) }, \
260258
{ MP_ROM_QSTR(MP_QSTR_mimxrt), (mp_obj_t)&mp_module_mimxrt }, \
261259
{ MP_ROM_QSTR(MP_QSTR_uos), MP_ROM_PTR(&mp_module_uos) }, \
262260
{ MP_ROM_QSTR(MP_QSTR_utime), MP_ROM_PTR(&mp_module_utime) }, \

ports/nrf/modules/machine/modmachine.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ STATIC const mp_rom_map_elem_t machine_module_globals_table[] = {
244244

245245
STATIC MP_DEFINE_CONST_DICT(machine_module_globals, machine_module_globals_table);
246246

247-
const mp_obj_module_t machine_module = {
247+
const mp_obj_module_t mp_module_machine = {
248248
.base = { &mp_type_module },
249249
.globals = (mp_obj_dict_t*)&machine_module_globals,
250250
};

ports/nrf/mpconfigport.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,6 @@ typedef long mp_off_t;
220220

221221
// extra built in modules to add to the list of known ones
222222
extern const struct _mp_obj_module_t board_module;
223-
extern const struct _mp_obj_module_t machine_module;
224223
extern const struct _mp_obj_module_t nrf_module;
225224
extern const struct _mp_obj_module_t mp_module_utime;
226225
extern const struct _mp_obj_module_t mp_module_uos;
@@ -263,7 +262,6 @@ extern const struct _mp_obj_module_t ble_module;
263262

264263
#define MICROPY_PORT_BUILTIN_MODULES \
265264
{ MP_ROM_QSTR(MP_QSTR_board), MP_ROM_PTR(&board_module) }, \
266-
{ MP_ROM_QSTR(MP_QSTR_machine), MP_ROM_PTR(&machine_module) }, \
267265
{ MP_ROM_QSTR(MP_QSTR_utime), MP_ROM_PTR(&mp_module_utime) }, \
268266
{ MP_ROM_QSTR(MP_QSTR_time), MP_ROM_PTR(&mp_module_utime) }, \
269267
{ MP_ROM_QSTR(MP_QSTR_uos), MP_ROM_PTR(&mp_module_uos) }, \
@@ -278,7 +276,6 @@ extern const struct _mp_obj_module_t ble_module;
278276
extern const struct _mp_obj_module_t ble_module;
279277
#define MICROPY_PORT_BUILTIN_MODULES \
280278
{ MP_ROM_QSTR(MP_QSTR_board), MP_ROM_PTR(&board_module) }, \
281-
{ MP_ROM_QSTR(MP_QSTR_machine), MP_ROM_PTR(&machine_module) }, \
282279
{ MP_ROM_QSTR(MP_QSTR_utime), MP_ROM_PTR(&mp_module_utime) }, \
283280
{ MP_ROM_QSTR(MP_QSTR_uos), MP_ROM_PTR(&mp_module_uos) }, \
284281
MUSIC_MODULE \
@@ -296,7 +293,7 @@ extern const struct _mp_obj_module_t ble_module;
296293
// extra constants
297294
#define MICROPY_PORT_CONSTANTS \
298295
{ MP_ROM_QSTR(MP_QSTR_board), MP_ROM_PTR(&board_module) }, \
299-
{ MP_ROM_QSTR(MP_QSTR_machine), MP_ROM_PTR(&machine_module) }, \
296+
{ MP_ROM_QSTR(MP_QSTR_machine), MP_ROM_PTR(&mp_module_machine) }, \
300297
BLE_MODULE \
301298

302299
#define MP_STATE_PORT MP_STATE_VM

ports/qemu-arm/mpconfigport.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ extern const struct _mp_obj_module_t mp_module_uos;
6868

6969
#define MICROPY_PORT_BUILTIN_MODULES \
7070
{ MP_ROM_QSTR(MP_QSTR_uos), MP_ROM_PTR(&mp_module_uos) }, \
71-
{ MP_ROM_QSTR(MP_QSTR_umachine), MP_ROM_PTR(&mp_module_machine) }, \
7271

7372
// We need to provide a declaration/definition of alloca()
7473
#include <alloca.h>

ports/rp2/mpconfigport.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@
121121
#define MICROPY_PORT_BUILTINS \
122122
{ MP_ROM_QSTR(MP_QSTR_open), MP_ROM_PTR(&mp_builtin_open_obj) },
123123

124-
extern const struct _mp_obj_module_t mp_module_machine;
125124
extern const struct _mp_obj_module_t mp_module_network;
126125
extern const struct _mp_obj_module_t mp_module_onewire;
127126
extern const struct _mp_obj_module_t mp_module_rp2;
@@ -171,7 +170,6 @@ extern const struct _mod_network_nic_type_t mod_network_nic_type_nina;
171170
#endif
172171

173172
#define MICROPY_PORT_BUILTIN_MODULES \
174-
{ MP_OBJ_NEW_QSTR(MP_QSTR_machine), (mp_obj_t)&mp_module_machine }, \
175173
{ MP_OBJ_NEW_QSTR(MP_QSTR__onewire), (mp_obj_t)&mp_module_onewire }, \
176174
{ MP_OBJ_NEW_QSTR(MP_QSTR__rp2), (mp_obj_t)&mp_module_rp2 }, \
177175
{ MP_ROM_QSTR(MP_QSTR_uos), MP_ROM_PTR(&mp_module_uos) }, \

ports/samd/mpconfigport.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,10 @@
108108
#define MICROPY_PORT_BUILTINS \
109109
{ MP_ROM_QSTR(MP_QSTR_open), MP_ROM_PTR(&mp_builtin_open_obj) },
110110

111-
extern const struct _mp_obj_module_t mp_module_machine;
112111
extern const struct _mp_obj_module_t mp_module_samd;
113112
extern const struct _mp_obj_module_t mp_module_utime;
114113

115114
#define MICROPY_PORT_BUILTIN_MODULES \
116-
{ MP_ROM_QSTR(MP_QSTR_machine), MP_ROM_PTR(&mp_module_machine) }, \
117115
{ MP_ROM_QSTR(MP_QSTR_samd), MP_ROM_PTR(&mp_module_samd) }, \
118116
{ MP_ROM_QSTR(MP_QSTR_utime), MP_ROM_PTR(&mp_module_utime) }, \
119117

0 commit comments

Comments
 (0)