public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] Position Independent Code
@ 2007-10-09 17:13 Slide
  2007-10-09 17:28 ` Andrew Lunn
  2007-10-09 18:25 ` Gary Thomas
  0 siblings, 2 replies; 11+ messages in thread
From: Slide @ 2007-10-09 17:13 UTC (permalink / raw)
  To: ecos-discuss

All,

Does eCos work if I build for PIC? I would like to be able to move my
application around in memory as much as possible.

Thanks,

slide

-- 
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] Position Independent Code
  2007-10-09 17:13 [ECOS] Position Independent Code Slide
@ 2007-10-09 17:28 ` Andrew Lunn
  2007-10-09 18:25 ` Gary Thomas
  1 sibling, 0 replies; 11+ messages in thread
From: Andrew Lunn @ 2007-10-09 17:28 UTC (permalink / raw)
  To: Slide; +Cc: ecos-discuss

On Tue, Oct 09, 2007 at 10:13:16AM -0700, Slide wrote:
> All,
> 
> Does eCos work if I build for PIC? 

No.

        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] Position Independent Code
  2007-10-09 17:13 [ECOS] Position Independent Code Slide
  2007-10-09 17:28 ` Andrew Lunn
@ 2007-10-09 18:25 ` Gary Thomas
       [not found]   ` <a623f7d10710091206l9b4f27ay5f6140b81a38f759@mail.gmail.com>
  1 sibling, 1 reply; 11+ messages in thread
From: Gary Thomas @ 2007-10-09 18:25 UTC (permalink / raw)
  To: Slide; +Cc: ecos-discuss

Slide wrote:
> All,
> 
> Does eCos work if I build for PIC? I would like to be able to move my
> application around in memory as much as possible.

In general, PIC code suffers both size and performance penalties.
eCos is all about the most configurable (and hopefully most
optimal) solution, so we've never supported PIC.

Why would you want to do this?

-- 
------------------------------------------------------------
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

* Re: [ECOS] Position Independent Code
       [not found]   ` <a623f7d10710091206l9b4f27ay5f6140b81a38f759@mail.gmail.com>
@ 2007-10-09 19:12     ` Gary Thomas
  2007-10-09 20:49       ` Slide
  2007-10-10 22:27       ` [ECOS] error: no memory region specified for loadable section `.got' Scott Moore
  0 siblings, 2 replies; 11+ messages in thread
From: Gary Thomas @ 2007-10-09 19:12 UTC (permalink / raw)
  To: Slide; +Cc: eCos Discussion

Slide wrote:
> On 10/9/07, Gary Thomas <gary@mlbassoc.com> wrote:
>> Slide wrote:
>>> All,
>>>
>>> Does eCos work if I build for PIC? I would like to be able to move my
>>> application around in memory as much as possible.
>> In general, PIC code suffers both size and performance penalties.
>> eCos is all about the most configurable (and hopefully most
>> optimal) solution, so we've never supported PIC.
>>
>> Why would you want to do this?
>>
> 
> 
> Perhaps I am just thinking about this the wrong way then. What I would
> like is an application image that I can load to any address I want. My
> bootloader will handle setting up virtual memory, so I guess all I
> really have to do is compile for a constant virtual address which will
> be mapped by my bootloader to any of the memory regions I am
> interested in. Does this sound like a better solution?

Yes, this is the basic approach taken by eCos, although in general
there's no "virtual" memory mapping involved.

BTW, please keep your replies on the list so that all may
benefit.  Private email [with MLB Associates] is available
only with a support contract.

-- 
------------------------------------------------------------
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

* Re: [ECOS] Position Independent Code
  2007-10-09 19:12     ` Gary Thomas
@ 2007-10-09 20:49       ` Slide
  2007-10-10 22:27       ` [ECOS] error: no memory region specified for loadable section `.got' Scott Moore
  1 sibling, 0 replies; 11+ messages in thread
From: Slide @ 2007-10-09 20:49 UTC (permalink / raw)
  To: ecos-discuss

