EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

Problem with Include Paths in CrossWorks

Started by aekalman November 21, 2006
Hi All.

I can't figure out what I'm doing wrong here ... I cannot get
CrossWorks to successfully include a header file that is nested more
than two levels deep.

e.g. level0.h: #include "level1/level1.h"
level1.h: "include "level2/level2.h"

where the directories are laid out:

level0 (project directory)
level1
level2

Fails because it can't include level2/level2.h.

Works in IAR, but not in CrossWorks. Any ideas?

Thanks,

--Andrew

Beginning Microcontrollers with the MSP430

I forgot to mention that I expect this to work without having to
specify explicit include paths (other than the level0 / project
directory).

I believe that not needing to specify e.g. level0/level1/level2 as an
explicit include path is the correct ANSI behavior, but I could be wrong.

When I explicitly specify the deep path, it build successfully, BTW.

--Andrew

--- In m..., "aekalman" wrote:
>
> Hi All.
>
> I can't figure out what I'm doing wrong here ... I cannot get
> CrossWorks to successfully include a header file that is nested more
> than two levels deep.
>
> e.g. level0.h: #include "level1/level1.h"
> level1.h: "include "level2/level2.h"
>
> where the directories are laid out:
>
> level0 (project directory)
> level1
> level2
>
> Fails because it can't include level2/level2.h.
>
> Works in IAR, but not in CrossWorks. Any ideas?
>
> Thanks,
>
> --Andrew
>
Hi Andrew,

Personally, I don't like paths in the include files themselves. (although, yes, you have them
project root-relative)
I tend to specify them in the "User Include Directories" under the common properties for the
Solution's specific project. Makes it much more portable.
(ie. when I ported uIP or lWIP into CrossWorks a few includes in the CW user include directories
were a LOT easier than modifying the stuntled includes in the source code IMO :-)
Stops a zillion errors with near null effort)

Nevertheless, I don't know either why it doesn't work... I've included header files 3 levels deep
before and never had that problem.

My closest guess is that you're not specifying the first subdir properly, but that's conjecture :
level1.h: "#include "/level2/level2.h"
I would also expect it to work properly the way you did it, the leading "/" should make it "not
found in your case..)
I presume also that the "include instead of #include within the quotes is a typo on the forum
here, not in your code ?

Best Regards,
Kris

-----Original Message-----
From: m... [mailto:m...] On Behalf Of aekalman
Sent: Tuesday, 21 November 2006 3:14 PM
To: m...
Subject: [msp430] Problem with Include Paths in CrossWorks

Hi All.

I can't figure out what I'm doing wrong here ... I cannot get
CrossWorks to successfully include a header file that is nested more
than two levels deep.

e.g. level0.h: #include "level1/level1.h"
level1.h: "include "level2/level2.h"

where the directories are laid out:

level0 (project directory)
level1
level2

Fails because it can't include level2/level2.h.

Works in IAR, but not in CrossWorks. Any ideas?

Thanks,

--Andrew

Yahoo! Groups Links
Oh, in hindsight, I think it might be that the preproc expects :
level1.h: #include "level1/level2/level2.h"
Again, whatever the problem is, I find it is much more efficient to put your paths in the user
include directories property under "common", so you can can use any build config you want.

HTH ?

Best Regards,
Kris

-----Original Message-----
From: Microbit [mailto:m...@optusnet.com.au]
Sent: Tuesday, 21 November 2006 3:50 PM
To: 'm...'
Subject: RE: [msp430] Problem with Include Paths in CrossWorks

Hi Andrew,

Personally, I don't like paths in the include files themselves. (although, yes, you have them
project root-relative) I tend to specify them in the "User Include Directories" under the common
properties for the Solution's specific project. Makes it much more portable.
(ie. when I ported uIP or lWIP into CrossWorks a few includes in the CW user include directories
were a LOT easier than modifying the stuntled includes in the source code IMO :-) Stops a zillion
errors with near null effort)

Nevertheless, I don't know either why it doesn't work... I've included header files 3 levels deep
before and never had that problem.

