Skip to content

Commit b4213c9

Browse files
yoctopucedpgeorge
authored andcommitted
tools/mpy-tool.py: Implement freezing of long-long ints.
Allow inclusion of large integer constants in frozen files using long-long representation (mpy-cross option -mlongint-impl=longlong). Signed-off-by: Yoctopuce <[email protected]>
1 parent 706a4b4 commit b4213c9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tools/mpy-tool.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -735,8 +735,8 @@ def freeze_constant_obj(self, obj_name, obj):
735735
elif config.MICROPY_LONGINT_IMPL == config.MICROPY_LONGINT_IMPL_NONE:
736736
raise FreezeError(self, "target does not support long int")
737737
elif config.MICROPY_LONGINT_IMPL == config.MICROPY_LONGINT_IMPL_LONGLONG:
738-
# TODO
739-
raise FreezeError(self, "freezing int to long-long is not implemented")
738+
print("static const mp_obj_int_t %s = {{&mp_type_int}, %d};" % (obj_name, obj))
739+
return "MP_ROM_PTR(&%s)" % obj_name
740740
elif config.MICROPY_LONGINT_IMPL == config.MICROPY_LONGINT_IMPL_MPZ:
741741
neg = 0
742742
if obj < 0:

0 commit comments

Comments
 (0)