Home arrow Support arrow Forums

Luminary Micro Forums

fv78

Fresh Boarder
Click here to see the profile of this user

2007/02/01 01:20

buffer initialization

Hi,
I can't seem to make the piece of code below running.
The user LED on the EVLM3S811 never lights on!
What am I doing wrong ?
The problem is located in the for loop which seems to
work if I decrease the buffer's size to say 200.

thanks in advance for your help

PS: memset(buf, 'A', sizeof(buf)) doesn't work either.


#include "hw_types.h"
#include "hw_memmap.h"
#include "sysctl.h"
#include "gpio.h"

int main(void)
{
int buf[512];
int i;

// Set the clocking to run at 20MHz from the PLL
SysCtlClockSet(SYSCTL_SYSDIV_10 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_6MHZ);

// Enable the peripherals used by the application
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC);
// Configure LED, push button
GPIODirModeSet(GPIO_PORTC_BASE, GPIO_PIN_5, GPIO_DIR_MODE_OUT);
GPIOPinWrite(GPIO_PORTC_BASE, GPIO_PIN_5, 0);

for(i=0; i<310; i++) buf[i] = 0x0;
i = buf[0]; // to avoid warning in this example
GPIOPinWrite(GPIO_PORTC_BASE, GPIO_PIN_5, GPIO_PIN_5);

while(1);

}

Post edited by: fv78, at: 2007/02/01 01:22

login or register to reply

orinem

Expert Boarder
Click here to see the profile of this user

2007/02/01 02:20

Re:buffer initialization

Your stack isn't big enough. It's defined in startup.s similar to the following:

Code:

 ;****************************************************************************** ; ; <hStack Configuration ;   <oStack Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> ; ;****************************************************************************** Stack   EQU     0x00000100



You are going to have to increase your stack size by the size of your buffer.

Orin.

login or register to reply

fv78

Fresh Boarder
Click here to see the profile of this user

2007/02/01 02:44

Re:buffer initialization

I am so stupid! I searched for that in the different keil's menus and didn't even thought of looking through
the different files of the project.

Thanks a lot for the quick (needed ;-) ) answer.

login or register to reply