Page 1 of 1

Generated MPLAB projects don't properly include source files

Posted: Wed Mar 09, 2011 8:03 pm
by bmairs
In my Simulink projects I've used relative paths to include some source files for compilation, like "..\..\..\..\..\ecan\circBuffer.c". When the MPLAB project is generated it just tacks this relative path onto the absolute path of the current working directory so I have file descriptions that look like "E:\DOCUME~1\BRYANT~1\MYDOCU~1\projects\Autoboat\autoboat\Code\BASIC_~1\tests\..\..\..\..\..\ecan\circBuffer.c". MPLAB does not like paths that look like that and I get file not found errors if I try to open that project file within MPLAB. If I change that above source file to specify "E:\DOCUME~1\BRYANT~1\MYDOCU~1\projects\ecan\circBuffer.c" it naturally works just fine.

Is it possible to evaluate relative paths before specifying those files within the MPLAB project? Just doing that should fix all of these problems.

By the way, I really like this feature of generating MPLAB projects for the source. Makes debugging MUCH easier!

Re: Generated MPLAB projects don't properly include source f

Posted: Thu Mar 10, 2011 5:33 pm
by LubinKerhuel
bmairs wrote:Is it possible to evaluate relative paths before specifying those files within the MPLAB project? Just doing that should fix all of these problems.
That should be possible, thanks for your suggestion.

It may be even better to have a relative path for such file witin the MPLAB project.
Would MPLAB accept path like ".\..\..\..\..\..\ecan\circBuffer.c" ?
If so, I'll try to make the function smarter...

Lubin

Re: Generated MPLAB projects don't properly include source f

Posted: Sun Mar 27, 2011 10:34 pm
by bmairs
This still doesn't work right. Now it just doesn't include the filepath now. I've attached the project generated upon compilation.

I've also noticed that the dir_inc variable is defined incorrectly. Notice the start that is "code_gen_dspic\sourcescode_gen_dspic\sources;.;;" The include directories aren't been appended correctly, so I'm not sure if this actually mattered, but I did notice it.

The source files I'm including are:
../../../../ecan/circBuffer.c
../../../../ecan/ecanFunctions.c
clib/gps.c
clib/commProtocol.c
clib/uart2.c
clib/DEE.c
clib/DEES.s
clib/misc.c

Re: Generated MPLAB projects don't properly include source f

Posted: Mon Mar 28, 2011 7:49 am
by LubinKerhuel
Is this project published on git, like SLUG ? Where could I find a version that should compile ?
I would like to test on your project so as to find the problem that clearly appears here. (It worked on more simple example I tested so far, even with any change in the directory).
Lubin

Re: Generated MPLAB projects don't properly include source f

Posted: Wed Mar 30, 2011 8:25 pm
by bmairs
The code_gen.mdl file is in my Autoboat repo: https://github.com/Susurrus/Autoboat

It also relies on the ecan library here: https://github.com/Susurrus/ECAN_dspic

I have the projects laid out as follows:
/projects
/projects/Autoboat/AUTOBOAT_REPO
/projects/ECAN_REPO

So the autoboat repo is one level deeper than the ecan repository I have.

Re: Generated MPLAB projects don't properly include source f

Posted: Thu Apr 07, 2011 7:47 pm
by bmairs
The MPLAB projects generated upon compilation now properly includes all of my source files and builds a debuggable build without configuring any other options. Pretty awesome!

I see the following warning at the end about a tcpip file not being found. It isn't part of any sources I included in the project. Do you know what's causing this?
"*** MPLAB: file -> import, choose code_gen.hex. Configure -> Configuration Bits : Verify ! Download into the chip and run."
"*** Alternatively, (re-)compile the MPLAB project : Within Matlab, right-click code_gen.mcp -> open outside Matlab will open the MPLAB project. Compile, modify..."
### Successful completion of Real-Time Workshop build procedure for model: code_gen
--dir C:\PROGRA~1\MATLAB\R2010a/rtw/c/src/ext_mode/tcpip not found. It is not added to MPLAB project.

Re: Generated MPLAB projects don't properly include source f

Posted: Thu Apr 07, 2011 10:17 pm
by LubinKerhuel
Thanks for testing the early blockset version I sent and for the feedback.
I will try to published thie version soon to succeed to the v3.4c.
bmairs wrote:--dir C:\PROGRA~1\MATLAB\R2010a/rtw/c/src/ext_mode/tcpip not found. It is not added to MPLAB project.
This indicates that matlab included the directory "C:\PROGRA~1\MATLAB\R2010a/rtw/c/src/ext_mode/tcpip" to the search path of the compiler.

This directory contains files to support the so called "external mode" which allows changing tunable variables from the PC while the model is running. This mode is not implemented in the current version of the blockset thus the directory containing theses file is not necessary theses files are not required.

I think that maltab include all directory containing potential useful functions (each blockset directory function...).
The matlab internal directory structure has change a little bit with newer matlab version. Thus, the directory not found might have been added by an older matlab version to the project, and the newer matlab version did not corrected the include path.

So, just do not pay attention.
If you wish to remove the message, I would propose to create a new simulink model and copy-past all your model and model parameters.

You might also check that you did not activate the "external mode" in the simulink configuration panel. This mode is useless for the dsPIC blockset as not implemented (yet).

Lubin