EmbDev.net

Forum: ARM programming with GCC/GNU tools lpc2378 timer blink sample


Author: İsmail K. (smail_k)
Posted on:

Rate this post
0 useful
not useful
hello ı need lpc2378(olimex lpc-p2378 dev.board) timer blink sample for 
eclipse.

ı tried this code but not worked..

void Initialize(void);
void feed(void);

void IRQ_Routine (void)   _attribute_ ((interrupt("IRQ")));
void FIQ_Routine (void)   _attribute_ ((interrupt("FIQ")));
void SWI_Routine (void)   _attribute_ ((interrupt("SWI")));
void UNDEF_Routine (void) _attribute_ ((interrupt("UNDEF")));

void T0isr (void) ;
/**********************************************************
                  Header files
**********************************************************/
#include "LPC23xx.h"
#include "type.h"
#include "irq.h"
#include "target.h"
#include "fio.h"

int r;

void  main (void)  {

   IODIR0 = 0x00200000;            // P0.21  Output

   VPBDIV   = 0x00000002;
   PINSEL0 |= 0x00000000;

   T0PR    = 0x0000001E;
   T0TCR    = 0x00000002;
   T0MCR    = 0x00000003;



   T0MR0   = 0x00001600;
   T0TCR    = 0x00000001;

   VICVectAddr4 = (unsigned)T0isr;
   VICVectCntl4 = 0x00000024;      //4 No int enable (Timer0)
   VICIntEnable |= 0x00000010;      //Timer 0 int enable

    while(1);
}

/******************************************************
        Timer 0 interrupt
******************************************************/

void T0isr (void)  {
    r=(r+1)&1;
   if (r==1)
      IOSET0 =  0x00200000;                      /* Turn off LED */
   else
      IOCLR0 =  0x00200000;                      /* Turn on LED */

   T0IR |= 0x00000001;
    VICVectAddr = 0x00000000;         //Dummy write to signal end of 
interrupt
}








/*  Stubs for various interrupts (may be replaced later)  */
/*  ----------------------------------------------------  */

void IRQ_Routine (void) {
   while (1) ;
}

void FIQ_Routine (void)  {
   while (1) ;
}


void SWI_Routine (void)  {
   while (1) ;
}


void UNDEF_Routine (void) {
   while (1) ;
}

where is my fault?
regards

Author: Martin Thomas (Guest)
Posted on:

Rate this post
0 useful
not useful
Pack the
- Complete source-code including startup-code
- Linker-script
- Makefile (or at least output of the build-process where all options 
can be seen)
into one zip-archive and attach it to a message.

You may find this example-application useful:
http://www.siwawi.arubi.uni-kl.de/avr_projects/arm...

Author: İsmail K. (smail_k)
Posted on:
Attached files:

Rate this post
0 useful
not useful
here is my bad sample project...
please give me any ideas.

thax four your reply.  =)

Regards.

Author: İsmail K. (smail_k)
Posted on:

