Jump to content
danmc77

Problem With Include File In Different Directory

Recommended Posts

Hi,

 

I have a project organized like this:

 

c:\project\cpu

cpu.c

cpu.h

 

c:\project\UI

ui.c

ui.h

 

c:\project\wireless

wireless.c

wireless.h

 

The CPU and UI are two separate projects that run on two separate PCBs, but they both share the same wireless circuitry, so they both need access to the wireless.c and wireless.h files.

 

The problem I'm having is that when I build the CPU or the UI, I can't get BoostC to open wireless.h. I'm building in MPLAB v8.46, and in the IDE I have the include search path set to point to the directory that contains wireless.h. I've tried specifying the explicit path to wireless.h in cpu.c, but that doesn't work either.

 

Any ideas?

 

Thanks!

Dan

Share this post


Link to post
Share on other sites

OK, I found that I can get to wireless.h if I add this command line option for the project: -I ..\wireless

 

But now it can't reach wireless.c, even if I add the same command line option for this file. Even though the MPLAB IDE project window shows wireless.c in the wireless directory, when BoostC tries to compile, it tries to grab it from the CPU directory.

Share this post


Link to post
Share on other sites

Pavel? Dave?

 

Can you comment on this? How do I get BoostC to handle source files that are in other directories than the project directory with MPLAB? :(

 

I understand that MPLAB is not your product, but given that the Sourceboost IDE can't work with the ICD port, I'm forced to use MPLAB. :blink:

 

Here's an example build: This time I reorganized the project as follows:

C:\Docs\Controller\Software\Project\CPU

C:\Docs\Controller\Software\Project\Wireless

 

"Project" is the project directory. Source files in MPLAB are set to:

CPU\CPU.c

Wireless\Wireless.c

I add -I Wireless to the command line for the project.

 

As seen below, when I build, BoostC is unable to recurse down into the CPU directory to find CPU.c. Or is it that MPLAB fails to pass the full path down? I've posted on the Microchip IDE forum and nobody there seems to have this issue.

 

----------------------------------------------------------------------------------------------------------

Clean: Deleting intermediary and output files.

Clean: Done.

__________MPLAB failing to send down the full path?

VVVV

Executing: "C:\Sourceboost\boostc_pic18.exe" CPU.c -O1 -W1 -t 18F4550 -I wireless

BoostC Optimizing C Compiler Version 6.96 (for PIC18 architecture)

http://www.sourceboost.com

Copyright© 2004-2009 Pavel Baranov

Copyright© 2004-2009 David Hobday

 

Licensed to Dan McFarland under Single user Full License for 2 node(s)

Limitations: PIC18 max code size:Unlimited, max RAM banks:Unlimited, Non commercial use only

 

 

CPU.c

FATAL: Unable to open input file: C:\Docs\Controller\Software\Project\CPU.c

Error: preprocessing error

 

failure

BUILD FAILED: Sat May 08 07:13:13 2010

 

 

Thanks!

Dan

Edited by danmc77

Share this post


Link to post
Share on other sites
????

 

For the command line like yours 'C:\Sourceboost\boostc_pic18.exe" CPU.c -O1 -W1 -t 18F4550 -I wireless' where input file is specified without path compiler will look for it in the current directory. Apparently MPLAB sets the current directory to C:\Docs\Controller\Software\Project. Not sure how to change this.

 

Regards,

Pavel

Share this post


Link to post
Share on other sites
????

 

For the command line like yours 'C:\Sourceboost\boostc_pic18.exe" CPU.c -O1 -W1 -t 18F4550 -I wireless' where input file is specified without path compiler will look for it in the current directory. Apparently MPLAB sets the current directory to C:\Docs\Controller\Software\Project. Not sure how to change this.

 

Regards,

Pavel

 

Then I am correct in saying that the issue is with MPLAB. So it seems that my only solution is to place all of my files in one project directory, which is how I've been working. It would just be a bit cleaner if things could be a little more organized.

 

I would like to be able to switch over to use the Sourceboost IDE, but then how do I program my devices with the ICSP port?

Share this post


Link to post
Share on other sites
Then I am correct in saying that the issue is with MPLAB. So it seems that my only solution is to place all of my files in one project directory, which is how I've been working. It would just be a bit cleaner if things could be a little more organized.

 

I would like to be able to switch over to use the Sourceboost IDE, but then how do I program my devices with the ICSP port?

 

Just load the .hex file in mplab (File | Import) and program it by choosing a programmer (eg PicKit2). Quick and harmless. Alternatively, you can use the pickit2 utility itself (if you have a pickit2), or for more fun and easier debugging, use a bootloader (there are stacks around).

 

cheers

Ian.

Share this post


Link to post
Share on other sites

If you have a PICKIT 2 or 3, download PK2CMD or PK3CMD from microchip and set up the Sourceboost IDE to invoke that as the programmer and you will have a 'seamless' development enviroment. Unfortunately in circuit debugging still requires MPLAB.

Share this post


Link to post
Share on other sites
If you have a PICKIT 2 or 3, download PK2CMD or PK3CMD from microchip and set up the Sourceboost IDE to invoke that as the programmer and you will have a 'seamless' development enviroment. Unfortunately in circuit debugging still requires MPLAB.

 

I was looking at this today, what is the command that you would use? I looked around on the web as well as in the documentation and tried several lines but did not get it to work right.

 

 

============================================

 

 

C:\>"C:\Program Files (x86)\Microchip\MPLAB IDE\Programmer Utilities\PICkit3\pk3

cmd" /?

Options Description

----------------------------------------------------------------------------

B Batch Mode Operation

C Blank Check Device

E Erase Flash Device

F<file> Hex File Selection

G<region><Type><path> Read functions

region:

E = EEPROM

I = ID memory

C = Configuration memory

B = Boot Flash Memory

If no region is entered, the entire

device will be read.

 

Type F: = read into hex file,

Path = full file path,

H Hold In Reset

L Release from Reset

I Use High Voltage MCLR

M<region> Program Device

region:

P = Program memory

E = EEPROM

I = ID memory

C = Configuration memory

B = Boot Flash Memory

If no region is entered, the entire

device will be programmed.

N####,#### Program Memory Range

#### is a hexidecimal number representing

Start and End Address in sequence

P<part> Part Selection. Example: 18F67J50

R<file> Reporgram

S<file> SQTP File Selection

U## Program calibration memory,where:

## is a hexidecimal number representing

the least significant byte of the

calibration value to be programmed

V<Voltage> Power Target from PICkit3

Y Verify Device

against selected HEX File

? Help Screen

?E Displays Exit Code

 

Example: PK3CMD /P18F67J50 /GFc:\HexCode.hex

or

Example: PK3CMD -P18F67J50 -GFc:\HexCode.hex

 

 

Version 01.00.09

 

Copyright © Microchip Technology Inc. 2009

 

============================================

Thanks in advance for any help ;)

