DHCPC Compiling Issue

38 views
Skip to first unread message

Michael Malz

unread,
Apr 13, 2011, 9:10:22 PM4/13/11
to avr-uip
Hi Guys,
I am getting this compiler error.

dhcpc.c: In function 'dhcpc_init':
dhcpc.c:351: error: dereferencing pointer to incomplete type
make: *** [obj/dhcpc.o] Error 1

I have no clue where to begin on backtracking this.

Thanks
Mike

Quentin Arce

unread,
Apr 13, 2011, 9:40:24 PM4/13/11
to avr...@googlegroups.com

Which project are you building?

Can you post a diff or a tarball or zip file of your workspace  AFTER you perform a make clean.

Thank you.

I think your the second person to note this.  When we figure out your problem. I'll see about changing the headers to prevent this or tell the developer what to do.





--
You received this message because you are subscribed to the Google Groups "avr-uip" group.
To post to this group, send email to avr...@googlegroups.com.
To unsubscribe from this group, send email to avr-uip+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/avr-uip?hl=en.


Jonathan Granade

unread,
Apr 14, 2011, 10:25:17 AM4/14/11
to avr...@googlegroups.com
Mike,

Please also include information about your working environment, compiler and everything info you have.

Regards,

Jonathan

Michael Malz

unread,
Apr 14, 2011, 5:13:26 PM4/14/11
to avr-uip
I am using Winavr-20100110, avr-libc-1.7.0 on a winxp pro computer.
The embedded hardware is an atmega168 and enc28j60, ie tuxgraphics
board. All i did was go into the tux graphics folder under projects.

#1 add dhcpc to the APPS line of the makefile -> APPS = dhcpc simple-
httpd
#2 un-commented dhcpc.h in the apps-conf.h file.
#3 make clean
#4 make

That was all i did.

Mike

On Apr 14, 9:25 am, Jonathan Granade <jonathan.web...@gmail.com>
wrote:
> Mike,
>
> Please also include information about your working environment, compiler and
> everything info you have.
>
> Regards,
>
> Jonathan
>
> On Wed, Apr 13, 2011 at 10:40 PM, Quentin Arce <qarc...@gmail.com> wrote:
>
> > Which project are you building?
>
> > Can you post a diff or a tarball or zip file of your workspace  AFTER you
> > perform a make clean.
>
> > Thank you.
>
> > I think your the second person to note this.  When we figure out your
> > problem. I'll see about changing the headers to prevent this or tell the
> > developer what to do.
>

Quentin Arce

unread,
Apr 14, 2011, 5:26:25 PM4/14/11
to avr...@googlegroups.com
Ah, okay.

I'll make some changes in a few days so the developer knows what is missing.

For now, what you need to do is turn ON UDP in the uip config file.


 * UDP support on or off
#define UIP_CONF_UDP             1
 * UDP checksums on or off
#define UIP_CONF_UDP_CHECKSUMS   1
 * The maximum amount of concurrent UDP connections.
#define UIP_CONF_UDP_CONNS 1  << you may want more... 2 or 3

Also, I think you need broadcast for dhcp to work.
#define UIP_CONF_BROADCAST      1

Turn these on and it should compile and work.  I won't be doing much work on avr-uip for the next few days.  I'll add some code to check for the required options in the UDP based apps when I can.  I'll probably add it Tuesday night or so.

Quentin 

Michael Malz

unread,
Apr 15, 2011, 8:23:14 PM4/15/11
to avr-uip
Hello,
I was able to get the source to compile. I am unable to ping the
device or connect with a web browser. I saw the entry on my dhcp
server so i know the ip. When I do an arp, the ip shows up, but the
hardware address shows incomplete. I also removed the dhcpc stuff,
make clean, then make and the static ip i set is also unable to ping.
Arp show the static ip but hardware address is incompete. Not sure if
i am doing something wrong or not. I am running the avr at 8mhz,
maybe i need to change the timer interrupt??

Thanks
Mike

