Further to my last post, since I am not having any luck single stepping through my code, I thought I would download it to the SAM7S256-EK using IAR EW v5.4
My LED does not flash and I cannot work out where I am going wrong. Here is a dump of the Log File:
Tue Sep 22 16:00:19 2009: DLL version: V4.8f, compiled Jul 8 2009 19:54:44
Tue Sep 22 16:00:19 2009: Firmware: J-Link ARM V6 compiled Jun 30 2009 11:04:04
Tue Sep 22 16:00:19 2009: JTAG speed is initially set to: 32 kHz
Tue Sep 22 16:00:19 2009: Initial reset was performed
Tue Sep 22 16:00:19 2009: TotalIRLen = 4, IRPrint = 0x01
Tue Sep 22 16:00:19 2009: Found 1 JTAG device, Total IRLen = 4:
Tue Sep 22 16:00:19 2009: #0 Id: 0x3F0F0F0F, IRLen: 4, IRPrint: 0x1 ARM7TDMI Core
Tue Sep 22 16:00:19 2009: J-Link found 1 JTAG device(s). ARM core Id: 3F0F0F0F ARM7
Tue Sep 22 16:00:19 2009: Device at TAP0 selected
Tue Sep 22 16:00:19 2009: JLINK command: ProjectFile = C:\Documents and Settings\SimonB\My Documents\ARM Stuff\ARM Software\port_toggle2\
settings\port_toggle2_Debug.jlink, return = 0
Tue Sep 22 16:00:19 2009: JLINK command: device = AT91SAM7S256, return = 0
Tue Sep 22 16:00:19 2009: TotalIRLen = 4, IRPrint = 0x01
Tue Sep 22 16:00:19 2009: RTCK seems to be bridged with TCK
Tue Sep 22 16:00:20 2009: Auto JTAG speed: 8000 kHz
Tue Sep 22 16:00:20 2009: 656 bytes downloaded (1.28 Kbytes/sec)
Tue Sep 22 16:00:20 2009: Loaded debugee: C:\Documents and Settings\SimonB\My Documents\ARM Stuff\ARM Software\port_toggle2\Debug\Exe\
port_toggle2.out
Tue Sep 22 16:00:20 2009: Target reset
then after about 5 second, the following is added:
Tue Sep 22 16:00:20 2009: Failed to set breakpoint at 0x00000008
Tue Sep 22 16:00:36 2009: [main] #0
Tue Sep 22 16:00:36 2009: The stack 'CSTACK' is filled to 100% (8192 bytes used out of 8192). The warning threshold is set to 90.%
Tue Sep 22 16:00:36 2009: The stack 'IRQ_STACK' is filled to 100% (256 bytes used out of 256). The warning threshold is set to 90.%
Tue Sep 22 16:00:36 2009: The stack 'FIQ_STACK' is filled to 100% (256 bytes used out of 256). The warning threshold is set to 90.%
Tue Sep 22 16:00:36 2009: The stack pointer for stack 'CSTACK' (currently 0x20202400) is outside the stack range (0x00100000 to 0x00102000)
Tue Sep 22 16:00:36 2009: The stack pointer for stack 'IRQ_STACK' (currently 0x00000000) is outside the stack range (0x00102000 to 0x00102100)
Tue Sep 22 16:00:36 2009: The stack pointer for stack 'FIQ_STACK' (currently 0x60040080) is outside the stack range (0x00102100 to 0x00102200)
and here is the source code:
Code:
#include <AT91SAM7S256.h>
#define LED (1<<0) // PA0
#define INPUT_PIN (1<<1) // PA1
#define INT_PIN (1<<2) // PA2
static void initialize( void);
void delay_us( int time);
void delay_ms( int time);
int main(void)
{
int delay = 100;
volatile long input;
initialize();
volatile AT91PS_PIO pPIOA = AT91C_BASE_PIOA;
while(1)
{
input = pPIOA->PIO_PDSR; //for debugging. Watch input variable to check if inputs working.
if(( pPIOA->PIO_PDSR & INPUT_PIN) == INPUT_PIN)
delay = 1000;
else
delay = 100;
pPIOA->PIO_CODR = LED;
delay_ms(delay);
pPIOA->PIO_SODR = LED;
delay_ms(delay);
}
}
static void initialize(void)
{
//Turn on the peripheral clock. Without this on, inputs do not actually register in the PDSR register
volatile AT91PS_PMC pPMC = AT91C_BASE_PMC; // pointer to PMC data structure
pPMC->PMC_PCER = (1<<AT91C_ID_PIOA); // enable Timer0 peripheral clock
volatile AT91PS_PIO pPIOA = AT91C_BASE_PIOA;
pPIOA->PIO_PER = (LED | INPUT_PIN); // Set PIO to control LED and button.
// Initialize Input
pPIOA->PIO_ODR = INPUT_PIN ; // Disable outputs for INPUT pins. (not needed as all pins default input on reset)
pPIOA->PIO_PPUER = INPUT_PIN; //Pullup Enable (not needed as all pullups are enabled on reset)
// Initialize Output
pPIOA->PIO_OER = LED; // Enable output for LED.
pPIOA->PIO_SODR = LED; // Turn LED off.
pPIOA->PIO_PPUDR = LED; //Pullup disable
}
void delay_us(int delay)
{
while(delay--)
{
__asm ("NOP");
__asm ("NOP");
__asm ("NOP");
__asm ("NOP");
__asm ("NOP");
__asm ("NOP");
__asm ("NOP");
__asm ("NOP");
__asm ("NOP");
__asm ("NOP");
__asm ("NOP");
__asm ("NOP");
__asm ("NOP");
}
}
void delay_ms(int delay)
{
char i;
while(delay--)
{
for(i=0; i<4; i++)
{
delay_us(250);
}
}
}
Any thoughts would be greatly received
Thanks in advance