On 10/9/07, Gary Thomas <gary@mlbassoc.com> wrote:
> Slide wrote:
> > On 10/9/07, Gary Thomas <gary@mlbassoc.com> wrote:
> >> Slide wrote:
> >>> All,
> >>>
> >>> Does eCos work if I build for PIC? I would like to be able to move my
> >>> application around in memory as much as possible.
> >> In general, PIC code suffers both size and performance penalties.
> >> eCos is all about the most configurable (and hopefully most
> >> optimal) solution, so we've never supported PIC.
> >>
> >> Why would you want to do this?
> >>
> >
> >
> > Perhaps I am just thinking about this the wrong way then. What I would
> > like is an application image that I can load to any address I want. My
> > bootloader will handle setting up virtual memory, so I guess all I
> > really have to do is compile for a constant virtual address which will
> > be mapped by my bootloader to any of the memory regions I am
> > interested in. Does this sound like a better solution?
>
> Yes, this is the basic approach taken by eCos, although in general
> there's no "virtual" memory mapping involved.
>
> BTW, please keep your replies on the list so that all may
> benefit.  Private email [with MLB Associates] is available
> only with a support contract.
>
> --


Sorry, gmail tends to do that to me. Thanks for the information.

slide

-- 
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] error: no memory region specified for loadable section `.got'
  2007-10-09 19:12     ` Gary Thomas
  2007-10-09 20:49       ` Slide
@ 2007-10-10 22:27       ` Scott Moore
  2007-10-11 10:51         ` [ECOS] Problem with obtaining sockaddr from recvfrom() jerzy dyrda
  2007-10-11 13:10         ` [ECOS] error: no memory region specified for loadable section `.got' Chris Zimman
  1 sibling, 2 replies; 11+ messages in thread
From: Scott Moore @ 2007-10-10 22:27 UTC (permalink / raw)
  To: eCos Discussion; +Cc: Steve Gaskill

Hi, 

we are trying to compile ecos with a later version than the default
supplied arm toolset. Ecos compiles to a .a just fine, but then the
final compile/link (in this case the example "hello.c") fails with
the error:

===============================================================================
C:\projects\ecos_examples>arm-unknown-linux-gnu-gcc -nostartfiles -Lc:/projects/
ecos_test/install/lib -Ttarget.ld -static -mcpu=arm7tdmi -Wl,--gc-sections -Wl,-
static -g -nostdlib -o hello.elf hello.o
/home/samiam/opt/crosstool/gcc-4.1.0-glibc-2.3.2/arm-unknown-linux-gnu/lib/gcc/a
rm-unknown-linux-gnu/4.1.0/../../../../arm-unknown-linux-gnu/bin/ld: error: no m
emory region specified for loadable section `.got'
collect2: ld returned 1 exit status

C:\projects\ecos_examples>
===============================================================================

As you can see, we are trying the gcc 4.1.0 compiler.

So far, all we have seen is that .got implies "position independent code" mode.
I didn't see an option to turn this mode off, we don't need or want it.

Thank you.

Scott Moore
Powerfile Inc.

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.762 / Virus Database: 510 - Release Date: 9/13/2004
 


--
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] Problem with obtaining sockaddr from recvfrom()
  2007-10-10 22:27       ` [ECOS] error: no memory region specified for loadable section `.got' Scott Moore
@ 2007-10-11 10:51         ` jerzy dyrda
  2007-10-11 11:23           ` Richard Pennington
  2007-10-11 13:10         ` [ECOS] error: no memory region specified for loadable section `.got' Chris Zimman
  1 sibling, 1 reply; 11+ messages in thread
From: jerzy dyrda @ 2007-10-11 10:51 UTC (permalink / raw)
  To: ecos-discuss

Hello all,

I have problem with obtaining sockaddr from recvfrom() - function doesn't 
return any socket address.

I do it in such way :

Socket is opened for UDP datagram :
 fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);

and bind to some port:

addr.sin_family = AF_INET;
addr.sin_addr.s_addr = htonl(INADDR_ANY);
addr.sin_port = htons(RMCP_UDP_PORT);
rc = bind (fd, (struct sockaddr *)&addr, sizeof(struct sockaddr_in));

and next I'm waiting for a packet:
ret = recvfrom(fd, &rmcp_packet_raw, IPMI_BUF_SIZE, 0,
					&remote_addr, &remote_addr_len);
Received packet is correct according to length and contents but as I mention 
in subject without a socket addres. It's confusing for me because the same 
code works as Linux application. 

I'm using FreeBsd stack from version 2_0 of eCos

Any suggestion is appreciated.

Best regards,
jerzy

