I'm trying to reset the GPIO bank on a Pico using pure assembly.
Trying to keep things as simple as possible.
The base address of the reset is 0x4000c000 and clear on write is that +0x3000 so:
Reset address is therefore 0x4000f000. This is effectively an address to a 32 bit word.
GPIO is called IO_BANK0 in the RP2040 datasheet and is on bit 5 of this word, so writing decimal 32 (0b100000) should set the desired bit and release the reset.
OK so...
I've triedand
...and...
All produces:It's something very basic that I am doing wrong, I'm sure but not sure what, so not making a lot of progress towards the fun stuff.
Edit - just found this blog "Bit-Banging the Raspberry Pi Pico’s GPIO Registers". Leaving here as a bookmark
Edit edit-
I think the problem is I am using ARM thumb instructions (which are 32 bits) and I'm trying to put a 32 bit address / operand into an instruction which can at maximum be 32 bits long (opcode + operand needs to be 32 bits max).
Trying to keep things as simple as possible.
The base address of the reset is 0x4000c000 and clear on write is that +0x3000 so:
Reset address is therefore 0x4000f000. This is effectively an address to a 32 bit word.
GPIO is called IO_BANK0 in the RP2040 datasheet and is on bit 5 of this word, so writing decimal 32 (0b100000) should set the desired bit and release the reset.
OK so...
I've tried
Code:
ldr r0, 0x4000f000mov r1, #32str (r1, r0, #0)
Code:
ldr r0, 0x4000f000mov r1, #32mov r2, #0str (r1, r0, r2)
Code:
ldr r0, 0x4000f000mov r1, #32str (r1, 0x4000f000, #0)
Code:
srichards@trinitycs2:~$ arm-none-eabi-as hello.s -o hello.ohello.s: Assembler messages:hello.s:3: Error: ARM register expected -- `str (r1,0x4000f000,#0)'
Edit - just found this blog "Bit-Banging the Raspberry Pi Pico’s GPIO Registers". Leaving here as a bookmark
Edit edit-
I think the problem is I am using ARM thumb instructions (which are 32 bits) and I'm trying to put a 32 bit address / operand into an instruction which can at maximum be 32 bits long (opcode + operand needs to be 32 bits max).
Statistics: Posted by morphy_richards — Tue Jul 02, 2024 11:03 am — Replies 0 — Views 24