kopia lustrzana https://github.com/micropython/micropython
mpy_ld.py: Support modules larger than 4KiB on armv6m
Using the BL instruction in ARM Thumb All other architectures seems to support larger modules already Fixes exception such as: File "micropython/tools/mpy_ld.py", line 904, in build_mpy jump = env.arch.asm_jump(entry_offset) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "micropython/tools/mpy_ld.py", line 92, in asm_jump_thumb assert b_off >> 11 == 0 or b_off >> 11 == -1, b_off ^^^^^^^^^^^^^^^^^ AssertionError: 6153 Signed-off-by: Jon Nordby <jononor@gmail.com>pull/12241/head
rodzic
ea1a5e43d0
commit
f3191bcd48
|
@ -89,8 +89,17 @@ def asm_jump_x86(entry):
|
||||||
def asm_jump_thumb(entry):
|
def asm_jump_thumb(entry):
|
||||||
# Only signed values that fit in 12 bits are supported
|
# Only signed values that fit in 12 bits are supported
|
||||||
b_off = entry - 4
|
b_off = entry - 4
|
||||||
assert b_off >> 11 == 0 or b_off >> 11 == -1, b_off
|
if b_off >> 11 == 0 or b_off >> 11 == -1:
|
||||||
return struct.pack("<H", 0xE000 | (b_off >> 1 & 0x07FF))
|
return struct.pack("<H", 0xE000 | (b_off >> 1 & 0x07FF))
|
||||||
|
else:
|
||||||
|
# Use BL instruction
|
||||||
|
# Two 16-bit instructions in sequence
|
||||||
|
# each on form: 1111 HOOO OOOO OOOO
|
||||||
|
# first instruction has H=0, and has high 11 bits of the Offset
|
||||||
|
# second instruction has H=1, and has low 11 bits of the Offset
|
||||||
|
b0 = 0xF000 | (b_off >> 12 & 0x07FF)
|
||||||
|
b1 = 0xF800 | (b_off >> 1 & 0x7FF)
|
||||||
|
return struct.pack("<HH", b0, b1)
|
||||||
|
|
||||||
|
|
||||||
def asm_jump_thumb2(entry):
|
def asm_jump_thumb2(entry):
|
||||||
|
|
Ładowanie…
Reference in New Issue