Home arrow Support arrow Forums

Luminary Micro Forums

dalewheat

Gold Boarder

2006/10/26 22:02

EV-LM3S811 blinking LED in assembler

For the really hard core folk that want to get to the bare metal of the new Stellaris parts, here is a minimal program that will blink the user LED on the EV-LM3S811 board, in glorious ARM assembler code, which will compile under the uVision demo that is supplied with the evaluation kit:

; blink.s - blink user LED on Luminary Micro EV-LM3S811 (Cortex-M3)

AREA TEXT, CODE, READONLY
CODE16

; vector table

DCD 0x20002000
DCD Reset_Handler
DCD iloop
DCD iloop

; start the program here

Reset_Handler
EXPORT Reset_Handler

; initialize GPIO port C, pin 5 as output

RCGC2 EQU 0x400FE108 ; run-mode clock gating control 2
RCGC2_PORTC EQU 1 << 2 ; PORTC clock enable

ldr r0, =RCGC2

ldr r1, =RCGC2_PORTC
str r1, [r0]

GPIODIR_PORTC EQU 0x40006400
GPIO_PC5 EQU 1 << 5

ldr r0, =GPIODIR_PORTC

ldr r1, =GPIO_PC5
str r1, [r0]

GPIODATA_PORTC EQU 0x40006000

ldr r0, =GPIODATA_PORTC + (GPIO_PC5 << 2)

loop

ldr r1, =GPIO_PC5
str r1, [r0]

ldr r2, =1000000
1 subs r2, r2, #1
bne %1

ldr r1, =0
str r1, [r0]

ldr r2, =1000000
1 subs r2, r2, #1
bne %1

b loop ; and do it again

; an infinite loop in place of real exception handlers

iloop b iloop

; the end

END

[end-of-file]

Note that you will need to indent all the lines that don't start with a label, as this forum is protecting you from my code in its original beauty.

Questions? Comments? Let me know!

Dale

login or register to reply

      Topics Author Date
    thread link
EV-LM3S811 blinking LED in assembler
dalewheat 2006/10/26 22:02
    thread link
thread linkthread link Re:EV-LM3S811 blinking LED in assembler
englere 2006/10/30 10:07
    thread link
thread linkthread linkthread link Re:EV-LM3S811 blinking LED in assembler
dalewheat 2006/10/30 10:17
    thread link
thread linkthread linkthread linkthread link Re:EV-LM3S811 blinking LED in assembler
petej 2006/12/22 14:17
    emo
thread linkthread linkthread linkthread link Re:EV-LM3S811 blinking LED in assembler
awneil 2008/05/16 16:55