@@ -332,25 +332,25 @@ def freeze(self, parent_name):
332332 raise FreezeError (self , 'freezing of object %r is not implemented' % (obj ,))
333333
334334 # 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] = {'
336336 % (self .escaped_name , len (self .qstrs ) + len (self .objs ) + len (self .raw_codes )))
337337 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 )
339339 for i in range (len (self .objs )):
340340 if type (self .objs [i ]) is float :
341341 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 ))
343343 print ('#elif MICROPY_OBJ_REPR == MICROPY_OBJ_REPR_C' )
344344 n = struct .unpack ('<I' , struct .pack ('<f' , self .objs [i ]))[0 ]
345345 n = ((n & ~ 0x3 ) | 2 ) + 0x80800000
346- print (' (mp_uint_t) 0x%08x,' % (n ,))
346+ print (' MP_ROM_INT( 0x%08x) ,' % (n ,))
347347 print ('#else' )
348348 print ('#error "MICROPY_OBJ_REPR_D not supported with floats in frozen mpy files"' )
349349 print ('#endif' )
350350 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 ))
352352 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 )
354354 print ('};' )
355355
356356 # generate module
@@ -362,7 +362,7 @@ def freeze(self, parent_name):
362362 print (' .n_pos_args = %u,' % self .prelude [3 ])
363363 print (' .data.u_byte = {' )
364364 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 )
366366 print (' #if MICROPY_PERSISTENT_CODE_SAVE' )
367367 print (' .bc_len = %u,' % len (self .bytecode ))
368368 print (' .n_obj = %u,' % len (self .objs ))
0 commit comments