Share this post


Link to post
Share on other sites

For a PICkit 2 I use:

C:\PROGRA~1\MICROC~1\PK2CMD\pk2cmd.exe /BC:\PROGRA~1\MICROC~1\PK2CMD\ /P%target% /R /T /M /F

See this old post for an explanation.

 

Try

"C:\Program Files (x86)\Microchip\MPLAB IDE\Programmer Utilities\PICkit3\pk3cmd" /P%target% /M /F

Share this post


Link to post
Share on other sites
For a PICkit 2 I use:
C:\PROGRA~1\MICROC~1\PK2CMD\pk2cmd.exe /BC:\PROGRA~1\MICROC~1\PK2CMD\ /P%target% /R /T /M /F

See this old post for an explanation.

 

Try

"C:\Program Files (x86)\Microchip\MPLAB IDE\Programmer Utilities\PICkit3\pk3cmd" /P%target% /M /F

 

 

ok this one actually worked

"C:\Program Files (x86)\Microchip\MPLAB IDE\Programmer Utilities\PICkit3\pk3cmd" /P%shorttarget% /V3.250 /M /F%name%.hex

 

it adds the name of the hex file again after the name, apparently you cannot have a space after the switches for it to work.

 

Programming...

"C:\Program Files (x86)\Microchip\MPLAB IDE\Programmer Utilities\PICkit3\pk3cmd" /P18F45K20 /V3.250 /M /Fblink_pic45k20.hex blink_pic45k20.hex


Connecting... 
PICkit 3 detected 
Connecting to PICkit 3... 
Firmware Suite Version...... 01.26.05 
Firmware type......................PIC18F 
PICkit 3 Connected. 
Device ID Revision = 00000011 

Programming Device ...
Programming/Verify complete 
Done

 

I tested the code, seems to work, I might recomend however that the automatic addition of the file name to the end of the command line be dropped as it can always be done with %name% instead. The space after /F causes it to exit with "no input file" errors.

 

Thanks again ;)

Edited by ThunderSqueak

Share this post


Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...