trying to modify the blinky demo using inline assembly... basically just trying to replicate the loop, delays, and port register OR-ing
p.s. are there CODE tags for this forum so the code looks better?
here's the non-functional assembly:
============================================================================
/*__asm(
"start1: \n"
//" LDR r1, #0x400263FC \n"
" ORR [r0, #0x400263FC], [#0x400263FC], #0x04 \n"
" STR [0x400263FC], r1 \n"
" mov r0, #100 \n"
"loop1: \n"
" SUB r0,#1 \n"
" CMP r0,#0 \n"
" BNE loop1 \n"
" and 0x400263FC, 0x0 \n"
" mov r0, #100 \n"
"loop2: \n"
" SUB r0,#1 \n"
" CMP r0,#0 \n"
" BNE loop2 \n"
" B start1 \n"
);
*/
================================================================================================
here's the working C from the Stellaris CD:
#include "inc/lm4f232h5qd.h"
int
main(void)
{
volatile unsigned long ulLoop;
//
// Enable the GPIO port that is used for the on-board LED.
//
SYSCTL_RCGC2_R = SYSCTL_RCGC2_GPIOG;
//
// Do a dummy read to insert a few cycles after enabling the peripheral.
//
ulLoop = SYSCTL_RCGC2_R;
//
// Enable the GPIO pin for the LED (PG2). Set the direction as output, and
// enable the GPIO pin for digital function.
//
GPIO_PORTG_DIR_R = 0x04;
GPIO_PORTG_DEN_R = 0x04;
//
// Loop forever.
//
while(1)
{
//
// Turn on the LED.
//
GPIO_PORTG_DATA_R |= 0x04;
//
// Delay for a bit.
//
for(ulLoop = 0; ulLoop < 200000; ulLoop++)
{
}
//
// Turn off the LED.
//
GPIO_PORTG_DATA_R &= ~(0x04);
//
// Delay for a bit.
//
for(ulLoop = 0; ulLoop < 200000; ulLoop++)
{
}
}
}