Question on source directories includes

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Question on source directories includes

Jump to solution
1,643 Views
StephaneRey
Contributor I

Hello there,

I'm familiar with Codewarrior 6.3 and I'm starting with CW10.2

I want to organize my sources files in subdirectories. Here is a simplified example

 

source\

main.c

init.c

init.h

tdef.h

\HAL\

\ICS\

ics.c

ics.h

\ADC\

adc.c

adc.h

...

\HIL\

...

\service\

...

\Application

...


I need that any file can include any include file from any subdirectory

Example :init.c includes ics.h, adc.h, and so on as well as ics.c includes tdef.h

 

If I do nothing, includes files are not seen from an other directory

If I add for each directory its workspace location in Properties\HCS08 Compiler\input, then it sounds better but still have errors....

 

My very simple example project is attached

 

Any help appreciated to understand how these subdirectory organization may work !

 

Regards

Stephane

Original Attachment has been moved to: UniPLL_RREX_CW10_v100.zip

Labels (1)
0 Kudos
1 Solution
1,127 Views
CrasyCat
Specialist III

Hello

Around the linking issue you are seeing, the function is named ICS_Configure in ICS.c and in ics.h and init.c you are using ICS_Configuration.

This is the reason you are getting the link error.

Regarding the include paths to specify in the HCS08 Compiler\input page, you need to add each path to the Include File Path edit box. There is no way to specify recursive include paths for HCS08 projects.

The good news is that (at least with v10.3) you can select a set of paths in the Compiler\input page, copy it to the clipboard (using CTRL + C) and then paste them in the  Compiler\input page from another project (using CTRL + V).

To select a set of paths just use the standard Windows way of doing it. Click on the first path, press SHIFT + click on the last path to select a  list of consecutive paths. Use CTRL + click to select individual paths,

I know this copy/paste feature has been added recently. Not sure if this is already available in V10.2.

CrasyCat

View solution in original post

0 Kudos
6 Replies
1,127 Views
CrasyCat
Specialist III

Hello

I did give a quick look at your project.

For some reason there were specific options associated with folder Sources, HAL and HIL.

So the paths you have added to the projects Properties\HCS08 Compiler\input were not taken into account for the single source files.

This is indicated with a blue marker on top of the folder icon as in the image below:

2908_2908.png

In order to get rid of these folder specific settings:

  • Click right on the folder name and select Properties
  • In the Properties dialog, click on Restore Defaults

This should be repeated for each folder of file name where you see the blue marker on top of the file or folder icon.

Then make sure to add the path to each single folder, where you have include files HAL, HAL/ICS, HA:/ADC, HIL, .....

I have adjusted the project you send over and I attached it to this post. I did use relative paths instead of absolute paths to specify the include paths.

Note that I am using CodeWarrior for MCU V10.3. So I am not sure this project can be imported in V10.2....

CrasyCat

1,127 Views
StephaneRey
Contributor I

Dear CrasyCat,

Thanks for your answer. This brings valuable information.

However I've still a problem and one concern.

I've created a new project in order to have a good starting point. I've added the path as you mentionned on each directory. This bring a blue Key icon on the directory name but not the <> symbol you were showing (10.3 related ?)

Apparently there is still a problem when you compile. The function ICS_Configuration function (located in ICS.c) is not seen in init.c whereas apparently now the include works. This may be a C related issue but I was used to do like that on CW6.3

I've declared the function as extern in ics.h and then made the include of ics.h in init.c

Something wrong with that ?

But my concern is :

Assuming I've 20 directories/subdirectories which will be likely the case.

Shall I add manually for each directory the ProjPath of each directory ??????

This makes 20 x 20 = 400 directories to add manually, and this for each project... This sounds completely crazy for me !!!!   :smileyshocked:

Attached is my new project with the compilation error

0 Kudos
1,128 Views
CrasyCat
Specialist III

Hello

Around the linking issue you are seeing, the function is named ICS_Configure in ICS.c and in ics.h and init.c you are using ICS_Configuration.

This is the reason you are getting the link error.

Regarding the include paths to specify in the HCS08 Compiler\input page, you need to add each path to the Include File Path edit box. There is no way to specify recursive include paths for HCS08 projects.

The good news is that (at least with v10.3) you can select a set of paths in the Compiler\input page, copy it to the clipboard (using CTRL + C) and then paste them in the  Compiler\input page from another project (using CTRL + V).

To select a set of paths just use the standard Windows way of doing it. Click on the first path, press SHIFT + click on the last path to select a  list of consecutive paths. Use CTRL + click to select individual paths,

I know this copy/paste feature has been added recently. Not sure if this is already available in V10.2.

CrasyCat

0 Kudos
1,127 Views
StephaneRey
Contributor I

Pfffff.... stupid french guy I am ! Sorry for wasting your time on that stupid mistake.

Regarding the path includes, yes, adding multiple directories in same time works fine.

This is anyway a bit dangerous as each time one add a directory, all the directories path must be modified....

Strange feature which makes things quite complex and weird... no ?

0 Kudos
1,127 Views
CrasyCat
Specialist III

Hello

No problem.

These are the issues that are caught quickly from outside (by someone not directly involved in the application development itself).

Regarding the paths include, you are right. This is complex and weird. I just wanted to let you know how you can manage that today with the existing software.

You can submit a feature request service request in our on-line support web site to ask that we support recursive include paths for HCS08 as well. I know we support it for other architectures already.

Click here to submit a service request.

CrasyCat

1,127 Views
StephaneRey
Contributor I

thanks CrasyCat,

I've made the feature request.

At least I can start and I'm no longer stopped in my designs.

I haven't figured out that this issue was compiler dependant and that it may be different on some other plateforms. Again this is not very elegant. I will test it soon on Coldfire V1 and Kinetis....

Thanks again, I can jumpt into my code now....

Regards

Stephane

0 Kudos