Re: Makefile for a simple program

Greg Ungerer <[email protected]>
Newsgroups gmane.comp.hardware.motorola.microcontrollers.coldfire
Message-ID <[email protected]>
Hi Bob,

Bob Brusa wrote:
> Morning Greg
> stand alone. The board has dBUG loaded and I use it to download and launch
> my helloworld program. But it crashes, probably because the startup file
> or the libraries or both used during the link process are not the right
> ones.

Yep, that will be the case. By default that toolchain will link
with startup code and libs appropriate for a uClinux application
(ie that expects to be run on a uClinux kernel). It won't be
appropriate for a bare metal system.

You could pull startup code from a boot loader, and probably
a printf() as well, and link it altogether with that toolchain.
Something like CoLilo is pretty simple, but there are others
around too.

Regards
Greg



> Regards Bob
> 
> PS1: When sending or answering a mail to [email protected] - what
> should be the entry in the field "replay to". Up to now, I put
> [email protected] there - and rarely got an answer - then I put my own
> mail address there and got your answer. Coincidence or something else?

On most emailers you can just hit "Reply All" and it will get the
headers correct.


> PS2: The first attempt to answer to [email protected] failed. I got 
> an error message. It seems [email protected] is considered a spammer. I 
> did what the error message told me I should do to fix the problem. See 
> if it helps.
> 
> On Wed, 06 Feb 2008 01:45:47 +0100, Greg Ungerer <[email protected]> wrote:
> 
>> Hi Bob,
>>
>> Bob Brusa wrote:
>>> Hm, it seems simple, but it is not. I have tried a lot and get errors 
>>> only.
>>>  I use a COBRA5282-board (with dBUG ready) and I want to compile, 
>>> link, download and execute the simple helloworld-program shown below:
>>> ----------------------------------
>>> #include <stdio.h>
>>>  int main(void)
>>> {
>>>     printf("Hello World\n");
>>>     return 0;
>>> }
>>> -----------------------------------
>>>  I use the toolchain installed by executing the script 
>>> m68k-uclinux-tools-20061214.sh (downloaded from 
>>> http://www.uclinux.org/pub/uClinux/m68k-elf-tools/)
>>> My present understanding is, that the makefile should use a prefix of 
>>> m68k-uclinux and hence invoke gcc as m68k-uclinux-gcc. But there are 
>>> options (and more) required and I do not really see which ones. Does 
>>> anyone have a "proposal" how my makefile should look like?
>>
>> Are you trying to build a uClinux application, or a stand alone
>> run-on-bare-metal binary?
>>
>> The above toolchain can of course do both, but you will supply
>> a different set of compile options.
>>
>> If compiling a stand alone binary you will need some assembler start
>> up code, and a library to supply a bare-metal printf as well.
>> The above toolchain does not have those in it. (It does have
>> libraries and startup code for uClinux applications though).
>>
>> Regards
>> Greg
>>
>>
>>
>>> Thank you and best regards
>>> Bob
>>>  PS: Download to the board using tftp works fine, but the binaries I 
>>> get from my makefile do not work.
>>>  --Bob Brusa                [email protected]
>>> Chapfwiesenstr. 14       ph: +4144 926 74 74
>>> CH-8712 Stäfa            fx:   +4144 926 73 34
>>> ---
>>> [email protected]              Send a post to the list.
>>> [email protected]        Join the list.
>>> [email protected]    Join the list in digest mode.
>>> [email protected]     Leave the list.
>>>
>>
> 
> 
> 
> --Bob Brusa                [email protected]
> Chapfwiesenstr. 14       ph: +4144 926 74 74
> CH-8712 Stäfa            fx:   +4144 926 73 34
> ---
> [email protected]              Send a post to the list.
> [email protected]        Join the list.
> [email protected]    Join the list in digest mode.
> [email protected]     Leave the list.
> 
> 

-- 
------------------------------------------------------------------------
Greg Ungerer  --  Chief Software Dude       EMAIL:     [email protected]
Secure Computing Corporation                PHONE:       +61 7 3435 2888
825 Stanley St,                             FAX:         +61 7 3891 3630
Woolloongabba, QLD, 4102, Australia         WEB: http://www.SnapGear.com
---
[email protected]              Send a post to the list.
[email protected]        Join the list.
[email protected]    Join the list in digest mode.
[email protected]     Leave the list.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.