I tried to port some code from the gnuarm.com toolchain to the
codesourcery one. The code compiles ok, and I can program my LPC2148
chip, but the timer/interrupt code doesn't seem to be working.
I have a LPC2148 Olimex development board I have been trying to learn
how to program using linux/openocd. I got the timer demo from
"Accessing ARM-Controllers with OpenOCD"
http://www.siwawi.arubi.uni-kl.de/avr_projects/arm_projects/openocd_intro/index.html
working with gnuarm (from gnuarm.com gcc v3.4.3 binary). I changed the
programs in the makefile from arm-elf-* to arm-none-linux-gnueabi-* to
use the codesourcery toolchain. It compiles ok and I can program the
chip, but the pins don't change value. (I have LEDs hooked up to a
couple of the output pins).
If I don't use the timer, and just use a counter, the code works ok. ie:
int main (void)
{
int flip;
DWORD lasttime, now;
int counter;
/************ The main Function is an endless loop ************/
/* The timer routine is tested on the Keil MCB214x board */
// ...and on an Keil MCB2130 by Martin Thomas
IODIR1 = 0x00FF0000; /* P1.16..23 defined as Outputs */
IOCLR1 = 0x00FF0000; /* turn off all the LEDs */
IOSET1 = 0x00AA0000; /* turn on some LEDs to indicate start */
//init_VIC();
//init_timer();
//enable_timer( 0 );
flip = 0;
lasttime = timer_counter;
counter = 0;
while (1) { /* Loop forever */
//now = timer_counter;
//if ( (DWORD)(now-lasttime) > 0x100 ) {
// lasttime = now;
if( ++counter > 10000000 ) {
counter = 0;
if (flip == 0) {
IOSET1 = 0x000F0000; /* turn off P1.20~23 */
IOCLR1 = 0x00F00000; /* turn on P1.16~19 */
flip = 1;
}
else {
IOSET1 = 0x00F00000; /* turn on P1.20~23 */
IOCLR1 = 0x000F0000; /* turn off P1.16~19 */
flip = 0;
}
}
}
return 0;
}
So is there something with interrupts or the timer which is different in
gnuarm vs codesourcery? Or am I missing something else?
Side note: in the latest svn version of openOCD, the flash erase_sector
and write_bank commands worked for me. Thanks Martin! =)