-- 
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] Problem with obtaining sockaddr from recvfrom()
  2007-10-11 10:51         ` [ECOS] Problem with obtaining sockaddr from recvfrom() jerzy dyrda
@ 2007-10-11 11:23           ` Richard Pennington
  2007-10-11 11:36             ` Gary Thomas
  0 siblings, 1 reply; 11+ messages in thread
From: Richard Pennington @ 2007-10-11 11:23 UTC (permalink / raw)
  To: jerzy dyrda; +Cc: ecos-discuss

jerzy dyrda wrote:
> Hello all,
> 
> I have problem with obtaining sockaddr from recvfrom() - function doesn't 
> return any socket address.
> 
> I do it in such way :
> 
> Socket is opened for UDP datagram :
>  fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
> 
> and bind to some port:
> 
> addr.sin_family = AF_INET;
> addr.sin_addr.s_addr = htonl(INADDR_ANY);
> addr.sin_port = htons(RMCP_UDP_PORT);
> rc = bind (fd, (struct sockaddr *)&addr, sizeof(struct sockaddr_in));
> 
> and next I'm waiting for a packet:
> ret = recvfrom(fd, &rmcp_packet_raw, IPMI_BUF_SIZE, 0,
> 					&remote_addr, &remote_addr_len);
> Received packet is correct according to length and contents but as I mention 
> in subject without a socket addres. It's confusing for me because the same 
> code works as Linux application. 
> 
> I'm using FreeBsd stack from version 2_0 of eCos
> 
> Any suggestion is appreciated.
> 
> Best regards,
> jerzy
> 
Not sure if this is your problem, but I have
#if defined(__ECOS)
     addr.sin_len = sizeof(addr);
#endif

in code that I use.

-Rich

-- 
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] Problem with obtaining sockaddr from recvfrom()
  2007-10-11 11:23           ` Richard Pennington
@ 2007-10-11 11:36             ` Gary Thomas
  2007-10-11 12:26               ` jerzy dyrda
  0 siblings, 1 reply; 11+ messages in thread
From: Gary Thomas @ 2007-10-11 11:36 UTC (permalink / raw)
  To: jerzy dyrda; +Cc: ecos-discuss

Richard Pennington wrote:
> jerzy dyrda wrote:
>> Hello all,
>>
>> I have problem with obtaining sockaddr from recvfrom() - function
>> doesn't return any socket address.
>>
>> I do it in such way :
>>
>> Socket is opened for UDP datagram :
>>  fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
>>
>> and bind to some port:
>>
>> addr.sin_family = AF_INET;
>> addr.sin_addr.s_addr = htonl(INADDR_ANY);
>> addr.sin_port = htons(RMCP_UDP_PORT);
>> rc = bind (fd, (struct sockaddr *)&addr, sizeof(struct sockaddr_in));
>>
>> and next I'm waiting for a packet:
>> ret = recvfrom(fd, &rmcp_packet_raw, IPMI_BUF_SIZE, 0,
>>                     &remote_addr, &remote_addr_len);
>> Received packet is correct according to length and contents but as I
>> mention in subject without a socket addres. It's confusing for me
>> because the same code works as Linux application.
>> I'm using FreeBsd stack from version 2_0 of eCos
>>
>> Any suggestion is appreciated.
>>
>> Best regards,
>> jerzy
>>
> Not sure if this is your problem, but I have
> #if defined(__ECOS)
>     addr.sin_len = sizeof(addr);
> #endif
> 
> in code that I use.

This is quite possibly the source of the problem.

The standard test program:
  .../net/common/current/tests/udp_lo_test.c
does a recvfrom() and successfully prints the source address,
so we're pretty sure that the system [calls] work properly.

Try looking at the test/example programs.


-- 
------------------------------------------------------------
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

* Re: [ECOS] Problem with obtaining sockaddr from recvfrom()
  2007-10-11 11:36             ` Gary Thomas
@ 2007-10-11 12:26               ` jerzy dyrda
  0 siblings, 0 replies; 11+ messages in thread
From: jerzy dyrda @ 2007-10-11 12:26 UTC (permalink / raw)
  To: ecos-discuss; +Cc: Gary Thomas, Richard Pennington

Hello all,

