public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* RE: [ECOS]  Sending Raw Ethernet packets (ether_output, ether_output_frame, __enet_send ?)
@ 2003-11-20 17:52 kevin_lemay
  2003-11-20 18:44 ` Andrew Lunn
  0 siblings, 1 reply; 8+ messages in thread
From: kevin_lemay @ 2003-11-20 17:52 UTC (permalink / raw)
  To: sebastien.couret; +Cc: ecos-discuss

Oops,

You Said SERVER. I quick check of the DHCP request services from my linux box shows that it uses standard UDP using the assigned IP address for the destination.

It would appear that you could use the standard UDP socket routines if you could manually add the entry into the routing table. This would be easier to do that using a non-standard ethernet interface. Usually stacks have routines to add routes. 

Kevin 

-----Original Message-----
From: ecos-discuss-owner@sources.redhat.com
[mailto:ecos-discuss-owner@sources.redhat.com]On Behalf Of LEMAY,KEVIN
(A-Roseville,ex1)
Sent: Thursday, November 20, 2003 9:44 AM
To: sebastien.couret@elios-informatique.fr
Cc: ecos-discuss@sources.redhat.com
Subject: RE: [ECOS] Sending Raw Ethernet packets (ether_output,
ether_output_frame, __enet_send ?)


Why not use the current DHCP implementation that is available via anonymous CVS?

It appears to be using the standard socket calls.

Kevin

-----Original Message-----
From: ecos-discuss-owner@sources.redhat.com
[mailto:ecos-discuss-owner@sources.redhat.com]On Behalf Of Sebastien
Couret
Sent: Wednesday, November 19, 2003 12:14 PM
To: ecos-discuss@sources.redhat.com
Subject: [ECOS] Sending Raw Ethernet packets (ether_output,
ether_output_frame, __enet_send ?)


Hello,

I.m on my way to write a DHCP server for eCOS, but right now i.m stuck while trying to send an ethernet packet directly to an host (my DHCP client) which has, at first, only ethernet connectivity and is only reachable through network  via its MAC address(Let.s call it 0xde:0xad:0x00:0xbe:0xef:0x00) because IP adressing is not set.



I have choosed to use the FreeBSD TCP/IP stack port for eCOS.



And when trying to send such a packet with socket API and parameters PF_INET,SOCK_RAW, i.m not able to act on the ethernet header so , I cannot make ethernet destination adress point to 0xde:0xad:0x00:0xbe:0xef:0x00 and sendto() seems to only accept sockaddr_in targets.



So i have seek a another raw API to write ethernet packets directly . (Of course this API should be generic and not driver dependent )

I have found ether_output, ether_output_frame, __enet_send  but I cannot use them from my application because they are not compiled into the eCOS library , I have generated, and the linkage fails ...



May be , I don.t take the right approach... It should be simple ...



So to resume, my question is :

Could someone tell me how (a code example would be perfect !) , I could act , from my eCOS application , onto the ethernet header of a packet I.m going to send ? (In my case, I just which to change the destination MAC address)



Thanks a lot for your help.

Have a nice day.

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


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


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

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

* Re: [ECOS]  Sending Raw Ethernet packets (ether_output, ether_output_frame, __enet_send ?)
  2003-11-20 17:52 [ECOS] Sending Raw Ethernet packets (ether_output, ether_output_frame, __enet_send ?) kevin_lemay
@ 2003-11-20 18:44 ` Andrew Lunn
  2003-11-20 21:47   ` [ECOS] how to link "gettimeofday" with arm-elf-gcc? Yusuke MATSUOKA
  0 siblings, 1 reply; 8+ messages in thread
From: Andrew Lunn @ 2003-11-20 18:44 UTC (permalink / raw)
  To: kevin_lemay; +Cc: sebastien.couret, ecos-discuss

On Thu, Nov 20, 2003 at 10:52:46AM -0700, kevin_lemay@agilent.com wrote:
> Oops,
> 

> You Said SERVER. I quick check of the DHCP request services from my
> linux box shows that it uses standard UDP using the assigned IP
> address for the destination.

> It would appear that you could use the standard UDP socket routines
> if you could manually add the entry into the routing table. This
> would be easier to do that using a non-standard ethernet
> interface. Usually stacks have routines to add routes.

I don't see why you need to add a route entry? You are probably
assigning addresses for the subnet the server is already on. If not,
the default route will probably do the job of getting the reply to the
DHCP proxy.

The problem is with the arp entry. Since the device requesting the
address does not have an IP address, it obviously cannot have an arp
entry. Hence you cannot send a packet to it. It will also not respond
to arp requests. 

What you may be able to do is add a static arp entry, send the packet,
and then remove the static arp entry. 

    Andrew

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

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

* [ECOS] how to link "gettimeofday" with arm-elf-gcc?
  2003-11-20 18:44 ` Andrew Lunn
