EmbDev.net

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


von İsmail K. (smail_k)


Rate this post
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

von Martin Thomas (Guest)


Rate this post
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_projects/index.html#lpc23xx_demo1

von İsmail K. (smail_k)


Attached files:

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

thax four your reply.  =)

Regards.

von İsmail K. (smail_k)


Rate this post
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 :(

von İsmail K. (smail_k)


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

TSSSSSSSSSSSSSSS :(

von Michael G. (let)


Attached files:

Rate this post
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.

von İsmail K. (smail_k)


Rate this post
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

von Michael G. (let)


Rate this post
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.
1
C:\Users\let\Documents\workspace\blinkyy>make
2
3
-------- begin (mode: ROM_RUN) --------
4
arm-none-eabi-gcc (Sourcery G++ Lite 2010q1-188) 4.4.1
5
Copyright (C) 2009 Free Software Foundation, Inc.
6
This is free software; see the source for copying conditions.  There is NO
7
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
8
9
10
Assembling (ARM-only): Common/src/Startup.S
11
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
12
13
Assembling (ARM-only): Common/src/swi_handler.S
14
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
15
16
Compiling C: main.c
17
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 
18
19
Compiling C: Common/src/target.c
20
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 
21
22
Compiling C: Common/src/irq.c
23
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 
24
25
Linking: main.elf
26
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
27
28
Creating load file for Flash: main.hex
29
arm-none-eabi-objcopy -O ihex main.elf main.hex
30
31
Creating load file for Flash: main.bin
32
arm-none-eabi-objcopy -O binary main.elf main.bin
33
34
Creating Extended Listing: main.lss
35
arm-none-eabi-objdump -h -S -C main.elf > main.lss
36
37
Creating Symbol Table: main.sym
38
arm-none-eabi-nm -n main.elf > main.sym
39
40
Size after:
41
main.elf  :
42
section           size         addr
43
.text             2344            0
44
.bss                 4   1073741824
45
.stack            1024   1073742080
46
.ARM.attributes     48            0
47
.comment           129            0
48
.debug_aranges     200            0
49
.debug_pubnames    160            0
50
.debug_info        716            0
51
.debug_abbrev      369            0
52
.debug_line        625            0
53
.debug_frame       280            0
54
.debug_str         261            0
55
.debug_loc         344            0
56
.debug_ranges      112            0
57
Total             6616
58
59
60
61
Errors: none
62
-------- end --------

von İsmail K. (smail_k)


Rate this post
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

von Kerbo (Guest)


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

von pawowgold (Guest)


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

[Mod: unrelated link removed]

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.