Jump to content

Problems to compile for the first time


Mad River

Recommended Posts

Hi,

I just downloaded the uGFX library and tried to add it to a "blink led" project.

But I am getting some compilation errors. (Print-screen attached).

Seems like the files are not "seeing" eachother correcly.

I have extracted the zip file to my project directory and added the following lines to the include list:

"${workspace_loc:/${ProjName}/src/ugfx_2.7}"

"${workspace_loc:/${ProjName}/src/ugfx_2.7/src}"

I am not sure what configs should I set in the config file. (gfxconfig.h attached).

 

Regarding the error, the MF_BWFONT_VERSION_4_SUPPORTED is defined in the mf_bwfont.h:

/* Versions of the BW font format that are supported. */
#define MF_BWFONT_VERSION_4_SUPPORTED 1

 

gfxconf.h

compile_error.JPG

Link to comment
Share on other sites

Hello @Mad River and welcome to the µGFX community!

As mentioned in the documentation, there are two proper ways of adding the µGFX library to an existing library: Using the makefiles or using the single-file-inclusion mechanism.
If the IDE for choice already supports Makefiles and if your project is already makefile based then that is the easiest solution. Otherwise, please use the single-file-inclusion mechanism. Both are explained in the documentation and for both there are step-by-step examples for specific IDEs (take the Keil µVision one as a guide for the single-file-inclusion and the ChibiStudio one for the Makefile).

There are plenty of demos available in the /demos directory where you can grab both the application code and the corresponding configuration file from.

Link to comment
Share on other sites

Hi @Joel Bodenmann!

I am trying to do the "single-file-inclusion".

As said in the documentation, I copied the gfx_mk.c to my project root directory.

I am using e²studio (Renesas), which is a Eclipse based IDE. Is there a tutorial on how to configure this IDE to compile uGFX?

Edited by Joel Bodenmann
Removing unnecessary complete quote of previous post
Link to comment
Share on other sites

Unfortunately, we don't have a dedicated guide for that IDE yet. If you'd like to write one once you're done, we'd highly appreciate that ;) 

If you're using the single file inclusion mechanism then the workflow with the Eclipse based IDE will be exactly the same as the one with the Keil µVision one, so you can have a look at this guide: https://wiki.ugfx.io/index.php/Using_Keil_µVision_5_MDK-ARM
It's just different dialogs to add the files and paths, but what you have to do is exactly the same.

If in doubt, don't hesitate to ask. We're happy to help wherever we can.

Link to comment
Share on other sites

I can use the makefile approach, I just don't know how.

The instructions are not clear enough for me.

Step-by-Step guide:

  1. Set the GFXLIB variable to the path pointing to the µGFX library root directory
  2. Include the main µGFX Makefile (/ugfx/gfx.mk)
  3. Add GFXSRC to the sources variable/list
  4. Add GFXINC to the include paths variable/list
  5. Include additional Makefiles of the µGFX library to include board files, drivers, ...

Please, see the attached image.

I think that is the right place to place the variables mentioned in the Step-by-Step guide.

I have created the GFXLIB and pointed to the extracted folder.

I am not sure what to do in steps 2, 3 and 4.

Can you help me?

path_variables.JPG

Edited by Mad River
Link to comment
Share on other sites

Hello @Mad River,

Thank you for your feedback - I put it on our ToDo list to improve the integration documentation. I'll work on that the next week.

First we have to clarify whether you're really having a project that uses an external Makefile. The keyword here is external. Some Eclipse environments are setup to generate a makefile for you, but in that case you want to use the single-file-inclusion instead of using the makefiles of uGFX. You still can use our makefiles with the generated Eclipse Makefile but I'd really not recommend you doing that unless you are very experienced with that and you know exactly what you're doing - it can and it will be very daunting.
So, first thing: Could you please tell us whether you're using an existing, external makefile? If not, please use the single-file-inclusion and let us know if you have any problems. As always, we'll try our best to help you as quickly as possible :) 


Edit: Just saw your second post. You're definitely using the automatically generated makefiles. Unless you find a proper 3rd party guide on how to add path variables to those I'd recommend you using the single file inclusion. Maybe @inmarket could help though.
Looking through your Makefile I see that it includes the sub-makefiles of the µGFX library but unfortunately it includes also all driver makefiles, that is wrong. And it appears to be misisng the path variables. To be honest I'm also not too experienced with the recent version of Eclipse. Please try the single-file-inclusion mechanism. It will be a lot easier. Follow the Keil µVision guide linked in a previous post.

Link to comment
Share on other sites