@ 2003-11-20 21:47   ` Yusuke MATSUOKA
  2003-11-20 22:06     ` Andrew Lunn
  2003-11-20 22:09     ` Gary Thomas
  0 siblings, 2 replies; 8+ messages in thread
From: Yusuke MATSUOKA @ 2003-11-20 21:47 UTC (permalink / raw)
  To: ecos-discuss

Hi all,
I just wanna know how to link gettimeofday with arm-elf-gcc.

I'm trying to compile a simple program on Cygwin,
with arm-elf-gcc which is downloaded and installed via ecos-install.tcl
provided at ecos site.

I think I have built libraries for SA1110 successfuly, such as:
bash-2.05b$ pwd  
/home/yusuke/SA1110_new/sa1110_install/lib
bash-2.05b$ ll
total 8974
drwxrwxrwx+   2 yusuke   None            0 Nov 19 15:17 ./
drwxrwxrwx+   5 yusuke   None            0 Oct 23 15:43 ../
-rw-rw-rw-    1 yusuke   None       390748 Oct 23 15:32 extras.o
-rw-rw-rw-    1 yusuke   None       402954 Oct 23 15:32 libextras.a
-rw-rw-rw-    1 yusuke   None      8381312 Oct 23 15:32 libtarget.a
-rw-rw-rw-    1 yusuke   None         2156 Oct 23 15:32 target.ld
-rw-rw-rw-    1 yusuke   None         9236 Oct 23 15:32 vectors.o

However, when I compile as follows,
arm-elf-gcc.exe  -g -I/home/yusuke/SA1110_new/sa1110_install/include \
-L/opt/ecos/gnutools/arm-elf/lib/gcc-lib/arm-elf/3.2.1 \
-L/home/yusuke/SA1110_new/sa1110_install/lib -Ttarget.ld \
-nostdlib hello.c


I got an error that linker cannot find "gettimeofday" as follows:
bash-2.05b$ make.csh
/ecos-c/DOCUME~1/yusuke/LOCALS~1/Temp/ccgyG7X0.o: In function `main':
/home/yusuke/SA1110_new/Hello/hello.c:12: undefined reference to
`gettimeofday'
collect2: ld returned 1 exit status


My code is quite simple:
#include<stdio.h>
#include <sys/time.h>

int main() 
{
  printf ("\n");
  printf (" Hello World !!\n");
  printf (" You are running this on the SA-1110\n");
  printf ("\n");

  struct timeval tv;
  gettimeofday(&tv, NULL) ;
  printf("%ld %ld\n", tv.tv_sec, tv.tv_usec);

  return (0);
}


Can anybody help me, please?

Thanks,
Yusuke


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

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

* Re: [ECOS] how to link "gettimeofday" with arm-elf-gcc?
  2003-11-20 21:47   ` [ECOS] how to link "gettimeofday" with arm-elf-gcc? Yusuke MATSUOKA
@ 2003-11-20 22:06     ` Andrew Lunn
  2003-11-20 22:34       ` Yusuke Matsuoka
  2003-11-20 22:09     ` Gary Thomas
  1 sibling, 1 reply; 8+ messages in thread
From: Andrew Lunn @ 2003-11-20 22:06 UTC (permalink / raw)
  To: Yusuke MATSUOKA; +Cc: ecos-discuss

> I got an error that linker cannot find "gettimeofday" as follows:

gettimeofday was added the posix only recently, so eCos does not yet
implement it as part of libc. 

Either use ctime(time()) or include the snmp stack which does have
gettimeofday().

        Andrew

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

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

* Re: [ECOS] how to link "gettimeofday" with arm-elf-gcc?
  2003-11-20 21:47   ` [ECOS] how to link "gettimeofday" with arm-elf-gcc? Yusuke MATSUOKA
  2003-11-20 22:06     ` Andrew Lunn
@ 2003-11-20 22:09     ` Gary Thomas
  1 sibling, 0 replies; 8+ messages in thread
From: Gary Thomas @ 2003-11-20 22:09 UTC (permalink / raw)
  To: Yusuke MATSUOKA; +Cc: ecos-discuss