On Apr 14, 4:26 pm, Quentin Arce <qarc...@gmail.com> wrote:
> Ah, okay.
>
> I'll make some changes in a few days so the developer knows what is missing.
>
> For now, what you need to do is turn ON UDP in the uip config file.
>
>  * UDP support on or off
> #define UIP_CONF_UDP             1
>  * UDP checksums on or off
> #define UIP_CONF_UDP_CHECKSUMS   1
>  * The maximum amount of concurrent UDP connections.
> #define UIP_CONF_UDP_CONNS 1  << you may want more... 2 or 3
>
> Also, I think you need broadcast for dhcp to work.
> #define UIP_CONF_BROADCAST      1
>
> Turn these on and it should compile and work.  I won't be doing much work on
> avr-uip for the next few days.  I'll add some code to check for the required
> options in the UDP based apps when I can.  I'll probably add it Tuesday
> night or so.
>
> Quentin
>

Quentin Arce

unread,
Apr 15, 2011, 11:33:42 PM4/15/11
to avr...@googlegroups.com

One thing to check is which chip you are compiling for.   I think that project defaults to the 328.  I'm not sure this is and issue for you.

Michael Malz

unread,
Apr 16, 2011, 7:31:14 AM4/16/11
to avr-uip
I did miss changing the the makefile to the m168. I did a copy from
svn and never changed that. Without dhcpc compiled in, i can access
the webserver.
However, i am still unable to access after dhcpc is compiled in.

Thanks

On Apr 15, 10:33 pm, Quentin Arce <qarc...@gmail.com> wrote:
> One thing to check is which chip you are compiling for.   I think that
> project defaults to the 328.  I'm not sure this is and issue for you.

Michael Malz

unread,
Apr 16, 2011, 8:54:03 AM4/16/11
to avr-uip
I put my dhcp server into debug mode and following happened in a span
of 20 seconds.

DHCPDISCOVER from 00:bd:3b:33:05:71 via eth1
DHCPOFFER on 192.168.0.252 to 00:bd:3b:33:05:71 via eth1
DHCPDISCOVER from 00:bd:3b:33:05:71 via eth1
DHCPOFFER on 192.168.0.252 to 00:bd:3b:33:05:71 via eth1
DHCPDISCOVER from 00:bd:3b:33:05:71 via eth1
DHCPOFFER on 192.168.0.252 to 00:bd:3b:33:05:71 via eth1
DHCPDISCOVER from 00:bd:3b:33:05:71 via eth1
DHCPOFFER on 192.168.0.252 to 00:bd:3b:33:05:71 via eth1

Seems like the code is not handling the ip that is offered back.

Mike

Quentin Arce

unread,
Apr 16, 2011, 12:21:15 PM4/16/11
to avr...@googlegroups.com

I have seen this a few times.  I have not taken much time to fix it.  Mist of these went away with the last changes I made to the dhcp code.  Try turning off the power to you tux board for a few seconds then turn it back on.

I have also noticed if there are a lot of udp packets on the netwok upnp on my network the avr can miss the ip packet from the server

Michael Malz

unread,
Apr 16, 2011, 3:24:20 PM4/16/11
to avr-uip
I tried that and even tried increasing the UIP_CONF_UDP_CONNS to 6 and
nothing worked. I found some other code that was written for the
mega168 and enc28j60, and it compile fine and dhcp worked. So i know
from a server and hardware point everything is ok. I can switch to
the non uip code if I need to, but i really like how uip is set up.

Mike

On Apr 16, 11:21 am, Quentin Arce <qarc...@gmail.com> wrote:
> I have seen this a few times.  I have not taken much time to fix it.  Mist
> of these went away with the last changes I made to the dhcp code.  Try
> turning off the power to you tux board for a few seconds then turn it back
> on.
>
> I have also noticed if there are a lot of udp packets on the netwok upnp on
> my network the avr can miss the ip packet from the server

Quentin Arce

unread,
Apr 16, 2011, 3:26:11 PM4/16/11
to avr...@googlegroups.com

Can you post the code or link to it to compare

Michael Malz

unread,
Apr 16, 2011, 3:55:56 PM4/16/11
to avr-uip
http://www.halfmoontechnologies.com/~mmalz/TuxGraphics_m168_dhcpc.zip

Mike

On Apr 16, 2:26 pm, Quentin Arce <qarc...@gmail.com> wrote:
> Can you post the code or link to it to compare

Michael Malz

unread,
Apr 17, 2011, 12:38:45 PM4/17/11
to avr-uip
I added a little uart function to my code and made it display messages
at certian locations in code. My typical serial screen looks like:

