TCS Pune

ARM Assembly GPIO Concept

Assembly

ARM Assembly GPIO Concept

Study register-level GPIO operations in ARM Thumb assembly.

IDE: GNU Arm Embedded toolchain or vendor IDEBoard/MCU: Cortex-M development board; addresses must match exact MCU

Project files

Download project ZIP
Starter — gpio.s
.syntax unified
.thumb
.global gpio_set
gpio_set:
    /* TODO: load register and set bit */
    bx lr
Completed — 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 lr

Toolchain 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
Ready when you are

Need help with your laptop or computer?

Send us the model and fault details. Start your repair request online or contact TCS Pune directly.

WA