On Thu, 2003-11-20 at 14:47, Yusuke MATSUOKA wrote:
> Hi all,
> I just wanna know how to link gettimeofday with arm-elf-gcc.
> 
> I'm trying to compile a simple program on Cygwin,
> with arm-elf-gcc which is downloaded and installed via ecos-install.tcl
> provided at ecos site.
> 
> I think I have built libraries for SA1110 successfuly, such as:
> bash-2.05b$ pwd  
> /home/yusuke/SA1110_new/sa1110_install/lib
> bash-2.05b$ ll
> total 8974
> drwxrwxrwx+   2 yusuke   None            0 Nov 19 15:17 ./
> drwxrwxrwx+   5 yusuke   None            0 Oct 23 15:43 ../
> -rw-rw-rw-    1 yusuke   None       390748 Oct 23 15:32 extras.o
> -rw-rw-rw-    1 yusuke   None       402954 Oct 23 15:32 libextras.a
> -rw-rw-rw-    1 yusuke   None      8381312 Oct 23 15:32 libtarget.a
> -rw-rw-rw-    1 yusuke   None         2156 Oct 23 15:32 target.ld
> -rw-rw-rw-    1 yusuke   None         9236 Oct 23 15:32 vectors.o
> 
> However, when I compile as follows,
> arm-elf-gcc.exe  -g -I/home/yusuke/SA1110_new/sa1110_install/include \
> -L/opt/ecos/gnutools/arm-elf/lib/gcc-lib/arm-elf/3.2.1 \
> -L/home/yusuke/SA1110_new/sa1110_install/lib -Ttarget.ld \
> -nostdlib hello.c
> 
> 
> I got an error that linker cannot find "gettimeofday" as follows:
> bash-2.05b$ make.csh
> /ecos-c/DOCUME~1/yusuke/LOCALS~1/Temp/ccgyG7X0.o: In function `main':
> /home/yusuke/SA1110_new/Hello/hello.c:12: undefined reference to
> `gettimeofday'
> collect2: ld returned 1 exit status
> 
> 
> My code is quite simple:
> #include<stdio.h>
> #include <sys/time.h>
> 
> int main() 
> {
>   printf ("\n");
>   printf (" Hello World !!\n");
>   printf (" You are running this on the SA-1110\n");
>   printf ("\n");
> 
>   struct timeval tv;
>   gettimeofday(&tv, NULL) ;
>   printf("%ld %ld\n", tv.tv_sec, tv.tv_usec);
> 
>   return (0);
> }
> 
> 
> Can anybody help me, please?
> 

The 'gettimeofday()' function is not normally available in eCos,
because few platforms which run eCos have any notion of absolute time.

Besides the obvious (printing a time/date in your example), why
do you need it?  

-- 
Gary Thomas <gary@mlbassoc.com>
MLB Associates


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

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

* RE: [ECOS] how to link "gettimeofday" with arm-elf-gcc?
  2003-11-20 22:06     ` Andrew Lunn
@ 2003-11-20 22:34       ` Yusuke Matsuoka
  2003-11-20 22:38         ` Gary Thomas
  2003-11-20 22:40         ` Andrew Lunn
  0 siblings, 2 replies; 8+ messages in thread
From: Yusuke Matsuoka @ 2003-11-20 22:34 UTC (permalink / raw)
  To: 'Andrew Lunn', 'Gary Thomas'; +Cc: ecos-discuss

Hi Andrew and Gary,

Thanks for the reply.

I want to run the KVM(K virtual machine for Java) on eCos and
want to measure the exec time of my Java application on the board.
The original KVM implementation uses "gettimeofday", and I got
the linker error.

Since I need a *millisecond* resolution, is there a better way 
rather than including snmp?
I want to keep the footprint small.
(ctime(time()) is a *second* resolution, right?)

Thanks,
Yusuke

> -----Original Message-----
> From: ecos-discuss-owner@sources.redhat.com 
> [mailto:ecos-discuss-owner@sources.redhat.com] On Behalf Of 
> Andrew Lunn
> Sent: Thursday, November 20, 2003 2:06 PM
> To: Yusuke MATSUOKA
> Cc: ecos-discuss@sources.redhat.com
> Subject: Re: [ECOS] how to link "gettimeofday" with arm-elf-gcc?
> 
> 
> > I got an error that linker cannot find "gettimeofday" as follows:
> 
> gettimeofday was added the posix only recently, so eCos does not yet
> implement it as part of libc. 
> 
> Either use ctime(time()) or include the snmp stack which does have
> gettimeofday().
> 
>         Andrew
> 
> -- 
> Before posting, please read the FAQ: 
> http://sources.redhat.com/fom/ecos
> and search the list 
> archive: http://sources.redhat.com/ml/ecos-discuss
> 


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

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

