EmbeddedRelated.com
Forums

MCB2300 help with blinky & GCC

Started by shroffja December 31, 2007
Hi All,

Well I am tearing my hair out on this one and hoping someone can help.

I have a MCB2300 board that I have verified using Keil Realview
compiler - I can successfully compile and run the Blinky program.

I want to move to GCC so I installed winARM and downloaded the test
programs from the Files section on this group, but am unable to get the
programs to work. It compiles fine from the command line via make and
also within the Keil IDE but running them via FlashMagic does not work.

I have verified that FlashMagic is functioning as expected by
downloading the realview generated blinky prog.

I suspect I am having problems with the startup files (CRT0), would
someone please point me to a working blinky program for the MCB2300
using gcc with the startup files and also a confirmed hex file so I can
figure out what I am screwing up?

Thanks a ton
Jay

An Engineer's Guide to the LPC2100 Series

Shroffja,

U dont need startup file for WinARM.
U have to make Makefile and then compile..

U can try any example pgm mentioned in WinARM example codes.

It gets compiled and executed nicely.

Ravi
On Mon, 31 Dec 2008 shroffja wrote :
>Hi All,
>
>Well I am tearing my hair out on this one and hoping someone can help.
>
>I have a MCB2300 board that I have verified using Keil Realview
>compiler - I can successfully compile and run the Blinky program.
>
>I want to move to GCC so I installed winARM and downloaded the test
>programs from the Files section on this group, but am unable to get the
>programs to work. It compiles fine from the command line via make and
>also within the Keil IDE but running them via FlashMagic does not work.
>
>I have verified that FlashMagic is functioning as expected by
>downloading the realview generated blinky prog.
>
>I suspect I am having problems with the startup files (CRT0), would
>someone please point me to a working blinky program for the MCB2300
>using gcc with the startup files and also a confirmed hex file so I can
>figure out what I am screwing up?
>
>Thanks a ton
>Jay
>
--- In l..., "shroffja" wrote:
>
> Hi All,
>
> Well I am tearing my hair out on this one and hoping someone can
help.
>
> I have a MCB2300 board that I have verified using Keil Realview
> compiler - I can successfully compile and run the Blinky program.
>
> I want to move to GCC so I installed winARM and downloaded the test
> programs from the Files section on this group, but am unable to get
the
> programs to work. It compiles fine from the command line via make
and
> also within the Keil IDE but running them via FlashMagic does not
work.
>
> I have verified that FlashMagic is functioning as expected by
> downloading the realview generated blinky prog.
>
> I suspect I am having problems with the startup files (CRT0), would
> someone please point me to a working blinky program for the MCB2300
> using gcc with the startup files and also a confirmed hex file so I
can
> figure out what I am screwing up?
>
> Thanks a ton
> Jay
>
The files section has a project from sahi_ono for the MCB2300 that
compiles fine but I cannot seem to get it to work.

The LPC23XX folder has a GNU project but compiling it results in the
following errors which I have not been able to resolve yet...