If the IDE is eclipse based you should be able to make a "makefile" project.
You just choose new -> C/C++ -> Makefile project with existing code.

Import your own code into the project and also a template makefile (or a filled in makefile if you already made one).
When building your project now it will use your own included makefile to build the project.

Link to comment
Share on other sites

8 minutes ago, cpu20 said:

Import your own code into the project and also a template makefile (or a filled in makefile if you already made one).
When building your project now it will use your own included makefile to build the project.

That would be the best case scenario, yes. If you can manage to do that, then you won't have any other problems. Once you have that setup you can simply add the µGFX makefile as per the documentation. Here's a very good example for that: https://wiki.ugfx.io/index.php/Using_ChibiOS/RT

Link to comment
Share on other sites

Hi @cpu20 and @Joel Bodenmann

Thank you both for your replies.

As it seems easy, I will stay with the single-file-include approach.

I did as the guide you mentioned, but it is still not compiling.

These are EXACTLY the steps I made:

1. Loaded a example application which blinks a LED.

2. Downloaded the uGFX lib and extracted it.

3. Renamed it from "ugfx_2.7" to "ugfx" and copy/paste it as it is (full folder content) to the src directory of my project.

The path is "ugfx_project\src\ugfx"

4. Created a gfxconfig.h inside "ugfx_project\src\ugfx".

5. Change "#define GFX_USE_OS_RAW32" from FALSE to TRUE.

6. Added "ugfx_project\src\ugfx" to the include path.

7. Tried to compile.

 

I got that error in the font files:

[file: DejaVuSans10.c]

 

#include "mf_bwfont.h"

#ifndef MF_BWFONT_VERSION_4_SUPPORTED
#error The font file is not compatible with this version of mcufont.
#endif

 

As I could see, MF_BWFONT_VERSION_4_SUPPORTED is really defined in the "mf_bwfont.h". That file is located at: "ugfx_project\src\ugfx".

 

The problem is that the "DejaVuSans10.c" is seeing another "mf_bwfont.h" which contain only this:

/* This is a stub file to prevent having to include the mcufont
 * directory in the include path for funny compilers such as arduino
 * which don't support a user specified include path.
 *
 * It is not needed anyway as the files are already included.
 *
 * New versions of the font generator do not generate these include lines.
 */

So, I assumes that the MF_BWFONT_VERSION_4_SUPPORTED is not defined and crashes.

 

What can I do to point to the correct "mf_bwfont.h" file?

Link to comment
Share on other sites

Hi @Joel Bodenmann

 

I managed to remove that error.

I had to explicit add the include path "/ugfx/src/gdisp/mcufont" before "ugfx_project\src\ugfx". Now it is finding the correct file first.

But I am getting a new error now:
fatal error: 'linux/input.h' file not found    gmouse_lld_linux_event.c    /ugfx_project/src/ugfx/drivers/ginput/touch/Linux-Event    line 10

 

I am not even using any drivers.

As I said, I have copied/pasted the full ugfx folder to my project.

I supposed that it should only try to compile the drivers selected in the gfxconfig.h. But it seems that it is trying to compile all files inside the folder.

 

I think I should copy/paste only the needed folders, but I can't tell which ones are essencial.

Can you help me with that?
 

Link to comment
Share on other sites

The problem is that because you have copied ugfx into your src folder, your IDE is trying to include every file in the ugfx tree into the project. This is exactly what we are trying to avoid.

Your project tree needs to look something like this...

/project/src - contains your project files and gfxconf.h

/project/ugfx - contains the unaltered uGFX code

Make sure your IDE is not trying to build files in the /projects/ugfx directory.

Add /projects/src (if it is not already there) and /projects/ugfx to the include file path. Note: this is NOT adding them to the project source - this is adding them to the compiler include file path.

Include the single file gfx_mk.c into your project to build. Don't move or copy the file, just include that single file in its existing location in /projects/ugfx into your project build.

You will also need to add the driver source files you want to use into your project in the same manner as you did for gfx_mk.c. Also add the driver directories to your compiler include file path as you did for /projects/ugfx.

That should solve the problem.  The moment you get errors associated with font headers you can be sure you are including the wrong stuff into your project.

Link to comment
Share on other sites

Quote

/project/src - contains your project files and gfxconf.h

/project/ugfx - contains the unaltered uGFX code

Make sure your IDE is not trying to build files in the /projects/ugfx directory.

Done. Project is compiling well (only the /project/src).

 

Quote

Add /projects/src (if it is not already there) and /projects/ugfx to the include file path. Note: this is NOT adding them to the project source - this is adding them to the compiler include file path.

Done. Project still compiling.

 

