@@ -332,25 +332,25 @@ def freeze(self, parent_name):
332
332
raise FreezeError (self , 'freezing of object %r is not implemented' % (obj ,))
333
333
334
334
# generate constant table
335
- print ('STATIC const mp_uint_t const_table_data_%s[%u] = {'
335
+ print ('STATIC const mp_rom_obj_t const_table_data_%s[%u] = {'
336
336
% (self .escaped_name , len (self .qstrs ) + len (self .objs ) + len (self .raw_codes )))
337
337
for qst in self .qstrs :
338
- print (' (mp_uint_t)MP_OBJ_NEW_QSTR (%s),' % global_qstrs [qst ].qstr_id )
338
+ print (' MP_ROM_QSTR (%s),' % global_qstrs [qst ].qstr_id )
339
339
for i in range (len (self .objs )):
340
340
if type (self .objs [i ]) is float :
341
341
print ('#if MICROPY_OBJ_REPR == MICROPY_OBJ_REPR_A || MICROPY_OBJ_REPR == MICROPY_OBJ_REPR_B' )
342
- print (' (mp_uint_t) &const_obj_%s_%u,' % (self .escaped_name , i ))
342
+ print (' MP_ROM_PTR( &const_obj_%s_%u) ,' % (self .escaped_name , i ))
343
343
print ('#elif MICROPY_OBJ_REPR == MICROPY_OBJ_REPR_C' )
344
344
n = struct .unpack ('<I' , struct .pack ('<f' , self .objs [i ]))[0 ]
345
345
n = ((n & ~ 0x3 ) | 2 ) + 0x80800000
346
- print (' (mp_uint_t) 0x%08x,' % (n ,))
346
+ print (' MP_ROM_INT( 0x%08x) ,' % (n ,))
347
347
print ('#else' )
348
348
print ('#error "MICROPY_OBJ_REPR_D not supported with floats in frozen mpy files"' )
349
349
print ('#endif' )
350
350
else :
351
- print (' (mp_uint_t) &const_obj_%s_%u,' % (self .escaped_name , i ))
351
+ print (' MP_ROM_PTR( &const_obj_%s_%u) ,' % (self .escaped_name , i ))
352
352
for rc in self .raw_codes :
353
- print (' (mp_uint_t) &raw_code_%s,' % rc .escaped_name )
353
+ print (' MP_ROM_PTR( &raw_code_%s) ,' % rc .escaped_name )
354
354
print ('};' )
355
355
356
356
# generate module
@@ -362,7 +362,7 @@ def freeze(self, parent_name):
362
362
print (' .n_pos_args = %u,' % self .prelude [3 ])
363
363
print (' .data.u_byte = {' )
364
364
print (' .bytecode = bytecode_data_%s,' % self .escaped_name )
365
- print (' .const_table = const_table_data_%s,' % self .escaped_name )
365
+ print (' .const_table = (mp_uint_t*) const_table_data_%s,' % self .escaped_name )
366
366
print (' #if MICROPY_PERSISTENT_CODE_SAVE' )
367
367
print (' .bc_len = %u,' % len (self .bytecode ))
368
368
print (' .n_obj = %u,' % len (self .objs ))
0 commit comments