Build target 'LPC2368 Flash'
assembling LPC2300.s...
compiling Retarget.c...
compiling Main.c...
Main.c: In function 'main':
Main.c(57): warning: pointer targets in passing argument 1
of 'lcd_print' differ in signedness
Main.c(59): warning: pointer targets in passing argument 1
of 'lcd_print' differ in signedness
Main.c(44): warning: unused variable 'i'
Main.c(45): warning: 'AD_old' may be used uninitialized in this
function
compiling IRQ.c...
compiling timer.c...
compiling Serial.c...
compiling ADC.c...
compiling LED.c...
compiling LCD.c...
linking...
c:/winarm/bin/../lib/gcc/arm-elf/4.1.1/../../../../arm-
elf/bin/ld.exe: section .RESET [000079c8 -> 00007b93] overlaps
section .data [000079c8 -> 000081eb]
c:/winarm/bin/../lib/gcc/arm-elf/4.1.1/../../../../arm-
elf/bin/ld.exe: warning: cannot find entry symbol _reset_handler;
defaulting to 00000000
.\\output\\lpc2300.o: In function `__main_exit':
C:\lpcexamples\MCB2300_Test_GNU/LPC2300.s:563: undefined reference to
`_etext'
C:\lpcexamples\MCB2300_Test_GNU/LPC2300.s:563: undefined reference to
`_data'
C:\lpcexamples\MCB2300_Test_GNU/LPC2300.s:563: undefined reference to
`_edata'
C:\lpcexamples\MCB2300_Test_GNU/LPC2300.s:563: undefined reference to
`__bss_start__'
c:/winarm/bin/../lib/gcc/arm-elf/4.1.1/../../../../arm-
elf/lib/interwork\libc.a(freer.o): In function `_malloc_trim_r':
mallocr.c:(.text+0x48): undefined reference to `_sbrk_r'
mallocr.c:(.text+0x64): undefined reference to `_sbrk_r'
mallocr.c:(.text+0x84): undefined reference to `_sbrk_r'
c:/winarm/bin/../lib/gcc/arm-elf/4.1.1/../../../../arm-
elf/lib/interwork\libc.a(makebuf.o): In function `__smakebuf':
makebuf.c:(.text+0x3c): undefined reference to `_fstat_r'
makebuf.c:(.text+0x110): undefined reference to `isatty'
c:/winarm/bin/../lib/gcc/arm-elf/4.1.1/../../../../arm-
elf/lib/interwork\libc.a(mallocr.o): In function `_malloc_r':
mallocr.c:(.text+0x40c): undefined reference to `_sbrk_r'
mallocr.c:(.text+0x4b4): undefined reference to `_sbrk_r'
c:/winarm/bin/../lib/gcc/arm-elf/4.1.1/../../../../arm-
elf/lib/interwork\libc.a(stdio.o): In function `__sclose':
stdio.c:(.text+0x10): undefined reference to `_close_r'
c:/winarm/bin/../lib/gcc/arm-elf/4.1.1/../../../../arm-
elf/lib/interwork\libc.a(stdio.o): In function `__sseek':
stdio.c:(.text+0x3c): undefined reference to `_lseek_r'
c:/winarm/bin/../lib/gcc/arm-elf/4.1.1/../../../../arm-
elf/lib/interwork\libc.a(stdio.o): In function `__swrite':
stdio.c:(.text+0x94): undefined reference to `_lseek_r'
stdio.c:(.text+0xb8): undefined reference to `_write_r'
c:/winarm/bin/../lib/gcc/arm-elf/4.1.1/../../../../arm-
elf/lib/interwork\libc.a(stdio.o): In function `__sread':
stdio.c:(.text+0xe4): undefined reference to `_read_r'
collect2: ld returned 1 exit status
creating hex file...
arm-elf-objcopy: '.\Output\Test.elf': No such file
arm-elf-objcopy: error: the input file '.\Output\Test.elf' is empty
".\Output\Test.elf" - 0 Error(s), 4 Warning(s).
Thanks
Jay
--- In l..., "Ravi" wrote:
>
> Hi Jay,
> Thats true, As I have LPC2148, I never seen whether LPC2300 examples
are there or not.
>
> I'm sorry I was wrong for startup.s file, definately u dont need that
Actually, you definately DO need that!!! There is no requirement that
it be named startup.s or CRT0.s, or whatever, but the function
performed by such a code file is definately required. The minimum
function of such a code file is to set up the exception vector table,
set up the required stacks, and perform RAM initialization before any
C code runs. There are a few other things that might be done in the
startup file, but the minimum functions are required for the C code to
even run properly. The last action performed in the startup file is a
jump to C's main().

--Dave
shroffja Wrote
>Build target 'LPC2368 Flash'
>assembling LPC2300.s...


>linking...
>c:/winarm/bin/../lib/gcc/arm-elf/4.1.1/../../../../arm-
>elf/bin/ld.exe: section .RESET [000079c8 -> 00007b93] overlaps
>section .data [000079c8 -> 000081eb]
>c:/winarm/bin/../lib/gcc/arm-elf/4.1.1/../../../../arm-
>elf/bin/ld.exe: warning: cannot find entry symbol _reset_handler;
>defaulting to 00000000
>.\\output\\lpc2300.o: In function `__main_exit':
>C:\lpcexamples\MCB2300_Test_GNU/LPC2300.s:563: undefined reference to
>`_etext'
>C:\lpcexamples\MCB2300_Test_GNU/LPC2300.s:563: undefined reference to
>`_data'
>C:\lpcexamples\MCB2300_Test_GNU/LPC2300.s:563: undefined reference to
>`_edata'
>C:\lpcexamples\MCB2300_Test_GNU/LPC2300.s:563: undefined reference to
>`__bss_start__'

Your linker script needs to define the above.

>c:/winarm/bin/../lib/gcc/arm-elf/4.1.1/../../../../arm-
>elf/lib/interwork\libc.a(freer.o): In function `_malloc_trim_r':
>mallocr.c:(.text+0x48): undefined reference to `_sbrk_r'
>mallocr.c:(.text+0x64): undefined reference to `_sbrk_r'