Rate this post
0 useful
not useful
http://www.siwawi.arubi.uni-kl.de/avr_projects/arm... this link's 
project occured so much errors on the new project :(

Author: İsmail K. (smail_k)
Posted on:

Rate this post
0 useful
not useful
HELLLLLLLLLLLLLLLLLLLLLLPPPPPPPPPPPPPPPPPP...ANY IDEAS??

TSSSSSSSSSSSSSSS :(

Author: Michael G. (let)
Posted on:
Attached files:

Rate this post
0 useful
not useful
If you have still problems, I have modified the project.
It seems that you have copied several files from different
projects.

Please note that in this project the main clock is 72Mhz.
I have lowered the blink frequency so that the LED blinking is
visible.

PS: I am using the Codesourcery toolchain (arm-none-eabi) so you
may have to change the Makefile accordingly. The WinARM toolchain
(arm-elf) should work as well.

Author: İsmail K. (smail_k)
Posted on:

Rate this post
0 useful
not useful
thanks for ur support
didnt work on my workspace.it gave  error aagain :s

//////////////////////////////////////////////////////////////////////
**** Build of configuration Default for project blinkyy ****

make all

-------- begin (mode: ROM_RUN) --------
arm-elf-gcc (GCC) 4.4.2
Copyright (C) 2009 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is 
NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR 
PURPOSE.

make: *** No rule to make target `Common/src/Startup.S', needed by 
`Common/src/Startup.o'.  Stop.
//////////////////////////////////////////////////////////////////////

ı didnt change toolchain in the properties menu..problem occured " 
java.lang.nullpointerexeotion

what do u think about this error?

regards

Author: Michael G. (let)
Posted on:

Rate this post
0 useful
not useful
The file `Common/src/Startup.S' seems to be missing.
Did you extract the entire archive?

I'd recommend you to start without eclipse as the project files
are not very portable. Extract the archive to some temporary folder,
adjust the toolchain in Makefile and try to call 'make' from within a
dos box in that folder.

Just tried that myself (extracted blinkyy.zip, with unaltered Makefile).
I am using make.exe from the WinAVR project.
C:\Users\let\Documents\workspace\blinkyy>make

-------- begin (mode: ROM_RUN) --------
arm-none-eabi-gcc (Sourcery G++ Lite 2010q1-188) 4.4.1
Copyright (C) 2009 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


Assembling (ARM-only): Common/src/Startup.S
arm-none-eabi-gcc -c -mcpu=arm7tdmi-s  -I. -x assembler-with-cpp -DROM_RUN -D__WinARM__ -D__WINARMSUBMDL_LPC2378__ -Wa,-adhlns=Common/src/Startup.lst,-gdwarf-2 Common/src/Startup.S -o Common/src/Startup.o

Assembling (ARM-only): Common/src/swi_handler.S
arm-none-eabi-gcc -c -mcpu=arm7tdmi-s  -I. -x assembler-with-cpp -DROM_RUN -D__WinARM__ -D__WINARMSUBMDL_LPC2378__ -Wa,-adhlns=Common/src/swi_handler.lst,-gdwarf-2 Common/src/swi_handler.S -o Common/src/swi_handler.o

Compiling C: main.c
arm-none-eabi-gcc -c  -mcpu=arm7tdmi-s  -I. -gdwarf-2 -DROM_RUN -D__WinARM__ -D__WINARMSUBMDL_LPC2378__  -O0 -Wall -Wcast-align -Wimplicit  -Wpointer-arith -Wswitch -ffunction-sections -fdata-sections -Wredundant-decls -Wreturn-type -Wshadow -Wunused -Wa,-adhlns=main.lst  -ICommon/inc -Wcast-qual -MD -MP -MF .dep/main.o.d -Wnested-externs  -std=gnu99 -Wmissing-prototypes  -Wstrict-prototypes -Wmissing-declarations main.c -o main.o 

Compiling C: Common/src/target.c
arm-none-eabi-gcc -c  -mcpu=arm7tdmi-s  -I. -gdwarf-2 -DROM_RUN -D__WinARM__ -D__WINARMSUBMDL_LPC2378__  -O0 -Wall -Wcast-align -Wimplicit  -Wpointer-arith -Wswitch -ffunction-sections -fdata-sections -Wredundant-decls -Wreturn-type -Wshadow -Wunused -Wa,-adhlns=Common/src/target.lst  -ICommon/inc -Wcast-qual -MD -MP -MF .dep/target.o.d -Wnested-externs  -std=gnu99 -Wmissing-prototypes  -Wstrict-prototypes -Wmissing-declarations Common/src/target.c -o Common/src/target.o 

Compiling C: Common/src/irq.c
arm-none-eabi-gcc -c  -mcpu=arm7tdmi-s  -I. -gdwarf-2 -DROM_RUN -D__WinARM__ -D__WINARMSUBMDL_LPC2378__  -O0 -Wall -Wcast-align -Wimplicit  -Wpointer-arith -Wswitch -ffunction-sections -fdata-sections -Wredundant-decls -Wreturn-type -Wshadow -Wunused -Wa,-adhlns=Common/src/irq.lst  -ICommon/inc -Wcast-qual -MD -MP -MF .dep/irq.o.d -Wnested-externs  -std=gnu99 -Wmissing-prototypes  -Wstrict-prototypes -Wmissing-declarations Common/src/irq.c -o Common/src/irq.o 

Linking: main.elf
arm-none-eabi-gcc  -mcpu=arm7tdmi-s  -I. -gdwarf-2 -DROM_RUN -D__WinARM__ -D__WINARMSUBMDL_LPC2378__  -O0 -Wall -Wcast-align -Wimplicit  -Wpointer-arith -Wswitch -ffunction-sections -fdata-sections -Wredundant-decls -Wreturn-type -Wshadow -Wunused -Wa,-adhlns=Common/src/Startup.lst  -ICommon/inc -Wcast-qual -MD -MP -MF .dep/main.elf.d Common/src/Startup.o Common/src/swi_handler.o   main.o Common/src/target.o Common/src/irq.o     --output main.elf -nostartfiles -Wl,-Map=main.map,--cref,--gc-sections -lc  -lm -lc -lgcc     -TCommon//LPC2378-ROM.ld

Creating load file for Flash: main.hex
arm-none-eabi-objcopy -O ihex main.elf main.hex

Creating load file for Flash: main.bin
arm-none-eabi-objcopy -O binary main.elf main.bin

Creating Extended Listing: main.lss
arm-none-eabi-objdump -h -S -C main.elf > main.lss

Creating Symbol Table: main.sym
arm-none-eabi-nm -n main.elf > main.sym

Size after:
main.elf  :
section           size         addr
.text             2344            0
.bss                 4   1073741824
.stack            1024   1073742080
.ARM.attributes     48            0
.comment           129            0
.debug_aranges     200            0
.debug_pubnames    160            0
.debug_info        716            0
.debug_abbrev      369            0
.debug_line        625            0
.debug_frame       280            0
.debug_str         261            0
.debug_loc         344            0
.debug_ranges      112            0
Total             6616



Errors: none
-------- end --------

Author: İsmail K. (smail_k)
Posted on:

Rate this post
0 useful
not useful
thank you so much ;) working so good ... my problem is .. didnt open 
archive correctly .. ı followed your advice..

otherwise FIO1DIR,FIO1SET must be FIO0DIR and FIO0SET ;)

THANKS FOR YOUR SUPPORT

REGARDS

ISMAIL

Author: Kerbo (Guest)
Posted on:

Rate this post
0 useful
not useful
Finally some working interrupt example for this LPC....thanks everyone.
Kerbo

Author: pawowgold (Guest)
Posted on:

Rate this post
0 useful
not useful
very good, it's very useful to me, thank you very much!

[Mod: unrelated link removed]

Reply

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.