> > Not sure if this is your problem, but I have
> > #if defined(__ECOS)
> >     addr.sin_len = sizeof(addr);
> > #endif
> >
> > in code that I use.
>
> This is quite possibly the source of the problem.
>
> The standard test program:
>   .../net/common/current/tests/udp_lo_test.c
> does a recvfrom() and successfully prints the source address,
> so we're pretty sure that the system [calls] work properly.
>
> Try looking at the test/example programs.
Thanks a lot for hints and suggestions.
The case was missing of initialization addr_len with length of structure  
before calling recvfrom() i.e.
/* remote_addr_len == 0 */
ret = recvfrom(fd, &rmcp_packet_raw, IPMI_BUF_SIZE, 0,
                                       &remote_addr, &remote_addr_len);
and as I suppose recvfrom() treat remote_addr as structure with zero length 
buffer :(
 
It's done in the standard test program udp_lo_test.c

    c_len = sizeof(c_addr);
   ^^^^^^^^^^^^^^
	
    if ((len = recvfrom(s_source, data_buf, sizeof(data_buf),0,
                        (struct sockaddr *)&c_addr,&c_len)) < 0  ) {
        CYG_TEST_FAIL_FINISH("I/O error");
    }


Best regards,
jerzy

-- 
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] error: no memory region specified for loadable section `.got'
  2007-10-10 22:27       ` [ECOS] error: no memory region specified for loadable section `.got' Scott Moore
  2007-10-11 10:51         ` [ECOS] Problem with obtaining sockaddr from recvfrom() jerzy dyrda
@ 2007-10-11 13:10         ` Chris Zimman
  1 sibling, 0 replies; 11+ messages in thread
From: Chris Zimman @ 2007-10-11 13:10 UTC (permalink / raw)
  To: Scott Moore, eCos Discussion; +Cc: Steve Gaskill

> we are trying to compile ecos with a later version than the default
> supplied arm toolset. Ecos compiles to a .a just fine, but then the
> final compile/link (in this case the example "hello.c") fails with
> the error:
> 
>
=============================================================================
==
> C:\projects\ecos_examples>arm-unknown-linux-gnu-gcc -nostartfiles
-Lc:/projects/
> ecos_test/install/lib -Ttarget.ld -static -mcpu=arm7tdmi -Wl,--gc-sections
-Wl,-
> static -g -nostdlib -o hello.elf hello.o
>
/home/samiam/opt/crosstool/gcc-4.1.0-glibc-2.3.2/arm-unknown-linux-gnu/lib/gc
c/a
> rm-unknown-linux-gnu/4.1.0/../../../../arm-unknown-linux-gnu/bin/ld: error:
no m
> emory region specified for loadable section `.got'
> collect2: ld returned 1 exit status
>
> C:\projects\ecos_examples>
>
=============================================================================
==
>
> As you can see, we are trying the gcc 4.1.0 compiler.
> 
> So far, all we have seen is that .got implies "position independent code"
mode.
> I didn't see an option to turn this mode off, we don't need or want it.

Hi Scott,

There are a couple of problems here as far as I can see.  First, you should
be using arm-elf-gcc, not arm-linux-gcc.  Second, I have had mixed experience
trying to use GCC 4.x with eCos.  We had problems with it -- basically code
would sometimes crash for no apparent reason that would work fine under
3.4.4.  I didn't have any particularly compelling reason to move to 4.x so
we've elected to stay with 3.4.4 for the time being.

--Chris

--
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:[~2007-10-11 13:10 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-10-09 17:13 [ECOS] Position Independent Code Slide
2007-10-09 17:28 ` Andrew Lunn
2007-10-09 18:25 ` Gary Thomas
     [not found]   ` <a623f7d10710091206l9b4f27ay5f6140b81a38f759@mail.gmail.com>
2007-10-09 19:12     ` Gary Thomas
2007-10-09 20:49       ` Slide
2007-10-10 22:27       ` [ECOS] error: no memory region specified for loadable section `.got' Scott Moore
2007-10-11 10:51         ` [ECOS] Problem with obtaining sockaddr from recvfrom() jerzy dyrda
2007-10-11 11:23           ` Richard Pennington
2007-10-11 11:36             ` Gary Thomas
2007-10-11 12:26               ` jerzy dyrda
2007-10-11 13:10         ` [ECOS] error: no memory region specified for loadable section `.got' Chris Zimman

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).