public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* RE: [ECOS] User libraries
       [not found] <A25DBA3B0717824BAFD61F81242D5DBD011B95C3@exchange.Ultra-UEMS.ca>
@ 2008-04-16 12:04 ` Steven Clugston
  2008-04-16 17:40   ` Davies, Greg
  2008-04-17  7:59   ` Alexander Neundorf
  0 siblings, 2 replies; 11+ messages in thread
From: Steven Clugston @ 2008-04-16 12:04 UTC (permalink / raw)
  To: ecos-discuss



>-----Original Message-----
>From: Davies, Greg [mailto:Greg.Davies@Ultra-UEMS.com] 
>Sent: 16 April 2008 11:40
>To: Steven Clugston
>Subject: RE: [ECOS] User libraries
>
>
>> From: Steven Clugston
>> I would like to be able to create and link in some of my own
>> generic library code into an eCos app.
>> I am slightly phased by this due to the custom linker script 
>> that is used by eCos. 


>Don't worry about the linker script. You have to use it, but 
>linking in regular static libraries is just a matter of using 
>-l (and maybe -L), or at least that's been my experience. I 
>don't have a readable makefile since I let eclipse take care 
>of all that for me. You seem to have covered everything, no 
>startup files, no standard libs, link whatever.
>

Thanks Gary and Greg.

As it happens, the libraries I want to use I've got already as eclipse
managed projects so it would be convienient if I could just create
another build profile for them for eCos as well as the standard Linux
Release/Debug ones.

I'm just curious how you've (Greg) setup the build with eclipse, do you
have all of your libraries as managed make project then the application
object as a standard make project for which you provide a makefile, or
are you able to set up a managed project to use the eCos linker script?

Steven



--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 11+ messages in thread

* RE: [ECOS] User libraries
  2008-04-16 12:04 ` [ECOS] User libraries Steven Clugston
@ 2008-04-16 17:40   ` Davies, Greg
  2008-04-17  8:04     ` Steven Clugston
  2008-04-17 11:25     ` Steven Clugston
  2008-04-17  7:59   ` Alexander Neundorf
  1 sibling, 2 replies; 11+ messages in thread
From: Davies, Greg @ 2008-04-16 17:40 UTC (permalink / raw)
  To: ecos-discuss

> From: Steven Clugston
> >-----Original Message-----
> >From: Davies, Greg [mailto:Greg.Davies@Ultra-UEMS.com]
> >Don't worry about the linker script. You have to use it, but 
> linking in 
> >regular static libraries is just a matter of using -l (and 
> maybe -L), 
> >or at least that's been my experience. I don't have a 
> 
> As it happens, the libraries I want to use I've got already 
> as eclipse managed projects so it would be convienient if I 
> could just create another build profile for them for eCos as 
> well as the standard Linux Release/Debug ones.

Are you using eclipse 3.2? I'm using 3.3 where there's no
managed/unmanaged makefile projects. Regardless, Here's my setup from
the bottom up: I have a driver project that builds a static lib for my
target. Its compiled like any normal aplication, but uses the arm-elf
tools. I have to target my architecture with gcc at this point
(-mcpu=arm7tdmi), and for some reason I use -rcs as archiver flags.
You'll have to look these up, because I don't remember what they do.
All my middle stuff has at least two build configurations, one for
building for the target board, using the same tools and flags as the
drivers, and another configuration to build for linux for simulation and
testing. Test projects themselves reference the linux build, and only
build for linux. I had problems referencing projects using cygwin and
eclipse because of the ":" after drive letters in the windows PATH
varriable.
I have eCos as a project using an external builder command, which just
runs the makefile that is output by the graphical configuration tool.
This allows me to reference the include and lib directories relative to
my workspace. Any project that links eCos also references the eCos
project, so it builds automatically when I need it. 
For my main application project, I set project references for everything
I want to bring in, add directories -I and -L, and libraries -l for
everything I need, including the eCos libraries. In the Misc section of
the linker setting I added to following:  -Wl,--cref
-Wl,-Map,ProjectName.map -lc -lgcc -T target.ld -n
The linker script target.ld is the one that eCos created for me on this
build, and it's in the same directory as target.a, otherwise I'd have to
add another directory -L so it could be found. As for the rest of the
options, I don't remember what they do. As you already know, but just
for completeness, I check the no startup files and no standard libs
boxes. 

