Gnuarm to Codesourcery toolchain help

OP #1173843
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! =)
OP
Update:
There seems to be a problem with calling the init_VIC() function.  The
function isn't getting called properly, or is not linked correctly.
Code in the init_VIC() function isn't being called, and the program
doesn't return back to the main() function after trying to call
init_VIC();
OP
Whoops... I was using the wrong Codesourcery package.  I downloaded the
EABI package instead of the Linux/GNU package and changed the make file
to use the arm-none-eabi-* commands, and it works now.  :D

Reply

A question of your own? This thread is over 18 years old. Ask it in a thread of its own – more people read along there, and it gets answered more often and sooner.

Start a new thread

A fix, an addition or feedback on this thread? Then reply here.

Formatting
  • [c]C-Code[/c]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.