RP2040: Accessing the bootrom float library from inline assembler #19156
-
|
Hello, I've decided to try and implement something in assembly, in part because it'll be quite slow otherwise and in part just to learn something new. Unfortunately I've hit a stumbling block almost immediately: I need floating-point operations. A bit of Googling tells me that the rp2040 has a convenient bootrom with optimised fp algorithms, which is what the C SDK uses. The problem I have is getting to it, because the branch instruction in the inline assembler only takes labels as its argument, and not memory addresses (such as the address where the bootrom is). I tried directly updating the pc register to point at the bootrom code, but this produces an error ('mov' expects at most r7). Is there a way to branch to arbitrary memory locations from inline assembler? If not I'll find some other way of achieving my goals, but I'd like to know if I'm missing something here before I give up on the approach. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 9 replies
-
|
to avoid us all guessing which assembler you are referring to it would be helpful if you could share a minimal example. Possibly you are trying to use @micropython.asm_thumb
def foo():
... |
Beta Was this translation helpful? Give feedback.
-
|
You could try to encode the BLX manually |
Beta Was this translation helpful? Give feedback.
-
|
You could always cheat and use an RP2350 (Pico 2); this supports the |
Beta Was this translation helpful? Give feedback.
You could try to encode the BLX manually
data(2, 0b010001111_0000_000 | REGNUM <<3) # BLX(REG)or simpler
data(2, 0x4780 | REGNUM <<3) # BLX(REG)instead.Is it elegant? Certainly not.