And you are missing the newlib stubs. As I recall WinARM uses newlib-lpc
to provide these. You can use that or provide a similar set of stubs.

Robert
--------------------------------
mail2web.com What can On Demand Business Solutions do for you?
http://link.mail2web.com/Business/SharePoint



Hi Jay,
Thats true, As I have LPC2148, I never seen whether LPC2300 examples are there or not.

I'm sorry I was wrong for startup.s file, definately u dont need that but there are two files required for linking.
one is *RAM.ld and other one *ROM.ld

I think project for KEIL does not work directly on WinARM,
both need different set of files other than source code.

Ravi

On Mon, 31 Dec 2008 shroffja wrote :
>Hi Ravi,
>
>Don't you need the CRT0.s file? That is what I was referring to as
>the startup file...
>
>Anyway's what examples within winARM are you referring to it seems
>most examples are for the 21xx series?
>
>Thanks
>Jay
>
>--- In l..., "Ravi" wrote:
> >
> > Shroffja,
> >
> > U dont need startup file for WinARM.
> > U have to make Makefile and then compile..
> >
> > U can try any example pgm mentioned in WinARM example codes.
> >
> > It gets compiled and executed nicely.
> >
> > Ravi
> >
> >
> > On Mon, 31 Dec 2008 shroffja wrote :
> > >Hi All,
> > >
> > >Well I am tearing my hair out on this one and hoping someone can
>help.
> > >
> > >I have a MCB2300 board that I have verified using Keil Realview
> > >compiler - I can successfully compile and run the Blinky program.
> > >
> > >I want to move to GCC so I installed winARM and downloaded the test
> > >programs from the Files section on this group, but am unable to
>get the
> > >programs to work. It compiles fine from the command line via make
>and
> > >also within the Keil IDE but running them via FlashMagic does not
>work.
> > >
> > >I have verified that FlashMagic is functioning as expected by
> > >downloading the realview generated blinky prog.
> > >
> > >I suspect I am having problems with the startup files (CRT0), would
> > >someone please point me to a working blinky program for the MCB2300
> > >using gcc with the startup files and also a confirmed hex file so
>I can
> > >figure out what I am screwing up?
> > >
> > >Thanks a ton
> > >Jay
> > >
> >
> >
> >
> >




Thanx Mr Dave,

Thats very good knowledge update for me.
Thanx once again and wish a very happy new year..
Ravi
On Mon, 31 Dec 2008 derbaier wrote :
>--- In l..., "Ravi" wrote:
> >
> > Hi Jay,
> > Thats true, As I have LPC2148, I never seen whether LPC2300 examples
>are there or not.
> >
> > I'm sorry I was wrong for startup.s file, definately u dont need that
>Actually, you definately DO need that!!! There is no requirement that
>it be named startup.s or CRT0.s, or whatever, but the function
>performed by such a code file is definately required. The minimum
>function of such a code file is to set up the exception vector table,
>set up the required stacks, and perform RAM initialization before any
>C code runs. There are a few other things that might be done in the
>startup file, but the minimum functions are required for the C code to
>even run properly. The last action performed in the startup file is a
>jump to C's main().
>
>--Dave
Hi Ravi,

Don't you need the CRT0.s file? That is what I was referring to as
the startup file...

Anyway's what examples within winARM are you referring to it seems
most examples are for the 21xx series?

Thanks
Jay

--- In l..., "Ravi" wrote:
>
> Shroffja,
>
> U dont need startup file for WinARM.
> U have to make Makefile and then compile..
>
> U can try any example pgm mentioned in WinARM example codes.
>
> It gets compiled and executed nicely.
>
> Ravi
> On Mon, 31 Dec 2008 shroffja wrote :
> >Hi All,
> >
> >Well I am tearing my hair out on this one and hoping someone can
help.
> >
> >I have a MCB2300 board that I have verified using Keil Realview
> >compiler - I can successfully compile and run the Blinky program.
> >
> >I want to move to GCC so I installed winARM and downloaded the test
> >programs from the Files section on this group, but am unable to
get the
> >programs to work. It compiles fine from the command line via make
and
> >also within the Keil IDE but running them via FlashMagic does not
work.
> >
> >I have verified that FlashMagic is functioning as expected by
> >downloading the realview generated blinky prog.
> >
> >I suspect I am having problems with the startup files (CRT0), would
> >someone please point me to a working blinky program for the MCB2300
> >using gcc with the startup files and also a confirmed hex file so
I can
> >figure out what I am screwing up?
> >
> >Thanks a ton
> >Jay
> >
>
>