Forum: ARM programming with GCC/GNU tools Gnuarm to Codesourcery toolchain help

von Kri S. (mooseydoom)

Rate this post
0 useful
not useful
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"
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 */


  //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! =)

von Kri S. (mooseydoom)

Rate this post
0 useful
not useful
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

von Kri S. (mooseydoom)

Rate this post
0 useful
not useful
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


Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]

Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.