Hope this helps.

Mike

Sent DHCPDISCOVER
Got Something
ip
Sent DHCPDISCOVER
Got Something
ip
Sent DHCPDISCOVER
Got Something
ip


uip_len = network_read();
if(uip_len > 0) {
sendString("Got Something\r\n");
if(BUF->type == htons(UIP_ETHTYPE_IP)){
sendString("ip\r\n");
uip_arp_ipin();
uip_input();
if(uip_len > 0) {
uip_arp_out();
network_send();
}
}else if(BUF->type == htons(UIP_ETHTYPE_ARP)){
sendString("arp\r\n");
uip_arp_arpin();
if(uip_len > 0){
network_send();
}
}
else{
sendString("na\r\n");

Quentin Arce

unread,
Apr 19, 2011, 1:13:40 AM4/19/11
to avr-uip

Michael,

I just downloaded the zip file you pointed to. This is your code from
avr-uip correct?
Can you post a link to the code that works for you? Or is this the
code that works?
As in DHCP works.

Thank you.
> ...
>
> read more »

Michael Malz

unread,
Apr 19, 2011, 7:14:56 AM4/19/11
to avr-uip
This link I posted is the avr-uip code that does not work in DHCP
mode.
I am posting a link to the non avr-uip code that does work for me.

http://www.halfmoontechnologies.com/~mmalz/firmware.zip

Mike
> ...
>
> read more »

Quentin Arce

unread,
Apr 19, 2011, 6:53:51 PM4/19/11
to avr...@googlegroups.com
THANK YOU Michael !!!

I had a quick look over the code.  Lots of good stuff in there.
The network stack is a bit different.  With that said I think I may be able to use some of the ideas to improve the dhcp client in the avr-uip stack.  I'll keep you posted.

Michael Malz

unread,
Apr 19, 2011, 6:56:59 PM4/19/11
to avr...@googlegroups.com

Good to hear.

Thanks

Michael Malz

unread,
Apr 19, 2011, 8:38:08 PM4/19/11
to avr-uip
here is one more error i am getting.

In file included from ./global-conf.h:47,
from ../..//drivers/enc28j60/enc28j60.c:20:
../..//uip/uip.h:1598: error: expected ')' before 'data'
make: *** [obj/enc28j60.o] Error 1

Mike

On Apr 19, 5:56 pm, Michael Malz <turbomustan...@gmail.com> wrote:
> Good to hear.
>
> Thanks
> On Apr 19, 2011 5:53 PM, "Quentin Arce" <qarc...@gmail.com> wrote:
>
> > THANK YOU Michael !!!
>
> > I had a quick look over the code. Lots of good stuff in there.
> > The network stack is a bit different. With that said I think I may be able
> > to use some of the ideas to improve the dhcp client in the avr-uip stack.
> > I'll keep you posted.
>
> > On Tue, Apr 19, 2011 at 4:14 AM, Michael Malz <turbomustan...@gmail.com
> ...
>
> read more »

Quentin Arce

unread,
Apr 19, 2011, 8:40:25 PM4/19/11
to avr...@googlegroups.com

Can you post a full log of your build.

Michael Malz

unread,
Apr 19, 2011, 9:24:03 PM4/19/11
to avr-uip
What do you mean by log?


On Apr 19, 7:40 pm, Quentin Arce <qarc...@gmail.com> wrote:
> Can you post a full log of your build.
> ...
>
> read more »

Quentin Arce

unread,
Apr 19, 2011, 9:28:39 PM4/19/11
to avr...@googlegroups.com
Sorry.

If your on Linux then... 

run.

cd PATH_TOP_AVR_UIP/projects/yourproject
script
make clean
make all
control^D
then post the typescript file.

I'm looking for the full output of your build to look for any other build issues.



> ...
>
> read more »

Quentin Arce

unread,
Apr 19, 2011, 9:32:53 PM4/19/11
to avr...@googlegroups.com
Here is the log of when I build your code.  I hope the format stays.. 

I don't see the dhcp error you noted.


qarce-dev@qarce-dev:~/avr-uip/projects/TuxGraphics-dhcp.m168$ make all
mkdir -p obj/enc28j60
avr-gcc -I. -Wall -mmcu=atmega168 -g -fpack-struct -Os -funsigned-char -funsigned-bitfields -mcall-prologues -Wstrict-prototypes -std=gnu99 -save-temps -I../..//apps/dhcpc -I../..//apps/simple-httpd -I../..//drivers/enc28j60 -I../..//libs/avrlib-avrlib-conf -I../..//drivers/interfaces -I../..//libs/interfaces -I../..//uip -c ../..//drivers/enc28j60/enc28j60.c -o obj/enc28j60.o
mkdir -p obj/network
avr-gcc -I. -Wall -mmcu=atmega168 -g -fpack-struct -Os -funsigned-char -funsigned-bitfields -mcall-prologues -Wstrict-prototypes -std=gnu99 -save-temps -I../..//apps/dhcpc -I../..//apps/simple-httpd -I../..//drivers/enc28j60 -I../..//libs/avrlib-avrlib-conf -I../..//drivers/interfaces -I../..//libs/interfaces -I../..//uip -c ../..//drivers/enc28j60/network.c -o obj/network.o
mkdir -p obj/dhcpc
avr-gcc -I. -Wall -mmcu=atmega168 -g -fpack-struct -Os -funsigned-char -funsigned-bitfields -mcall-prologues -Wstrict-prototypes -std=gnu99 -save-temps -I../..//apps/dhcpc -I../..//apps/simple-httpd -I../..//drivers/enc28j60 -I../..//libs/avrlib-avrlib-conf -I../..//drivers/interfaces -I../..//libs/interfaces -I../..//uip -c ../..//apps/dhcpc/dhcpc.c -o obj/dhcpc.o
mkdir -p obj/timer
avr-gcc -I. -Wall -mmcu=atmega168 -g -fpack-struct -Os -funsigned-char -funsigned-bitfields -mcall-prologues -Wstrict-prototypes -std=gnu99 -save-temps -I../..//apps/dhcpc -I../..//apps/simple-httpd -I../..//drivers/enc28j60 -I../..//libs/avrlib-avrlib-conf -I../..//drivers/interfaces -I../..//libs/interfaces -I../..//uip -c ../..//uip/timer.c -o obj/timer.o
mkdir -p obj/simple-httpd
avr-gcc -I. -Wall -mmcu=atmega168 -g -fpack-struct -Os -funsigned-char -funsigned-bitfields -mcall-prologues -Wstrict-prototypes -std=gnu99 -save-temps -I../..//apps/dhcpc -I../..//apps/simple-httpd -I../..//drivers/enc28j60 -I../..//libs/avrlib-avrlib-conf -I../..//drivers/interfaces -I../..//libs/interfaces -I../..//uip -c ../..//apps/simple-httpd/simple-httpd.c -o obj/simple-httpd.o
mkdir -p obj/main
avr-gcc -I. -Wall -mmcu=atmega168 -g -fpack-struct -Os -funsigned-char -funsigned-bitfields -mcall-prologues -Wstrict-prototypes -std=gnu99 -save-temps -I../..//apps/dhcpc -I../..//apps/simple-httpd -I../..//drivers/enc28j60 -I../..//libs/avrlib-avrlib-conf -I../..//drivers/interfaces -I../..//libs/interfaces -I../..//uip -c main.c -o obj/main.o
main.c: In function 'main':
main.c:53: warning: missing braces around initializer
main.c:53: warning: (near initialization for 'mac.addr')
main.c:43: warning: unused variable 'ipaddr'
mkdir -p obj/clock-arch
avr-gcc -I. -Wall -mmcu=atmega168 -g -fpack-struct -Os -funsigned-char -funsigned-bitfields -mcall-prologues -Wstrict-prototypes -std=gnu99 -save-temps -I../..//apps/dhcpc -I../..//apps/simple-httpd -I../..//drivers/enc28j60 -I../..//libs/avrlib-avrlib-conf -I../..//drivers/interfaces -I../..//libs/interfaces -I../..//uip -c clock-arch.c -o obj/clock-arch.o
mkdir -p obj/uip
avr-gcc -I. -Wall -mmcu=atmega168 -g -fpack-struct -Os -funsigned-char -funsigned-bitfields -mcall-prologues -Wstrict-prototypes -std=gnu99 -save-temps -I../..//apps/dhcpc -I../..//apps/simple-httpd -I../..//drivers/enc28j60 -I../..//libs/avrlib-avrlib-conf -I../..//drivers/interfaces -I../..//libs/interfaces -I../..//uip -c ../..//uip/uip.c -o obj/uip.o
mkdir -p obj/uip_arp
avr-gcc -I. -Wall -mmcu=atmega168 -g -fpack-struct -Os -funsigned-char -funsigned-bitfields -mcall-prologues -Wstrict-prototypes -std=gnu99 -save-temps -I../..//apps/dhcpc -I../..//apps/simple-httpd -I../..//drivers/enc28j60 -I../..//libs/avrlib-avrlib-conf -I../..//drivers/interfaces -I../..//libs/interfaces -I../..//uip -c ../..//uip/uip_arp.c -o obj/uip_arp.o
../..//uip/uip_arp.c: In function 'uip_arp_update':
../..//uip/uip_arp.c:160: warning: 'tabptr' may be used uninitialized in this function
../..//uip/uip_arp.c: In function 'uip_arp_out':
../..//uip/uip_arp.c:357: warning: 'tabptr' may be used uninitialized in this function
mkdir -p obj/psock
avr-gcc -I. -Wall -mmcu=atmega168 -g -fpack-struct -Os -funsigned-char -funsigned-bitfields -mcall-prologues -Wstrict-prototypes -std=gnu99 -save-temps -I../..//apps/dhcpc -I../..//apps/simple-httpd -I../..//drivers/enc28j60 -I../..//libs/avrlib-avrlib-conf -I../..//drivers/interfaces -I../..//libs/interfaces -I../..//uip -c ../..//uip/psock.c -o obj/psock.o
../..//uip/psock.c: In function 'psock_send_P':
../..//uip/psock.c:366: warning: pointer targets in assignment differ in signedness
avr-gcc -I. -Wall -mmcu=atmega168 -g -fpack-struct -Os -funsigned-char -funsigned-bitfields -mcall-prologues -Wstrict-prototypes -std=gnu99 -save-temps -I../..//apps/dhcpc -I../..//apps/simple-httpd -I../..//drivers/enc28j60 -I../..//libs/avrlib-avrlib-conf -I../..//drivers/interfaces -I../..//libs/interfaces -I../..//uip -o ./obj/test.out -Wl ./obj/clock-arch.o ./obj/dhcpc.o ./obj/enc28j60.o ./obj/main.o ./obj/network.o ./obj/psock.o ./obj/simple-httpd.o ./obj/timer.o ./obj/uip.o ./obj/uip_arp.o
avr-objcopy -R .eeprom -O ihex ./obj/test.out ./obj/test.hex
avr-size ./obj/test.out
   text   data    bss    dec    hex filename
  12088    134    838  13060   3304 ./obj/test.out
qarce-dev@qarce-dev:~/avr-uip/projects/TuxGraphics-dhcp.m168$ 

Quentin Arce

unread,
Apr 19, 2011, 9:35:44 PM4/19/11
to avr...@googlegroups.com
Oh, I'm on Ubuntu 9.4 32 bit and I built my cross tools using the TuxGraphics notes and I am using versions.

avr-libc-1.6.4
binutils-2.20.1
gcc-4.3.2

Michael Malz

unread,
Apr 19, 2011, 9:49:05 PM4/19/11
to avr-uip
I am using Winavr-20100110, avr-libc-1.7.0 on a winxp pro computer

Z:\AVR_Code\AVR-UIP\projects\TuxGraphics>make
mkdir -p obj/enc28j60
avr-gcc -I. -Wall -mmcu=atmega168 -g -fpack-struct -Os -funsigned-char
-funsigned-bitfields -mcall-prologues -Wstrict-pr
ototypes -std=gnu99 -I../..//apps/resolv -I../..//apps/webclient -
I../..//drivers/enc28j60 -I../..//libs/avrlib-avrlib-c
onf -I../..//drivers/interfaces -I../..//libs/interfaces -I../..//uip -
c ../..//drivers/enc28j60/enc28j60.c -o obj/enc28
j60.o
In file included from ./global-conf.h:47,
from ../..//drivers/enc28j60/enc28j60.c:20:
../..//uip/uip.h:1598: error: expected ')' before 'data'
make: *** [obj/enc28j60.o] Error 1


On Apr 19, 8:35 pm, Quentin Arce <qarc...@gmail.com> wrote:
> Oh, I'm on Ubuntu 9.4 32 bit and I built my cross tools using the
> TuxGraphics notes and I am using versions.
>
> avr-libc-1.6.4
> binutils-2.20.1
> gcc-4.3.2
>
> > On Tue, Apr 19, 2011 at 6:28 PM, Quentin Arce <qarc...@gmail.com> wrote:
>
> >> Sorry.
>
> >> If your on Linux then...
>
> >> run.
>
> >> cd PATH_TOP_AVR_UIP/projects/yourproject
> >> script
> >> make clean
> >> make all
> >> control^D
> >> then post the typescript file.
>
> >> I'm looking for the full output of your build to look for any other build
> >> issues.
>
> ...
>
> read more »

Quentin Arce

unread,
Apr 19, 2011, 10:06:30 PM4/19/11
to avr...@googlegroups.com

Okay, svn update and try now.




> ...
>
> read more »

Michael Malz

unread,
Apr 19, 2011, 11:08:02 PM4/19/11
to avr-uip
Did the svn update and got further, this is the current log
Z:\AVR_Code\AVR-UIP\projects\TuxGraphics.168>make
mkdir -p obj/enc28j60
avr-gcc -I. -Wall -mmcu=atmega168 -g -fpack-struct -Os -funsigned-char
-funsigne
d-bitfields -mcall-prologues -Wstrict-prototypes -std=gnu99 -I../..//
apps/resolv
-I../..//apps/webclient -I../..//drivers/enc28j60 -I../..//libs/
avrlib-avrlib-c
onf -I../..//drivers/interfaces -I../..//libs/interfaces -I../..//uip -
c ../..//
drivers/enc28j60/enc28j60.c -o obj/enc28j60.o
mkdir -p obj/network
avr-gcc -I. -Wall -mmcu=atmega168 -g -fpack-struct -Os -funsigned-char
-funsigne
d-bitfields -mcall-prologues -Wstrict-prototypes -std=gnu99 -I../..//
apps/resolv
-I../..//apps/webclient -I../..//drivers/enc28j60 -I../..//libs/
avrlib-avrlib-c
onf -I../..//drivers/interfaces -I../..//libs/interfaces -I../..//uip -
c ../..//
drivers/enc28j60/network.c -o obj/network.o
mkdir -p obj/resolv
avr-gcc -I. -Wall -mmcu=atmega168 -g -fpack-struct -Os -funsigned-char
-funsigne
d-bitfields -mcall-prologues -Wstrict-prototypes -std=gnu99 -I../..//
apps/resolv
-I../..//apps/webclient -I../..//drivers/enc28j60 -I../..//libs/
avrlib-avrlib-c
onf -I../..//drivers/interfaces -I../..//libs/interfaces -I../..//uip -
c ../..//
apps/resolv/resolv.c -o obj/resolv.o
../..//apps/resolv/resolv.c: In function 'resolv_appcall':
../..//apps/resolv/resolv.c:333: error: 'uip_udp_conn' undeclared
(first use in
this function)
../..//apps/resolv/resolv.c:333: error: (Each undeclared identifier is
reported
only once
../..//apps/resolv/resolv.c:333: error: for each function it appears
in.)
../..//apps/resolv/resolv.c: In function 'resolv_getserver':
../..//apps/resolv/resolv.c:427: error: dereferencing pointer to
incomplete type

../..//apps/resolv/resolv.c: In function 'resolv_conf':
../..//apps/resolv/resolv.c:441: error: dereferencing pointer to
incomplete type

make: *** [obj/resolv.o] Error 1

Z:\AVR_Code\AVR-UIP\projects\TuxGraphics.168>


On Apr 19, 9:06 pm, Quentin Arce <qarc...@gmail.com> wrote:
> Okay, svn update and try now.
>

Quentin Arce

unread,
Apr 19, 2011, 11:43:30 PM4/19/11
to avr...@googlegroups.com
Okay, I have not used the resolv app yet.

That will take a little extra work which I'm not planning on doing tonight.

You can have a look at the Stokerbot-NG code to see how it works.  I think it uses the resolv code.
Reply all
Reply to author
Forward
0 new messages