Mad River Posted May 11, 2017 Report Share Posted May 11, 2017 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 Link to comment Share on other sites More sharing options...
Joel Bodenmann Posted May 11, 2017 Report Share Posted May 11, 2017 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 More sharing options...
Mad River Posted May 11, 2017 Author Report Share Posted May 11, 2017 (edited) 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 May 11, 2017 by Joel Bodenmann Removing unnecessary complete quote of previous post Link to comment Share on other sites More sharing options...
Joel Bodenmann Posted May 11, 2017 Report Share Posted May 11, 2017 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 More sharing options...
Mad River Posted May 11, 2017 Author Report Share Posted May 11, 2017 (edited) I can use the makefile approach, I just don't know how. The instructions are not clear enough for me. Step-by-Step guide: Set the GFXLIB variable to the path pointing to the µGFX library root directory Include the main µGFX Makefile (/ugfx/gfx.mk) Add GFXSRC to the sources variable/list Add GFXINC to the include paths variable/list 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? Edited May 11, 2017 by Mad River Link to comment Share on other sites More sharing options...
Mad River Posted May 11, 2017 Author Report Share Posted May 11, 2017 Still can't compile it. If it can help, attached are some files generated by the compiler. makefile objects.mk sources.mk Link to comment Share on other sites More sharing options...
Joel Bodenmann Posted May 11, 2017 Report Share Posted May 11, 2017 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 More sharing options...
cpu20 Posted May 11, 2017 Report Share Posted May 11, 2017 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 More sharing options...
Joel Bodenmann Posted May 11, 2017 Report Share Posted May 11, 2017 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 More sharing options...
Mad River Posted May 11, 2017 Author Report Share Posted May 11, 2017 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 More sharing options...
Mad River Posted May 11, 2017 Author Report Share Posted May 11, 2017 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 More sharing options...
inmarket Posted May 12, 2017 Report Share Posted May 12, 2017 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 More sharing options...
Mad River Posted May 12, 2017 Author Report Share Posted May 12, 2017 (edited) 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 May 12, 2017 by Mad River Link to comment Share on other sites More sharing options...
Mad River Posted May 12, 2017 Author Report Share Posted May 12, 2017 (edited) 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). 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. Edited May 12, 2017 by Mad River Link to comment Share on other sites More sharing options...
cpu20 Posted May 12, 2017 Report Share Posted May 12, 2017 (edited) 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. 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 May 12, 2017 by cpu20 Link to comment Share on other sites More sharing options...
Mad River Posted May 12, 2017 Author Report Share Posted May 12, 2017 Hi @cpu20, Thank you for your reply. Quote 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. How should be the filter to exclude all files except the gfx_mk.c? Link to comment Share on other sites More sharing options...
cpu20 Posted May 12, 2017 Report Share Posted May 12, 2017 6 minutes ago, Mad River said: How should be the filter to exclude all files except the gfx_mk.c? Yes. Later on you can include the files from the drivers you want to use by editing the filter again. Link to comment Share on other sites More sharing options...
Mad River Posted May 12, 2017 Author Report Share Posted May 12, 2017 @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). Link to comment Share on other sites More sharing options...
cpu20 Posted May 12, 2017 Report Share Posted May 12, 2017 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++) 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: 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. 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 More sharing options...
Mad River Posted May 12, 2017 Author Report Share Posted May 12, 2017 (edited) @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: Edited May 12, 2017 by Mad River Link to comment Share on other sites More sharing options...
Mad River Posted May 12, 2017 Author Report Share Posted May 12, 2017 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 More sharing options...
cpu20 Posted May 12, 2017 Report Share Posted May 12, 2017 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 More sharing options...
Mad River Posted May 12, 2017 Author Report Share Posted May 12, 2017 @cpu20 @Joel Bodenmann It finally worked, even with the blink led project provided by Renesas. Thank you very much for your help and pacience. Now, probably I will need some help to port the low-level and MAYBE the RTOS (ThreadX), but I will open a new thread about it. Link to comment Share on other sites More sharing options...
Joel Bodenmann Posted May 13, 2017 Report Share Posted May 13, 2017 I'm very happy to hear that you managed to get everything working! A huge Thank-You! to @cpu20. Great work! Would you consider writing an official guide that we would put into the wiki? Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now