Quote

Include the single file gfx_mk.c into your project to build. Don't move or copy the file, just include that single file in its existing location in /projects/ugfx into your project build.

I could not find a way to include a single file to the build path. I only found a way to include a folder.

So, I moved the "gfx_mk.c" from "/project/ugfx/src" to "/project/src".

Is it a problem? The project is still compiling.

 

EDIT:

I am getting a error about the bool type, which I don't have in my project.
"'bool_t' could not be resolved    gfx.c    /ugfx_project/ugfx/src    line 18    Semantic Error"

That is the line:

static bool_t gfxInitDone = FALSE;

 

Thank you all for the help!

 

Edited by Mad River
Link to comment
Share on other sites

About the error related to the bool_t, seems like the TRUE in the config file is not working.

I am using "#define GFX_USE_OS_RAW32   TRUE" in the config file.

But in "gos.h" everything is grey. (Image attached).

I am also trying to create the tick functions in my own code and it is not getting the TRUE correctly. (Image attached).

 

image1.JPG

image2.JPG.56269975ecd1553a240ed0b76a3886d7.JPG

 

EDIT:

I attached a image that shows a compiler warning about the TRUE.

In the image that shows my own code, in "if GFX_USE_OS_RAW32" the value of GFX_USE_OS_RAW32 is '0'.
I think my compiler is not understanding the '-1' definition.

TRUE.jpg

Edited by Mad River
Link to comment
Share on other sites

To add source files/folders to your project, you first go to the properties of your project. Then go to C/C++ General -> Paths and Symbols -> Source location.

Screenshot_20170512_183826.png

Here you can add the ugfx folder and use a filter (Edit filter) to only include the gfx_mk.c to the sources of your project.

Edited by cpu20
Link to comment
Share on other sites

@cpu20

I excluded all files from the build, the only exception is the gfx_mk.c.

 

It compiled.

But the problem remains.

It still seems that the TRUE is used correctly.

Quote

About the error related to the bool_t, seems like the TRUE in the config file is not working.

I am using "#define GFX_USE_OS_RAW32   TRUE" in the config file.

But in "gos.h" everything is grey. (Image attached).

I am also trying to create the tick functions in my own code and it is not getting the TRUE correctly. (Image attached).

 

image1.JPG

image2.JPG.56269975ecd1553a240ed0b76a3886d7.JPG

 

Link to comment
Share on other sites

Alright so I started from scratch in Eclipse and just build a project with the single file inclusion system:

First go to the paths and symbols and add the root uGFX directory to the include paths in all the languages. (for me this was assembly, GNU, GNU C++)

2017-05-12-195000_1600x900_scrot.thumb.png.c1b32c5d1e786efbafa7dd5e98ef4087.png

Here you can also include the directory holding the driver files for your specific display. To this again for all languages.

Now you need to exclude all sources except the gfx_mk.c:

2017-05-12-193101_1600x900_scrot.thumb.png.1980b116e3087c58cab3116d94514c53.png

Do this by clicking on edit filter -> add multiple. Now select everything except the gfx_mk.c and do not select the src map!
To include your drivers later on you have to delete the "drivers" line out of the filter lines. Then add multiple again and select everything in the driver folder except for your driver file.

2017-05-12-195000_1600x900_scrot.thumb.png.bf77f7fb0a6c6b744f677cd6c71f6eaf.png

Copy a fresh gfxconf.h in your include directory and it should compile. At least it does for me.

Link to comment
Share on other sites

@cpu20

I am following your steps, from scratch.

Quote

Do this by clicking on edit filter -> add multiple. Now select everything except the gfx_mk.c and do not select the src map!

 I did not understand "do not select the src map!"

But, that is how it is now:

 

exclude.JPG

Edited by Mad River
Link to comment
Share on other sites

It worked now!

But, in addition for your steps, I need to remove "gfx.h" from the filter list. Is it ok?

 

Anyway, it worked for a clean GNU Hello World project.

I will try again to do the same steps to my board (Renesas Synergy S3) using provided blink led project.

Link to comment
Share on other sites

22 minutes ago, Mad River said:

 I did not understand "do not select the src map!"

Well if you accidentally select the "src" map when excluding files with the filter it could be that Eclipse excludes your "gfx_mk.c" file again. But looking at your included screenshot everything went well.

2 minutes ago, Mad River said:

But, in addition for your steps, I need to remove "gfx.h" from the filter list. Is it ok?

I can't explain why this would make any difference. Normally the "gfx.h" file is already included by including the uGFX folder in your include paths. You can keep it removed from the filter list as it should not be a problem.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...