ARM Assembly GPIO Concept
Study register-level GPIO operations in ARM Thumb assembly.
Project files
Starter — gpio.s
.syntax unified
.thumb
.global gpio_set
gpio_set:
/* TODO: load register and set bit */
bx lrCompleted — gpio.s
.syntax unified
.thumb
.global gpio_set
gpio_set:
ldr r0, =0x40020014
ldr r1, [r0]
orr r1, r1, #(1 << 5)
str r1, [r0]
bx lrToolchain and dependencies
IDE requirements
GNU Arm Embedded toolchain or vendor IDE
Compatible targets
Cortex-M development board; addresses must match exact MCU
Libraries/dependencies
- Linker script and startup file for selected MCU
Serial output examples
Serial Monitor
No serial output; verify the GPIO register with debugger or oscilloscope.
Compiler-error explanations
immediate expression requires a # prefix
Likely cause: ARM assembler syntax is incorrect
Fix: Prefix immediate constants with # for the selected assembler
undefined reference to gpio_set
Likely cause: Assembly object was not linked/exported
Fix: Add the source to the build and export the symbol globally
Submit your code
Log in to edit the starter files and submit your solution for instructor review.
Log in to submit