EmbDev.net

Forum: ARM programming with GCC/GNU tools problem with generating hex code


Author: Abhijeet Bokil (xmonito)
Posted on:

Rate this post
0 useful
not useful
I'm using arm-elf-gcc on winxp trying to crosscompile and then make
intel hex file for dumping into my target LPC2119 ARM7TDMI. I
successfully compile it and then using objdump create hex file. But the
code isn't running on the processor. I don't know how to use the
target.ld while linking or what i'll have to do to configure it! Please
help! Is there any tutorial where i can find details of
linking,compiling for arm targets?

Author: Clifford Slocombe (clifford)
Posted on:

Rate this post
0 useful
not useful
There about a million reasons why your code might not run on the target;
most of which have nothing to do with generating hex code. What makes
you think that it is the hex code generation that is the issue? It seems
the least likely explanation. It is impossible to tell from the limited
information given.

Author: Abhijeet Bokil (xmonito)
Posted on:

Rate this post
0 useful
not useful
That's fair! Actually, i've been using keil compiler,assembler to
generate hex code from C source for the same hardware which works so
hardware is perfectly fine. Cpu is a Lpc2119/01. Keil uVision3 that i'm
using is actually an evaluation copy and now as the code size has gone
past the limitations, i'm upto gcc and i'm a newbie at that. I guess the
compilation must be ok as,

> arm-elf-gcc -c -O2 -mcpu=arm7tdmi filename.c -o filename.o

this generates the filename.o, but if i just link it now without any
crt0.s  into the filename.elf and then objdump to hex, that isn't
working. How can i go about the crt0.s. How can i make it crt0.o. how
can i use it whil linking. or just please help!! Thnks..

Author: Abhijeet Bokil (xmonito)
Posted on:

Rate this post
0 useful
not useful
Ok! I have got the thing now and its working on the board so thanks!

Author: alextj (Guest)
Posted on:

Rate this post
0 useful
not useful
This is a really old thread, I'm afraid, but I am in exactly the same 
situation - I have LPC2119/01, code compiled with Keil (uVision demo) 
works, code compiled with GCC-4.2 toolchain from GNUARM doesn't seem to 
work after uploading. It's a bit puzzling, since all the information 
about compiling is for Keil, but I can't find anything that would work 
with GNUARM.

I guess original poster isn't watching this thread anymore, but maybe 
someone can give some ideas/suggestions/links on how to use GNUARM 
toolchain?

Thanks

Author: Martin Thomas (mthomas) (Moderator)
Posted on:

Rate this post
0 useful
not useful
alextj wrote:
> This is a really old thread, I'm afraid, but I am in exactly the same
> situation - I have LPC2119/01, code compiled with Keil (uVision demo)
> works,
Using the RV toolset? Or has uVision been used as IDE for a GNU 
toolchain?

> code compiled with GCC-4.2 toolchain from GNUARM doesn't seem to
> work after uploading.
If you have used the RealView tools (uVision default) you have made some 
modifications at least in the startup-code since the RV assembler and 
GNU assembler are not compatible. Please show at least your 
modficiations.

> It's a bit puzzling, since all the information
> about compiling is for Keil, but I can't find anything that would work
> with GNUARM.
There are a few examples for LPC2k and GNU tools freely available. Those 
from my WinARM page might not be the best ones but should give you some 
hints.

Author: alextj (Guest)
Posted on:

Rate this post
0 useful
not useful
Haha, my the problem was quite simple actually. The test code relied on 
a delay function which was optimized out by GCC, which in turn rendered 
the whole thing useless. uVision compiler probably had different 
optimization settings.
Anyway, thanks for your reply M.T. I'm on my way to making great things 
with this MCU ;)

Author: Clifford Slocombe (clifford)
Posted on:

Rate this post
0 useful
not useful
> The test code relied on a delay function which
> was optimized out by GCC

It is almost always better to use a hardware timer for delay functions, 
however, you probably used a loop with a non-volatile control variable. 
A good C compiler will see that the control variable is assigned but not 
used, and optimise it out - the whole loop disappears. You must expect 
this to happen regardless of optimisation settings or compiler, and 
simply write the code correctly. If the intent is to create a delay...

volatile int delay ;
for( delay = 0; delay < 100000; delay++ {} ;

The volatile qualifier prevents the compiler optimising out the loop 
under any circumstances on any conforming compiler.

Clifford

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.