My closest guess is that you're not specifying the first subdir properly, but that's conjecture :
level1.h: "#include "/level2/level2.h"
I would also expect it to work properly the way you did it, the leading "/" should make it "not
found in your case..) I presume also that the "include instead of #include within the quotes is a
typo on the forum here, not in your code ?

Best Regards,
Kris

-----Original Message-----
From: m... [mailto:m...] On Behalf Of aekalman
Sent: Tuesday, 21 November 2006 3:14 PM
To: m...
Subject: [msp430] Problem with Include Paths in CrossWorks

Hi All.

I can't figure out what I'm doing wrong here ... I cannot get CrossWorks to successfully include a
header file that is nested more than two levels deep.

e.g. level0.h: #include "level1/level1.h"
level1.h: "include "level2/level2.h"

where the directories are laid out:

level0 (project directory)
level1
level2

Fails because it can't include level2/level2.h.

Works in IAR, but not in CrossWorks. Any ideas?

Thanks,

--Andrew
Hi Kris.

Thanks for your reply.

Yeah, that extra " is a typo in my posting.

I don't recall any include path issues when I ported uIP using CW430
... that's why this surprised me.

I'm working with other peoples' files here (like with uIP), so I can't
avoid their use of path names. O/wise yes, I prefer to specify paths
to route the preprocessor to the right places.

I sent an example project to Paul -- perhaps he can comment.

--Andrew

--- In m..., "Microbit" wrote:
>
> Oh, in hindsight, I think it might be that the preproc expects :
> level1.h: #include "level1/level2/level2.h"
> Again, whatever the problem is, I find it is much more efficient to
put your paths in the user
> include directories property under "common", so you can can use any
build config you want.
>
> HTH ?
>
> Best Regards,
> Kris
>
>
> -----Original Message-----
> From: Microbit [mailto:microbit@...]
> Sent: Tuesday, 21 November 2006 3:50 PM
> To: 'm...'
> Subject: RE: [msp430] Problem with Include Paths in CrossWorks
>
> Hi Andrew,
>
> Personally, I don't like paths in the include files themselves.
(although, yes, you have them
> project root-relative) I tend to specify them in the "User Include
Directories" under the common
> properties for the Solution's specific project. Makes it much more
portable.
> (ie. when I ported uIP or lWIP into CrossWorks a few includes in the
CW user include directories
> were a LOT easier than modifying the stuntled includes in the source
code IMO :-) Stops a zillion
> errors with near null effort)
>
> Nevertheless, I don't know either why it doesn't work... I've
included header files 3 levels deep
> before and never had that problem.
>
> My closest guess is that you're not specifying the first subdir
properly, but that's conjecture :
> level1.h: "#include "/level2/level2.h"
> I would also expect it to work properly the way you did it, the
leading "/" should make it "not
> found in your case..) I presume also that the "include instead of
#include within the quotes is a
> typo on the forum here, not in your code ?
>
> Best Regards,
> Kris
>
> -----Original Message-----
> From: m... [mailto:m...] On
Behalf Of aekalman
> Sent: Tuesday, 21 November 2006 3:14 PM
> To: m...
> Subject: [msp430] Problem with Include Paths in CrossWorks
>
> Hi All.
>
> I can't figure out what I'm doing wrong here ... I cannot get
CrossWorks to successfully include a
> header file that is nested more than two levels deep.
>
> e.g. level0.h: #include "level1/level1.h"
> level1.h: "include "level2/level2.h"
>
> where the directories are laid out:
>
> level0 (project directory)
> level1
> level2
>
> Fails because it can't include level2/level2.h.
>
> Works in IAR, but not in CrossWorks. Any ideas?
>
> Thanks,
>
> --Andrew
>
There are two kinds of #include lines:

#include
and
#include "xyz.h"

By convention, they have different rules for path searching.
I'm not sure what the C standard says on this or how Crossworks
handles it, but the way I recall the convention is:

The <> ones always use the system include paths, augmented
by any additional paths that have been added, for example using
a -I option.

The "" version always searches relative to the directory containing
the file in which the #include occurrs.

As a matter of policy, I always use <> and -I, as the "" version
seems to invite problems.

Clifford.
Hi Andrew,

