Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

Re: [lpc2000] My LPC2106 won't return from function calls

2005-03-05 by Michael Johnson

If you use CrossWorks to build the program then the startup code will be 
included....

Regards
Michael

>Hi Thomas,
>
>Give this a try. You need to setup the SVC stack
>before you can call functions from the entry point.
>The simple application attached along with this should
>run from both Flash & RAM (use tmon -- packaged along
>with ucos_arm at my site).
>
>http://geocities.com/michaelanburaj/controller.html
>
>Cheers,
>-Mike.
>
>--- ooggie01 <ooggie01@...> wrote:
>  
>
>>I'm trying to learn how to write C programs for my
>>LPC-MT-2106 board 
>>from Olimex.  I'm using the GNU toolchain for
>>compiling/linking and 
>>CrossWorks for programming the board.  I
>>successfully got the LED to 
>>blink; however, as soon as I introduced a function
>>call, my code 
>>won't work.  It still compiles/links/programs just
>>fine, but the LED 
>>won't change.  It seems like the processor never
>>returns from any 
>>function calls.  Any ideas why this may be?
>>
>>I've included my code and makefile below.  The first
>>program works 
>>and the second one doesn't.
>>
>>Thanks in advance!
>>
>>Thomas
>>
>>
>>
>>// led.c without function calls
>>
>>/* General Purpose Input/Output (GPIO) */
>>#define IOPIN	(*((volatile unsigned long *)
>>0xE0028000))
>>#define IOSET	(*((volatile unsigned long *)
>>0xE0028004))
>>#define IODIR	(*((volatile unsigned long *)
>>0xE0028008))	// 0-
>>INPUT 1-OUTPUT
>>#define IOCLR	(*((volatile unsigned long *)
>>0xE002800C))
>>
>>#define LEDMASK 0x00001000	// LED	P0.12
>>
>>unsigned int i;
>>
>>int main()
>>{
>>	IODIR = IODIR | LEDMASK;
>>	while(1)
>>	{
>>		IOCLR = IOCLR | LEDMASK;
>>		for( i = 0; i < 50000; i++ )
>>		{
>>		}
>>		IOSET = IOSET | LEDMASK;
>>		for( i = 0; i < 50000; i++ )
>>		{
>>		}
>>	}
>>	return 0;
>>}
>>// EOF
>>
>>
>>// led.c with a function call
>>
>>/* General Purpose Input/Output (GPIO) */
>>#define IOPIN	(*((volatile unsigned long *)
>>0xE0028000))
>>#define IOSET	(*((volatile unsigned long *)
>>0xE0028004))
>>#define IODIR	(*((volatile unsigned long *)
>>0xE0028008))	// 0-
>>INPUT 1-OUTPUT
>>#define IOCLR	(*((volatile unsigned long *)
>>0xE002800C))
>>
>>
>>#define LEDMASK 0x00001000	// LED	P0.12
>>
>>void delay( unsigned int i )
>>{
>>	for( i = 0; i < 50000; i++ )
>>	{
>>	}
>>}
>>
>>int main()
>>{
>>	IODIR = IODIR | LEDMASK;
>>	while(1)
>>	{
>>		IOCLR = IOCLR | LEDMASK;
>>		delay( 50000 );
>>		IOSET = IOSET | LEDMASK;
>>		delay( 50000 );
>>	}
>>	return 0;
>>}
>>// EOF
>>
>>
>>// makefile
>>
>>arm-elf-gcc -c led.c -o led.o
>>arm-elf-gcc -TLPCH40MB.LD -nostartfiles -o led.elf
>>led.o
>>
>>
>>
>>
>>
>>    
>>
>
>
>	
>		
>__________________________________ 
>Celebrate Yahoo!'s 10th Birthday! 
>Yahoo! Netrospective: 100 Moments of the Web 
>http://birthday.yahoo.com/netrospective/
>
>[Non-text portions of this message have been removed]
>
>
>
> 
>Yahoo! Groups Links
>
>
>
> 
>
>
>
>  
>

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.