Jump to content

Importing uGFX in AtmelStudio 7 (and raw OS)


thexeno

Recommended Posts

Hi,

I am trying to use the uGFX library in AS7, with the GDISP module for a OLED display, the SSD1306, but I am struggling in the right importing procedure. I have the goal to setup just something which build, it does not matter if the HAL and various modules are not setup properly.
I tried to follow the procedure without the makefile, since I would need to modify the Windows environment and I would like not to do this on every machine in which I could work on this project. So I tried the inclusion file approach.

I've imported the gfx folder in the root of my project, and added all of its content. Then, in the compiler directories, I have added:
C:\Users\[...]\Atmel\ugfx_disp\ugfx_disp\ugfx\src
C:\Users\[...]\Atmel\ugfx_disp\ugfx_disp\ugfx\

while in the gdisp.h, for the inclusion of the right lld config, I modified the include in:
    #include "../ugfx/drivers/gdisp/SSD1306/gdisp_lld_config.h"

and of course I have activated the various modules, in my case just the RAW_OS32 and the GDISP and the heap size. But still, I get a lot un undefined stuff which is for sure related to something very naive, but which still keep me blocked. The errors are all related to app1.c or app2.c which are not existing. I am not a deep pro of Atmel Studio, but I have used it a lot for C and C++ stuff, and converting from one to another. But I am not sure what is going on now. I also not completed the lld files, but what I see is not related to this. But anything incomplete shall not give an error, if I have understood how is written the code.

I can attach the project file, which I think is better that posting some code lines here and there. Of course, the Atmel project file is related to my own PC path, so I will include only the sources with their hierarchical structure.

Thanks to anyone.

project_root.zip

Edited by thexeno
Link to comment
Share on other sites

Hello @thexeno and welcome to the µGFX community

I'd recommend you to have a look at our step-by-step guide for the Keil µVision IDE. It shows you exactly what you need to add. Of course, the dialogs are different but at the end of the day it's the same: You have lists of source files and inclusion paths. You can have a look at the guide here: https://wiki.ugfx.io/index.php/Using_Keil_µVision_5_MDK-ARM

First of all, I'd recommend you not to enable GDISP until you are able to build your project. Try to take your working AtmelStudio project and just add µGFX as per the guide but do not enable GDISP. You are able to make sure that everything works anyway because the GOS module is always enabled. Therefore, you can build a fully working µGFX application without using the GDISP module.

 

12 hours ago, thexeno said:

I've imported the gfx folder in the root of my project, and added all of its content. Then, in the compiler directories, I have added:
C:\Users\[...]\Atmel\ugfx_disp\ugfx_disp\ugfx\src
C:\Users\[...]\Atmel\ugfx_disp\ugfx_disp\ugfx\

Adding the /src directory is not necessary. All files are being included automatically once you included gfx_mk.c and the path to the top-level directory.

 

12 hours ago, thexeno said:

while in the gdisp.h, for the inclusion of the right lld config, I modified the include in:
    #include "../ugfx/drivers/gdisp/SSD1306/gdisp_lld_config.h"

Don't do that. The LLD config file is being included by the driver itself automatically. Have a look at the Keil guide I linked above. You only need to add the path of the driver directory to the include path and then add the driver source file to your list of source files. No need to include or modify anything else. But again: Try without the GDISP module first. That will save you a lot of hassle. Enable GDISP once your project builds fine just with GOS.
As a general rule: Once you need to modify µGFX library sources you're doing something wrong.

 

If you'd like to write a guide for the Atmel Studio that we can put on the wiki that would be much appreciated.

Link to comment
Share on other sites

Ok, I tried and I have understood better the philosophy too. But, there is something wrong. I try to achieve the same folder structure as in the example (which btw I had completely overlooked), and I get errors, but meaningful at least:
 

goodError.PNG.8034b4cebfa510a8ac5f27a927b038cf.PNG

With the following structure:

insideProjectGood.PNG.88909a7c3a2d9a5e857a1241c81d5faf.PNG

In my explorer, I have this hierarchy:
folderTreeGood.PNG.76dbdb54c9d319ad8e64723658ff3b3c.PNG

And the inclusion is:

includePathsGood.thumb.PNG.f563101a7663ed2b5911fe16371dfbed.PNG

 

What makes me suspicious is that the library should have a default mode, even if in the gfxconf.h I have nothing uncommented, but still arise the error directive. Any other configuration and combination of includes, lead to the compiler to not find the includes or mismatching the folder hierarchy (so that the headers they need an additional "./" to work, and is wrong, since I must not edit the sources).

Any clue?

Link to comment
Share on other sites

It worked, thanks. But, I had to copy the gfx_mk.c to the root of the project, and remove from the linker scope of course without eliminating the original file in the original position (in Atmel Studio by just dragging to the main.c)

workingTree.PNG.28d1445bb500507b7fd03589f0e7080d.PNG

Otherwise it wasn't able to locate the gfx_mk.c and therefore knowing which .c file to link, because Atmel Studio was not able to locate the function of the gfxInit, but only the prorotype, which was able to find because in the main.c I put the gfx.h, as it should be.

Edited by thexeno
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...