> I don't recall any include path issues when I ported uIP using CW430
> ... that's why this surprised me.

It's a while ago now, but some of the include files had paths in 'em to subdirs in the wrong
dirs.. lwIP was even worse.
Eg.
root \ dira \ some_file.c
root \ dira \ diff_file.c

diff_file.c eg. would have an include to a file that's in the dira subdir, stuff like that.
I recently set up V1.0 of uIP under CW430 and that one's even weirder :-)
The first call for ARP is an empty macro, and that function is deleted with an #if 0 ... #endif
Dunno why. Works better the way it originally was.
I'm surprised your includes worked first time with CW430 without having to specify user includes,
or modding the source - you know something I don't :-)
Also, the local uip_conn "register struct *" needs to be volatile.
If I turn on optimisation with CWARM, uip is broken, doesn't work anymore :-)
(I'm using Bill Knight's (RO Software) AT91-SBC, and I have FAT12/16 on Compact Flash so uIP can
take HTML files direct from CF card instead of the scripted statemachine, lot of fun actually -
I'm about to add FAT32 for kicks.

Best Regards,
Kris

-----Original Message-----
From: m... [mailto:m...] On Behalf Of aekalman
Sent: Tuesday, 21 November 2006 4:26 PM
To: m...
Subject: [msp430] Re: Problem with Include Paths in CrossWorks

Hi Kris.

Thanks for your reply.

Yeah, that extra " is a typo in my posting.

I don't recall any include path issues when I ported uIP using CW430
... that's why this surprised me.

I'm working with other peoples' files here (like with uIP), so I can't
avoid their use of path names. O/wise yes, I prefer to specify paths
to route the preprocessor to the right places.

I sent an example project to Paul -- perhaps he can comment.

--Andrew

--- In m..., "Microbit" wrote:
>
> Oh, in hindsight, I think it might be that the preproc expects :
> level1.h: #include "level1/level2/level2.h"
> Again, whatever the problem is, I find it is much more efficient to
put your paths in the user
> include directories property under "common", so you can can use any
build config you want.
>
> HTH ?
>
> Best Regards,
> Kris
>
>
> -----Original Message-----
> From: Microbit [mailto:microbit@...]
> Sent: Tuesday, 21 November 2006 3:50 PM
> To: 'm...'
> Subject: RE: [msp430] Problem with Include Paths in CrossWorks
>
> Hi Andrew,
>
> Personally, I don't like paths in the include files themselves.
(although, yes, you have them
> project root-relative) I tend to specify them in the "User Include
Directories" under the common
> properties for the Solution's specific project. Makes it much more
portable.
> (ie. when I ported uIP or lWIP into CrossWorks a few includes in the
CW user include directories
> were a LOT easier than modifying the stuntled includes in the source
code IMO :-) Stops a zillion
> errors with near null effort)
>
> Nevertheless, I don't know either why it doesn't work... I've
included header files 3 levels deep
> before and never had that problem.
>
> My closest guess is that you're not specifying the first subdir
properly, but that's conjecture :
> level1.h: "#include "/level2/level2.h"
> I would also expect it to work properly the way you did it, the
leading "/" should make it "not
> found in your case..) I presume also that the "include instead of
#include within the quotes is a
> typo on the forum here, not in your code ?
>
> Best Regards,
> Kris
>
> -----Original Message-----
> From: m... [mailto:m...] On
Behalf Of aekalman
> Sent: Tuesday, 21 November 2006 3:14 PM
> To: m...
> Subject: [msp430] Problem with Include Paths in CrossWorks
>
> Hi All.
>
> I can't figure out what I'm doing wrong here ... I cannot get
CrossWorks to successfully include a
> header file that is nested more than two levels deep.
>
> e.g. level0.h: #include "level1/level1.h"
> level1.h: "include "level2/level2.h"
>
> where the directories are laid out:
>
> level0 (project directory)
> level1
> level2
>
> Fails because it can't include level2/level2.h.
>
> Works in IAR, but not in CrossWorks. Any ideas?
>
> Thanks,
>
> --Andrew
>

Yahoo! Groups Links
Hi Kris.