* RE: [ECOS] how to link "gettimeofday" with arm-elf-gcc?
  2003-11-20 22:34       ` Yusuke Matsuoka
@ 2003-11-20 22:38         ` Gary Thomas
  2003-11-20 22:40         ` Andrew Lunn
  1 sibling, 0 replies; 8+ messages in thread
From: Gary Thomas @ 2003-11-20 22:38 UTC (permalink / raw)
  To: Yusuke Matsuoka; +Cc: 'Andrew Lunn', ecos-discuss

On Thu, 2003-11-20 at 15:34, Yusuke Matsuoka wrote:
> Hi Andrew and Gary,
> 
> Thanks for the reply.
> 
> I want to run the KVM(K virtual machine for Java) on eCos and
> want to measure the exec time of my Java application on the board.
> The original KVM implementation uses "gettimeofday", and I got
> the linker error.
> 
> Since I need a *millisecond* resolution, is there a better way 
> rather than including snmp?
> I want to keep the footprint small.
> (ctime(time()) is a *second* resolution, right?)
> 

The eCos system clock will normally run at 10ms resolution.  If you
need something better than that, you could either run the system clock
faster (not recommended), or there are HAL functions which will let
you calculate finer grain times.

Look at ${ECOS_REPOSITORY}/kernel/current/tests/tm_basic.cxx for
an example of how to measure time down to micro-seconds (without any
changes to eCos or even the standard configuration).

> Thanks,
> Yusuke
> 
> > -----Original Message-----
> > From: ecos-discuss-owner@sources.redhat.com 
> > [mailto:ecos-discuss-owner@sources.redhat.com] On Behalf Of 
> > Andrew Lunn
> > Sent: Thursday, November 20, 2003 2:06 PM
> > To: Yusuke MATSUOKA
> > Cc: ecos-discuss@sources.redhat.com
> > Subject: Re: [ECOS] how to link "gettimeofday" with arm-elf-gcc?
> > 
> > 
> > > I got an error that linker cannot find "gettimeofday" as follows:
> > 
> > gettimeofday was added the posix only recently, so eCos does not yet
> > implement it as part of libc. 
> > 
> > Either use ctime(time()) or include the snmp stack which does have
> > gettimeofday().
> > 
> >         Andrew
> > 
> > -- 
> > Before posting, please read the FAQ: 
> > http://sources.redhat.com/fom/ecos
> > and search the list 
> > archive: http://sources.redhat.com/ml/ecos-discuss
> > 
-- 
Gary Thomas <gary@mlbassoc.com>
MLB Associates


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

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

* Re: [ECOS] how to link "gettimeofday" with arm-elf-gcc?
  2003-11-20 22:34       ` Yusuke Matsuoka
  2003-11-20 22:38         ` Gary Thomas
@ 2003-11-20 22:40         ` Andrew Lunn
  1 sibling, 0 replies; 8+ messages in thread
From: Andrew Lunn @ 2003-11-20 22:40 UTC (permalink / raw)
  To: Yusuke Matsuoka
  Cc: 'Andrew Lunn', 'Gary Thomas', ecos-discuss

On Thu, Nov 20, 2003 at 02:34:43PM -0800, Yusuke Matsuoka wrote:
> Hi Andrew and Gary,
> 
> Thanks for the reply.
> 
> I want to run the KVM(K virtual machine for Java) on eCos and
> want to measure the exec time of my Java application on the board.
> The original KVM implementation uses "gettimeofday", and I got
> the linker error.
> 
> Since I need a *millisecond* resolution, is there a better way 
> rather than including snmp?

cyg_current_time() will return the number of 10ms ticks since the
scheduler was started. 

Or you could run the test program 1,000,000 times and use a wallclock!

          Andrew

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

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

end of thread, other threads:[~2003-11-20 22:40 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-11-20 17:52 [ECOS] Sending Raw Ethernet packets (ether_output, ether_output_frame, __enet_send ?) kevin_lemay
2003-11-20 18:44 ` Andrew Lunn
2003-11-20 21:47   ` [ECOS] how to link "gettimeofday" with arm-elf-gcc? Yusuke MATSUOKA
2003-11-20 22:06     ` Andrew Lunn
2003-11-20 22:34       ` Yusuke Matsuoka
2003-11-20 22:38         ` Gary Thomas
2003-11-20 22:40         ` Andrew Lunn
2003-11-20 22:09     ` 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).