Code: Select all
@micropython.asm_thumb
def getdata(r0):
push({pc})
b(START)
data(4, 0x1234567, 0x987654, 0x333333) # 32 bit data
label(START)
pop({r2})
add(r2, 2) # skip the b() instruction
add(r0, r0, r0)
add(r0, r0, r0) # Convert array offset to bytes
add(r2, r2, r0) # Add to adjusted address
ldr(r0, [r2, 0]) # get the requested data
print(hex(getdata(1))) # Returns data[1]: 0x987654