I haven't been brave enough to try uIP 1.0 -- I got 0.9 to work, and
left it at that :)

The code I'm porting is hcc-embedded's EFFS-THIN. It has forward and
backward path references in the include files. No problem in an IAR
project (I didn't have to do anything, and it did not explicitly
define any additional paths), but with CrossWorks I had to add all the
directories that were "home" for the various include files as user
include paths and now it works.

Next, I gotta build a library of this stuff.

This EFFS-THIN is pretty nice, btw.

--Andrew

--- In m..., "Microbit" wrote:
>
> Hi Andrew,
>
> > I don't recall any include path issues when I ported uIP using CW430
> > ... that's why this surprised me.
>
> It's a while ago now, but some of the include files had paths in 'em
to subdirs in the wrong
> dirs.. lwIP was even worse.
> Eg.
> root \ dira \ some_file.c
> root \ dira \ diff_file.c
>
> diff_file.c eg. would have an include to a file that's in the dira
subdir, stuff like that.
> I recently set up V1.0 of uIP under CW430 and that one's even
weirder :-)
> The first call for ARP is an empty macro, and that function is
deleted with an #if 0 ... #endif
> Dunno why. Works better the way it originally was.
> I'm surprised your includes worked first time with CW430 without
having to specify user includes,
> or modding the source - you know something I don't :-)
> Also, the local uip_conn "register struct *" needs to be volatile.
> If I turn on optimisation with CWARM, uip is broken, doesn't work
anymore :-)
> (I'm using Bill Knight's (RO Software) AT91-SBC, and I have FAT12/16
on Compact Flash so uIP can
> take HTML files direct from CF card instead of the scripted
statemachine, lot of fun actually -
> I'm about to add FAT32 for kicks.
>
> Best Regards,
> Kris
>
>
> -----Original Message-----
> From: m... [mailto:m...] On
Behalf Of aekalman
> Sent: Tuesday, 21 November 2006 4:26 PM
> To: m...
> Subject: [msp430] Re: Problem with Include Paths in CrossWorks
>
> Hi Kris.
>
> Thanks for your reply.
>
> Yeah, that extra " is a typo in my posting.
>
> I don't recall any include path issues when I ported uIP using CW430
> ... that's why this surprised me.
>
> I'm working with other peoples' files here (like with uIP), so I can't
> avoid their use of path names. O/wise yes, I prefer to specify paths
> to route the preprocessor to the right places.
>
> I sent an example project to Paul -- perhaps he can comment.
>
> --Andrew
>
> --- In m..., "Microbit" wrote:
> >
> > Oh, in hindsight, I think it might be that the preproc expects :
> > level1.h: #include "level1/level2/level2.h"
> > Again, whatever the problem is, I find it is much more efficient to
> put your paths in the user
> > include directories property under "common", so you can can use any
> build config you want.
> >
> > HTH ?
> >
> > Best Regards,
> > Kris
> >
> >
> > -----Original Message-----
> > From: Microbit [mailto:microbit@]
> > Sent: Tuesday, 21 November 2006 3:50 PM
> > To: 'm...'
> > Subject: RE: [msp430] Problem with Include Paths in CrossWorks
> >
> > Hi Andrew,
> >
> > Personally, I don't like paths in the include files themselves.
> (although, yes, you have them
> > project root-relative) I tend to specify them in the "User Include
> Directories" under the common
> > properties for the Solution's specific project. Makes it much more
> portable.
> > (ie. when I ported uIP or lWIP into CrossWorks a few includes in the
> CW user include directories
> > were a LOT easier than modifying the stuntled includes in the source
> code IMO :-) Stops a zillion
> > errors with near null effort)
> >
> > Nevertheless, I don't know either why it doesn't work... I've
> included header files 3 levels deep
> > before and never had that problem.
> >
> > My closest guess is that you're not specifying the first subdir
> properly, but that's conjecture :
> > level1.h: "#include "/level2/level2.h"
> > I would also expect it to work properly the way you did it, the
> leading "/" should make it "not
> > found in your case..) I presume also that the "include instead of
> #include within the quotes is a
> > typo on the forum here, not in your code ?
> >
> > Best Regards,
> > Kris
> >
> > -----Original Message-----
> > From: m... [mailto:m...] On
> Behalf Of aekalman
> > Sent: Tuesday, 21 November 2006 3:14 PM
> > To: m...
> > Subject: [msp430] Problem with Include Paths in CrossWorks
> >
> > Hi All.
> >
> > I can't figure out what I'm doing wrong here ... I cannot get
> CrossWorks to successfully include a
> > header file that is nested more than two levels deep.
> >
> > e.g. level0.h: #include "level1/level1.h"
> > level1.h: "include "level2/level2.h"
> >
> > where the directories are laid out:
> >
> > level0 (project directory)
> > level1
> > level2
> >
> > Fails because it can't include level2/level2.h.
> >
> > Works in IAR, but not in CrossWorks. Any ideas?
> >
> > Thanks,
> >
> > --Andrew
> >
> Yahoo! Groups Links
>
Hi Clifford.