I hope this helps. Let me know if I'm missing any details.

--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [ECOS] User libraries
  2008-04-16 12:04 ` [ECOS] User libraries Steven Clugston
  2008-04-16 17:40   ` Davies, Greg
@ 2008-04-17  7:59   ` Alexander Neundorf
  2008-04-17  9:09     ` Steven Clugston
  1 sibling, 1 reply; 11+ messages in thread
From: Alexander Neundorf @ 2008-04-17  7:59 UTC (permalink / raw)
  To: ecos-discuss

On Wednesday 16 April 2008, Steven Clugston wrote:
> >-----Original Message-----
> >From: Davies, Greg [mailto:Greg.Davies@Ultra-UEMS.com]
> >Sent: 16 April 2008 11:40
> >To: Steven Clugston
> >Subject: RE: [ECOS] User libraries
> >
> >> From: Steven Clugston
> >> I would like to be able to create and link in some of my own
> >> generic library code into an eCos app.
> >> I am slightly phased by this due to the custom linker script
> >> that is used by eCos.
> >
> >Don't worry about the linker script. You have to use it, but
> >linking in regular static libraries is just a matter of using
> >-l (and maybe -L), or at least that's been my experience. I
> >don't have a readable makefile since I let eclipse take care
> >of all that for me. You seem to have covered everything, no
> >startup files, no standard libs, link whatever.
>
> Thanks Gary and Greg.
>
> As it happens, the libraries I want to use I've got already as eclipse
> managed projects so it would be convienient if I could just create
> another build profile for them for eCos as well as the standard Linux
> Release/Debug ones.

Once you have the eCos library building more software against it is actually 
not really different from regular builds.

