Jump to content
gbgb

Modbus Example Compilation Error

Recommended Posts

I downloaded the Modbus example project, extracted it to a directory and opened the Sourceboost project file - All files seem to be listed in the project with their proper relative directories.

Trying to compile - I get errors that the include files cannot be found.

Any ideas what else I should configure?

 

Edit - I assume that there should be somewhere to define search paths for the compiler but do not seem to find them

Edited by gbgb

Share this post


Link to post
Share on other sites

Hi

 

 

After a quick try.

The first thing that failed here were the paths.

The downloaded project is searching for "novo.h" in "...\Program Files\..." and in my PC it should be "...\Program(X86) Files\ .....".because I'm using a 64 bit version of Windows 10.

 

Also I noticed that the code was written in 2007, I guess that it was for BoostC 6.xx.

I would suggest that you recreate the workspace/project from scratch before atempting a build.

 

Even after that you might still find a details to fine tune before achieving a sucessfull build.

 

EDIT ADD:

I just recalled that the root folder for the toolchain is stored in the project file (__c).

You can open the "modbus.__c" file with Notepad++ or other text editor of your choice and adjust the needed paths there.

 

 

 

HIH

 

Best regards

Jorge

Edited by JorgeF

Share this post


Link to post
Share on other sites

I made a totally new project but still get errors.

example:

In the main file (demo.c) there is

#include "mb.h"

 

however, mb.h is not in the same directory as demo.c so during compilation it says that this file cannot be found.

 

Do I have to explicitly edit all files so that the included files are specified by their relative path to the calling file (or absolute path) or is there a way to define at the project level search paths for include files in the project even if they are scattered between various directories? Otherwise I guess my only option will be to move all files to the same directory.

Share this post


Link to post
Share on other sites

Hi

 

Is the "mb.h" file included in the project?

 

I never needed it, so I'm not sure about the Sourceboost IDE. In fact I use BoostC mostly with MPLAB.

But its common in this kind of tools to have a way to define project specific search paths. Those are appended to the global search paths of the installation.

 

If you are going to drop all the files in project folder, you might solve this specific issue and create others in the oposite direction.

I know its a bit fastidious, but I would try to solve this kind of errors one at a time.

You can either move the file or correct the include statement.

 

You can use the "find in files" edit tool to locate all references to "mb.h" before deciding the best way to correct the problem.

 

Best regrads

Jorge

Edited by JorgeF

Share this post


Link to post
Share on other sites

Hi

 

Found it.

While adjusting the paths in the downloaded project file (.__c) I noticed some extra options for the compiler.

The project has a command line option to had extra include paths.

It seems that the current version of the IDE (I'm using V7.30) doesn't recognize that in the original (old) project file, so you have to add it by hand.

 

Settings -> Options -> Extra Compiler Options "-I ..\..\modbus\rtu;..\..\modbus\include;port"

(adjust for your folders configuration)

 

Also add an extra linker option "-swcs" because of the NOVO RTOS.

 

Don't forget that this settings are separated for a debug or release build, so you have to set them for both modes.

You just have to do this once, the project file (.__c) will be recreated by the IDE version you are using.

 

 

This sorts out the compiling issues, but you still have one extra issue with the linker.

The project specific NOVO library "novolib_pic18t3e1ts2.lib" is also in an old format.

You have to rebuild it with your current version of BoostC.

 

In order to rebuild the novo library follow the steps in "Building Custom Novo Libraries" @ page 18 of the "Novo RTOS Reference Manual".

 

 

Best regards

Jorge

Edited by JorgeF

Share this post


Link to post
Share on other sites

Thanks, I will look into this.

Regarding NOVO I am not concerned because I am not so worried.

This project should work also without NOVO. There is one #define for this in the project so if I comment it all code related to NOVO will (hopefully) be ignored.

Share this post


Link to post
Share on other sites

Worked.

I must say I do not understand how I missed this command line parameter - I went through the documentation when i tried to solve this issue.

After providing the proper paths I only had to change one register name that did not match my PIC ("baudcon1" instead of "baudctl")

Share this post


Link to post
Share on other sites

Hi

 

 

Good to know.

 

The question with the extra include paths (-I ....) was not in correcting the paths in the project file (.__c).

Even after corrected they weren't read by the IDE.

When the project was opened the other parameters show up in the IDE but not the extra command line options.

I had to configure it with the IDE menu one first time and from then it is remembered.

 

I guess its some detail that changed in the layout of the project file.

 

 

Best regards

Jorge

Share this post


Link to post
Share on other sites

Your content will need to be approved by a moderator

Guest
You are commenting as a guest. If you have an account, please sign in.
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...

×