Yeah, IAR seems to follow the "" rules to any depth, but CrossWorks
doesn't seem to.

I think I will be switching Salvo's includes (which are much flatter,
and aren't causing any such problems) over to <> for the next release.

Thanks,

--Andrew

--- In m..., "Clifford Heath" wrote:
>
> There are two kinds of #include lines:
>
> #include
> and
> #include "xyz.h"
>
> By convention, they have different rules for path searching.
> I'm not sure what the C standard says on this or how Crossworks
> handles it, but the way I recall the convention is:
>
> The <> ones always use the system include paths, augmented
> by any additional paths that have been added, for example using
> a -I option.
>
> The "" version always searches relative to the directory containing
> the file in which the #include occurrs.
>
> As a matter of policy, I always use <> and -I, as the "" version
> seems to invite problems.
>
> Clifford.
>
Hi Andrew,

I'll send you uIP V1.0 as a CW430 project one of these days, will make mental note.
It did introduce a few headaches I thought.
I don't have the DHCL client working 100% though. My router gives it RIP, GW, Lease
obtained/expiry etc. but after that the protothread in question "hangs", haven't looked at it
anymore (yet), hmm.

And my example of course meant to say \root\dira\ and \root\dirb (not dira)...

> The code I'm porting is hcc-embedded's EFFS-THIN

The next on my wishlist is to add a FFS layer to my FAT/file I/O code. I know HCC sell this, but
I'd like to crack that one fine day.. Banging my head how to avoid using extra flash (ie. just the
existing 512 bytes/sector) or EEPROM and yet have a complete dynamic binding between logical and
physical sectors. Hmm must have some Gandalf magic allright .. :-)
" I just need to know " - no commercial app. heh

Mind you, my FFS FAT12/16 + disk low level I/O R/W and complete file I/O takes ~ 5 K on Thumb
+ 34 bytes RAM + 512 byte window... (excl dynamic, 18 bytes / file)

73s & Best Regards,
Kris

-----Original Message-----
From: m... [mailto:m...] On Behalf Of aekalman
Sent: Tuesday, 21 November 2006 6:06 PM
To: m...
Subject: [msp430] Re: Problem with Include Paths in CrossWorks

Hi Kris.

I haven't been brave enough to try uIP 1.0 -- I got 0.9 to work, and
left it at that :)

The code I'm porting is hcc-embedded's EFFS-THIN. It has forward and
backward path references in the include files. No problem in an IAR
project (I didn't have to do anything, and it did not explicitly
define any additional paths), but with CrossWorks I had to add all the
directories that were "home" for the various include files as user
include paths and now it works.

Next, I gotta build a library of this stuff.

This EFFS-THIN is pretty nice, btw.

--Andrew