In case you don't want to write the makefile manually, you can let CMake 
(http://www.cmake.org) do this for you .

Starting with version 2.6.0 it also supports cross compiling:
http://www.cmake.org/Wiki/CMake_Cross_Compiling
Here you can find information how to use it for eCos:
http://www.cmake.org/Wiki/CmakeEcos

Also starting with version 2.6.0 it can also generate projects for Eclipse 
with CDT 4.
http://www.cmake.org/files/v2.6/

Alex

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 11+ messages in thread

* RE: [ECOS] User libraries
  2008-04-16 17:40   ` Davies, Greg
@ 2008-04-17  8:04     ` Steven Clugston
  2008-04-17 11:41       ` Davies, Greg
  2008-04-17 11:25     ` Steven Clugston
  1 sibling, 1 reply; 11+ messages in thread
From: Steven Clugston @ 2008-04-17  8:04 UTC (permalink / raw)
  To: ecos-discuss


>> >-----Original Message-----
>> >From: Davies, Greg [mailto:Greg.Davies@Ultra-UEMS.com]

>Are you using eclipse 3.2? I'm using 3.3 where there's no 
>managed/unmanaged makefile projects. 

I'm using eclipse 3.3 on Linux. It still has the notion of a makefile
project though.

>I have 
>eCos as a project using an external builder command, which 
>just runs the makefile that is output by the graphical 
>configuration tool. This allows me to reference the include 
>and lib directories relative to my workspace. Any project that 
>links eCos also references the eCos project, so it builds 
>automatically when I need it.

I've managed to build eCos in eclipse and build one additional library
that references it, i.e. it needs the termios.h header.
The configtool generates ProjectName_build and ProjectName_install
directories, both of these I tried to import into a single eclipse
project, but found even after modifying the path in the configtool
generated makefile, that it won't build.

So instead I've created two separate projects, eCos_build and
eCos_install in eclipse and that works fine.
It also allows me to run configtool directly on the projects if I keep
the .ecc file inside the workspace.
The eCos_install project is just a dummy project to contain the headers,
made dummy by not specifying a make command.
Also I had to persuade eclipse to run just 'make' and not 'make all' on
the eCos_build project.

>For my main application project, I set project references for 
>everything I want to bring in, add directories -I and -L, and 
>libraries -l for everything I need, including the eCos 
>libraries. In the Misc section of the linker setting I added 
>to following:  -Wl,--cref -Wl,-Map,ProjectName.map -lc -lgcc 
>-T target.ld -n The linker script target.ld is the one that 
>eCos created for me on this build, and it's in the same 
>directory as target.a, otherwise I'd have to add another 
>directory -L so it could be found. As for the rest of the 
>options, I don't remember what they do. As you already know, 
>but just for completeness, I check the no startup files and no 
>standard libs boxes. 
>

Next step is to try and setup an application project as you've
described.

Steven.

--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 11+ messages in thread

* RE: [ECOS] User libraries
  2008-04-17  7:59   ` Alexander Neundorf
@ 2008-04-17  9:09     ` Steven Clugston
  2008-04-17 17:31       ` Alexander Neundorf
  0 siblings, 1 reply; 11+ messages in thread
From: Steven Clugston @ 2008-04-17  9:09 UTC (permalink / raw)
  To: ecos-discuss


>Once you have the eCos library building more software against 
>it is actually 
>not really different from regular builds.
>
>In case you don't want to write the makefile manually, you can 
>let CMake 
>(http://www.cmake.org) do this for you .
>
>Starting with version 2.6.0 it also supports cross compiling: 
>http://www.cmake.org/Wiki/CMake_Cross_Compiling
>Here you can find information how to use it for eCos: 
>http://www.cmake.org/Wiki/CmakeEcos
>
>Also starting with version 2.6.0 it can also generate projects 
>for Eclipse 
>with CDT 4.
>http://www.cmake.org/files/v2.6/
>
>Alex

Thanks Alex, I'll deninately try this at some point.

I've used cmake before when it has been provided with open-source
projects like ICE and ORCA, but I've never had the chance to try and
setup a project from scratch with it yet.

Is there a wiki page for generating an eclipse project with cmake, or is
it trivial?

Steven.

--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 11+ messages in thread

* RE: [ECOS] User libraries
  2008-04-16 17:40   ` Davies, Greg
  2008-04-17  8:04     ` Steven Clugston
@ 2008-04-17 11:25     ` Steven Clugston
  2008-04-17 14:43       ` Andrew Lunn
  1 sibling, 1 reply; 11+ messages in thread
From: Steven Clugston @ 2008-04-17 11:25 UTC (permalink / raw)
  To: ecos-discuss


>For my main application project, I set project references for 
>everything I want to bring in, add directories -I and -L, and 
>libraries -l for everything I need, including the eCos 
>libraries. In the Misc section of the linker setting I added 
>to following:  -Wl,--cref -Wl,-Map,ProjectName.map -lc -lgcc 
>-T target.ld -n 

Now the fun begins with the link process.

Greg, I've looked through the ld man pages just to see what the flags
you use do, all looks good to me except the -lc and -lgcc.
Does this not try to include standard c and gcc libraries? 
In any case, it complains that it can't find them when I include these
flags, so I've left them out.

Trouble I has was it is it is finding mutliple definitions of most of
the symbols when eclipse runs the linker on the app:

Invoking: GCC C++ Linker
powerpc-eabi-g++ -nostartfiles -nodefaultlibs -nostdlib
-L"/home/path_to_workspace/eCos_install/lib" -Wl,--gc-sections
-Wl,--cref -Wl,-Map,ProjectName.map -lgcc -Ttarget.ld -n -o"ProjectName"
./src/ProjectName.o   -ltarget -lextras
/home/path_to_workspace/eCos_install/lib/extras.o: In function `R_t':
/home/path_to_workspace/eCos_install/lib/extras.o(.ecos.table.devtab.beg
in+0x0): multiple definition of `__DEVTAB__'
/home/path_to_workspace/eCos_install/lib/libextras.a(io_common_ioinit.o)
:/opt/ecos/packages/io/common/current/src/ioinit.cxx:73: first defined
here
/home/path_to_workspace/eCos_install/lib/extras.o: In function
`trigger':
/home/path_to_workspace/eCos_install/lib/extras.o(.ecos.table.mtab.extra
+0x0): multiple definition of `cyg_mtab_extra'

...and so on.

This turned out to be down to the link order, or rather the order in
which they are listed in the eclipse libraries (-l) dialog, libextras
needs to be before libtarget.

Seems to work now, or at least I end up with a binary, so thanks.

Steven.

--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 11+ messages in thread

* RE: [ECOS] User libraries
  2008-04-17  8:04     ` Steven Clugston
@ 2008-04-17 11:41       ` Davies, Greg
  0 siblings, 0 replies; 11+ messages in thread
From: Davies, Greg @ 2008-04-17 11:41 UTC (permalink / raw)
  To: Steven Clugston, ecos-discuss

> So instead I've created two separate projects, eCos_build and 
> eCos_install in eclipse and that works fine.

I didn't have to import them seperately, I have a project folder with my
.ecc files, then _build and _install are created by the configurator
under here, so they automatically appear in my project. 
Make is run from the project folder.
Build command:
make --directory Sothoc_Debug_build
Build Directory:
${workspace_loc:/eCos}

This way I can delete the _build and _install directories entirely when
things get fouled up, which they do from time to time, and it doesn't
delete the .project files on me. I find sometimes I'll change the
configuration, and it wil work fine, but if I delete the folders and
generate the build tree again, it no longer compiles, or no longer works
the same. Now I remove the directories regularly to make sure I can
always get a good build from scratch, but that's a whole different
topic. Don't change your working structure unless you run in to problems
though.

--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [ECOS] User libraries
  2008-04-17 11:25     ` Steven Clugston
@ 2008-04-17 14:43       ` Andrew Lunn
  0 siblings, 0 replies; 11+ messages in thread
From: Andrew Lunn @ 2008-04-17 14:43 UTC (permalink / raw)
  To: Steven Clugston; +Cc: ecos-discuss

> powerpc-eabi-g++ -nostartfiles -nodefaultlibs -nostdlib
> -L"/home/path_to_workspace/eCos_install/lib" -Wl,--gc-sections
> -Wl,--cref -Wl,-Map,ProjectName.map -lgcc -Ttarget.ld -n -o"ProjectName"
> ./src/ProjectName.o   -ltarget -lextras

Leave out -ltarget and -lextras

The linker script includes these.

     Andrew

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [ECOS] User libraries
  2008-04-17  9:09     ` Steven Clugston
@ 2008-04-17 17:31       ` Alexander Neundorf
  0 siblings, 0 replies; 11+ messages in thread
From: Alexander Neundorf @ 2008-04-17 17:31 UTC (permalink / raw)
  To: ecos-discuss

On Thursday 17 April 2008, Steven Clugston wrote:
> >Once you have the eCos library building more software against
> >it is actually
> >not really different from regular builds.
> >
> >In case you don't want to write the makefile manually, you can
> >let CMake
> >(http://www.cmake.org) do this for you .
> >
> >Starting with version 2.6.0 it also supports cross compiling:
> >http://www.cmake.org/Wiki/CMake_Cross_Compiling
> >Here you can find information how to use it for eCos:
> >http://www.cmake.org/Wiki/CmakeEcos
> >
> >Also starting with version 2.6.0 it can also generate projects
> >for Eclipse
> >with CDT 4.
> >http://www.cmake.org/files/v2.6/
> >
> >Alex
>
> Thanks Alex, I'll deninately try this at some point.
>
> I've used cmake before when it has been provided with open-source
> projects like ICE and ORCA, but I've never had the chance to try and
> setup a project from scratch with it yet.
>
> Is there a wiki page for generating an eclipse project with cmake, or is
> it trivial?

Works like any other project with cmake, you just have o select the eclipse 
project generator. If you use cmake 2.6 it comes with cmake-gui, which pops 
up a dialog and asks you which generator you want to have (makefiles, 
eclipse, kdevelop), on the command line you  have to use -G"Eclipse CDT4 - 
Unix Makefiles".
Here's a step-by-step howto:
http://www.cmake.org/Wiki/Eclipse_CDT4_Generator

Alex

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [ECOS] User libraries
  2008-04-16  9:20 Steven Clugston
@ 2008-04-16 11:19 ` Gary Thomas
  0 siblings, 0 replies; 11+ messages in thread
From: Gary Thomas @ 2008-04-16 11:19 UTC (permalink / raw)
  To: Steven Clugston; +Cc: ecos-discuss

Steven Clugston wrote:
> Hi
> 
> I would like to be able to create and link in some of my own generic
> library code into an eCos app.
> I am slightly phased by this due to the custom linker script that is
> used by eCos. 
> 
> Basically I want create static '.a' type libraries that may make use of
> the C library and POSIX compat packages.
> The only specific instrinstructions I've been able to find are from the
> ref manual.
> 
> To quote the eCos reference manual:
> 
> " If you put some of your source in libraries, you will have to
> explicitly
> include those libraries in the linking instruction.
> 
> You also need to link to the GNU C Compiler runtime support library
> (libgcc.a).
> You should not link to the standard C++ library. 
> This can be achieved with the -nostdlib option.
> You should only link to libtarget.a and libgcc.a using the linker script
> target.ld
> provided with eCos. The command line for linking should look like
> 
> gcc [options] [object files] -Ttarget.ld -nostdlib "
> 
> Is there anything else I need to be mindful of?
> 
> Does anybody have an example Makefile or can suggest how I can modify
> the ecos examples makefile to do this?

Try looking at http://www.mlbassoc.com/examples/build_httpd.html

-- 
------------------------------------------------------------
Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world
------------------------------------------------------------

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [ECOS] User libraries
@ 2008-04-16  9:20 Steven Clugston
  2008-04-16 11:19 ` Gary Thomas
  0 siblings, 1 reply; 11+ messages in thread
From: Steven Clugston @ 2008-04-16  9:20 UTC (permalink / raw)
  To: ecos-discuss

Hi

I would like to be able to create and link in some of my own generic
library code into an eCos app.
I am slightly phased by this due to the custom linker script that is
used by eCos. 

Basically I want create static '.a' type libraries that may make use of
the C library and POSIX compat packages.
The only specific instrinstructions I've been able to find are from the
ref manual.

To quote the eCos reference manual:

" If you put some of your source in libraries, you will have to
explicitly
include those libraries in the linking instruction.

You also need to link to the GNU C Compiler runtime support library
(libgcc.a).
You should not link to the standard C++ library. 
This can be achieved with the -nostdlib option.
You should only link to libtarget.a and libgcc.a using the linker script
target.ld
provided with eCos. The command line for linking should look like

gcc [options] [object files] -Ttarget.ld -nostdlib "

Is there anything else I need to be mindful of?

Does anybody have an example Makefile or can suggest how I can modify
the ecos examples makefile to do this?

Thanks,

Steven Clugston

--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2008-04-17 17:03 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <A25DBA3B0717824BAFD61F81242D5DBD011B95C3@exchange.Ultra-UEMS.ca>
2008-04-16 12:04 ` [ECOS] User libraries Steven Clugston
2008-04-16 17:40   ` Davies, Greg
2008-04-17  8:04     ` Steven Clugston
2008-04-17 11:41       ` Davies, Greg
2008-04-17 11:25     ` Steven Clugston
2008-04-17 14:43       ` Andrew Lunn
2008-04-17  7:59   ` Alexander Neundorf
2008-04-17  9:09     ` Steven Clugston
2008-04-17 17:31       ` Alexander Neundorf
2008-04-16  9:20 Steven Clugston
2008-04-16 11:19 ` Gary Thomas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).