Author Topic: Create and compile Contiki project  (Read 32781 times)

Offline Pavel_47

  • Multiple posting newcomer
  • *
  • Posts: 66
Re: Create and compile Contiki project
« Reply #15 on: August 19, 2014, 01:46:27 pm »
At the bottom of Makefile there is a line:

CONTIKI = ../..
include $(CONTIKI)/Makefile.include

Here I didn't properly understand what "../.." means - current folder (the folder where is project file) ?
In this case how include $(CONTIKI)/Makefile.include does work - file Makefile.include is situated at the top of Contiki package ?
Nevertheless I'm sure that it does work, so probably "../.." points to the top of Contiki package (that in reality is: C:\Users\Pavel\Documents\Proj_EPFL\contiki-2.7\).
Strange ... it seems that placeholder "../" in windows points to the root directory, i.e. C:, isn't it ?

Anyway here is extract from Makefile.include:

include $(CONTIKI)/core/net/Makefile.uip

And here is contens of C:/Users/Pavel/Documents/Proj_EPFL/contiki-2.7/core/net/Makefile.uip:

Code
NET =						\
dhcpc.c \
hc.c \
nbr-table.c \
netstack.c \
packetbuf.c \
packetqueue.c \
psock.c \
queuebuf.c \
resolv.c \
sicslowpan.c \
simple-udp.c \
tcpdump.c \
tcpip.c \
uaodv-rt.c \
uaodv.c \
uip-debug.c \
uip-ds6-route.c \
uip-ds6-nbr.c \
uip-ds6.c \
uip-fw-drv.c \
uip-fw.c \
uip-icmp6.c \
uip-nd6.c \
uip-neighbor.c \
uip-over-mesh.c \
uip-packetqueue.c \
uip-split.c \
uip-udp-packet.c \
uip.c \
uip6.c \
uip_arp.c \
uiplib.c

As you can state inside of this list there is file "uip-ds6.c", that contains source code of functions
uip_ds6_set_addr_iid
uip_ds6_addr_add

Call of these functions (in the project source file) result "undefined reference" errors.

Next, I open uip-ds6.c in Code::Blocks and see that all the code is "pale", what probably means that code is ignored by due to #if statement (Am I correct ?).
The most external #if statement is:
#if UIP_CONF_IPV6

Then I go to my source and add the following line (in bold):
#include "contiki.h"
#include "lib/random.h"
#include "sys/ctimer.h"
#include "net/uip.h"
#define UIP_CONF_IPV6
#include "net/uip-ds6.h"
#include "net/uip-udp-packet.h"
#ifdef WITH_COMPOWER

As you can state it's included before #include "net/uip-ds6.h", so "define" should be accepted inside of uip-ds6.c.

But NOT !!!
After compiling there are still the same errors, also the code inside of uip-ds6.c is "pale".

I become crazy with all this staff ...






Offline Pavel_47

  • Multiple posting newcomer
  • *
  • Posts: 66
Re: Create and compile Contiki project
« Reply #16 on: August 19, 2014, 02:10:11 pm »
Yesss !!!
Works !

Here is workflow on problem resolution:

At the top of Makefile there is line:
DEFINES+=PROJECT_CONF_H=\"project-conf.h\"

I opened project-conf.h ... and indeed have found UIP_CONF_IPV6 definition:
/* Don't let contiki-default-conf.h decide if we are an IPv6 build */
#ifndef UIP_CONF_IPV6
#define UIP_CONF_IPV6                        0
#endif

I've replaced '0' by '1' and rebuilt project.
No errors !!!
But curiously the code inside of uip-ds6.c remains "pale". Why ?

Also, can somebody clarify the issue with "../.." ?

Thanks

Pavel

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
Re: Create and compile Contiki project
« Reply #17 on: August 19, 2014, 02:21:41 pm »
'../..' means 2 folders up in the path starting from the current folder.

Offline Pavel_47

  • Multiple posting newcomer
  • *
  • Posts: 66
Re: Create and compile Contiki project
« Reply #18 on: August 19, 2014, 02:33:06 pm »
Thanks Scarphin

For 3 levels up: ".../..." and for 4 levels up "..../...." ?

Also, can you explain the issue with "pale" code (although not so critical ... just to clarify the properties of Code::Blocks interface).

Cordially

Pavel

P.S. Here is pale look of source

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
Re: Create and compile Contiki project
« Reply #19 on: August 19, 2014, 10:28:55 pm »
3 levels: '../../..'
4 levels: '../../../..'
Unfortunately these kinds of questions are not related to CB and not allowed in the forum, please do your own research if you think your question is not related to CB. I have no idea about the grey code, might be some misconfiguration.

Offline Pavel_47

  • Multiple posting newcomer
  • *
  • Posts: 66
Re: Create and compile Contiki project
« Reply #20 on: August 19, 2014, 11:19:35 pm »
Ok, thanks Scarphin.