--- In m..., "Microbit" wrote:
>
> Hi Andrew,
>
> > I don't recall any include path issues when I ported uIP using CW430
> > ... that's why this surprised me.
>
> It's a while ago now, but some of the include files had paths in 'em
to subdirs in the wrong
> dirs.. lwIP was even worse.
> Eg.
> root \ dira \ some_file.c
> root \ dira \ diff_file.c
>
> diff_file.c eg. would have an include to a file that's in the dira
subdir, stuff like that.
> I recently set up V1.0 of uIP under CW430 and that one's even
weirder :-)
> The first call for ARP is an empty macro, and that function is
deleted with an #if 0 ... #endif
> Dunno why. Works better the way it originally was.
> I'm surprised your includes worked first time with CW430 without
having to specify user includes,
> or modding the source - you know something I don't :-)
> Also, the local uip_conn "register struct *" needs to be volatile.
> If I turn on optimisation with CWARM, uip is broken, doesn't work
anymore :-)
> (I'm using Bill Knight's (RO Software) AT91-SBC, and I have FAT12/16
on Compact Flash so uIP can
> take HTML files direct from CF card instead of the scripted
statemachine, lot of fun actually -
> I'm about to add FAT32 for kicks.
>
> Best Regards,
> Kris
>
>
> -----Original Message-----
> From: m... [mailto:m...] On
Behalf Of aekalman
> Sent: Tuesday, 21 November 2006 4:26 PM
> To: m...
> Subject: [msp430] Re: Problem with Include Paths in CrossWorks
>
> Hi Kris.
>
> Thanks for your reply.
>
> Yeah, that extra " is a typo in my posting.
>
> I don't recall any include path issues when I ported uIP using CW430
> ... that's why this surprised me.
>
> I'm working with other peoples' files here (like with uIP), so I can't
> avoid their use of path names. O/wise yes, I prefer to specify paths
> to route the preprocessor to the right places.
>
> I sent an example project to Paul -- perhaps he can comment.
>
> --Andrew
>
> --- In m..., "Microbit" wrote:
> >
> > Oh, in hindsight, I think it might be that the preproc expects :
> > level1.h: #include "level1/level2/level2.h"
> > Again, whatever the problem is, I find it is much more efficient to
> put your paths in the user
> > include directories property under "common", so you can can use any
> build config you want.
> >
> > HTH ?
> >
> > Best Regards,
> > Kris
> >
> >
> > -----Original Message-----
> > From: Microbit [mailto:microbit@]
> > Sent: Tuesday, 21 November 2006 3:50 PM
> > To: 'm...'
> > Subject: RE: [msp430] Problem with Include Paths in CrossWorks
> >
> > Hi Andrew,
> >
> > Personally, I don't like paths in the include files themselves.
> (although, yes, you have them
> > project root-relative) I tend to specify them in the "User Include
> Directories" under the common
> > properties for the Solution's specific project. Makes it much more
> portable.
> > (ie. when I ported uIP or lWIP into CrossWorks a few includes in the
> CW user include directories
> > were a LOT easier than modifying the stuntled includes in the source
> code IMO :-) Stops a zillion
> > errors with near null effort)
> >
> > Nevertheless, I don't know either why it doesn't work... I've
> included header files 3 levels deep
> > before and never had that problem.
> >
> > My closest guess is that you're not specifying the first subdir
> properly, but that's conjecture :
> > level1.h: "#include "/level2/level2.h"
> > I would also expect it to work properly the way you did it, the
> leading "/" should make it "not
> > found in your case..) I presume also that the "include instead of
> #include within the quotes is a
> > typo on the forum here, not in your code ?
> >
> > Best Regards,
> > Kris
> >
> > -----Original Message-----
> > From: m... [mailto:m...] On
> Behalf Of aekalman
> > Sent: Tuesday, 21 November 2006 3:14 PM
> > To: m...
> > Subject: [msp430] Problem with Include Paths in CrossWorks
> >
> > Hi All.
> >
> > I can't figure out what I'm doing wrong here ... I cannot get
> CrossWorks to successfully include a
> > header file that is nested more than two levels deep.
> >
> > e.g. level0.h: #include "level1/level1.h"
> > level1.h: "include "level2/level2.h"
> >
> > where the directories are laid out:
> >
> > level0 (project directory)
> > level1
> > level2
> >
> > Fails because it can't include level2/level2.h.
> >
> > Works in IAR, but not in CrossWorks. Any ideas?
> >
> > Thanks,
> >
> > --Andrew
> >
> Yahoo! Groups Links
>

Yahoo! Groups Links

The 2024 Embedded Online Conference