Loading...
 

Zephyr project on STM32

   Zephyr Workbench, a VSCode extension to manage Zephyr on STM32.
It enables users to easily create, develop, and debug Zephyr applications.
Main features:
  • Install host dependencies.
  • Import toolchain and SDK.
  • Create, configure, build and manage apps.
  • Debug STM32.
You can directly download it from the VSCode marketplace
For more details, visit the Zephyr Workbench

System Workbench for STM32


Adding new Include files

The previous posts do not clearly address the process for adding include files to a project. System WorkBench project view makes this process difficult if not directly impossible. Currently include files are viewed by expanding the “> Includes” heading in the project outline. Here include files can be viewed and edited simply by double clicking the file of interest. However, there is no way of adding files to any of these directories via the system wrokbench tool by right click as is the case for source .c files say in the User heading (folder). Further, the New file method dialog does make visible any of the folders that contain include files. The only way I have found around this is to run a code creation tool outside of SW4STM32 and save the include file to the include directory of choice. Or use SW4STM32 to create a header file in the User source area and then move it using a file manager.

Is there a better way?

I certainly like the way Keil handles this. Include files are accessible by expanding the outline view of a source .c file that uses the .h file. Also you can add a new file to a group and all of the folders in the group are viewable/selectable as the destination for the file.

Is it possible I have an incorrect setting somewhere?

Hello,

can you try to add include directories by clicking right on your project, select Properties, expand C/C++ General and select the item Paths ans Symbols, here you can add a Include directories. the files ‘ll be visible under the Includes node of your project.
Let me know if that answer your question.

BR
Christelle


No. This not about adding include paths. It is about adding header files (*.h) as a source file. You can right click on the “User” folder and select New>Header file but that will put it in the “User” folder not in the “Project_name/Inc” folder which is not where I want it or where it should be. Once you select New>Header file and get the dialog you have a choice to select a “Source Folder” but the Browser pulls up a dialog “Choose a source folder” and the tree that is displayed does not allow selection of the “Inc” folder or any other folder that the include paths currently point to. Seems to me someone overlooked the creation of new header files and what to do with them when the feature was established. Going further I would have thought it intuitive that when creating a new header file, the possibility of creating a new folder along with it would automatically add the new folder to the include path list.

Hi,

You can add header file on the project/inc folder by diretly click-right on it and select New> Header file
Or on the general File menu, choose New > Header file, browse to select projet/inc folder.

BR

Christelle


That is how I thought it should work based on experience with other IDEs and Eclipse. However the Inc folder created by cubeMX is not visible in the project tree as I explained above. What is visible in the project tree is:
Project
>Binaries
>Includes
>Application
>Debug
>Drivers
>Middlewares
STM32F429ZITx_Flash.ld

Under >Includes the includes files are listed and can be selected for edit from there. However you cannot right click on >Includes and do anything more than highlight the field. >Application expands to reveal”
>Application
>SW4STM32
>User

In >User all of the c source files are visible and that folder can be right-clicked to add new source files including .h files. But of course that is not where I want the .h files to reside.


-SOLVED-
OK I have found a way to work around the issue which I guess is a combination of CubeMX and Eclipse problem. Before I state the work around here is my perception of what is going on between CubeMX and Eclipse. CubeMX creates a project to hold the IP required to operate the micro along with the peripherals selected and the connections defined. I think it is intended that additional user code be kept separate from the CubeMX code. The faliing here is that the file tree to do this does not match the depiction in the Project tree in Eclipse. As additional source files are created the project tree shows the location as Project_Name>Application>User when if fact the additional source files are actually located at Project>SW4STM32>>Project_Name>Application>User. (location starting at WorkSpace_Name assumed).

The work around is:
1) create a new folder in the folder depicted in the project tree in Eclipse in Project_Name>Application>User called Inc (or whatever you want to call the folder for added include files). Now a real folder exists in which you can use the File>New>Source File to create from the templates a new .h file. Be aware that the actual file folder will reside at WorkSpace_Name>Project_Name>SW4STM32>Project_Name>Application>User.

2) Then select the project name in the project tree and click on Project(menu)>Properties>Settings and select in the Tool Settings tab select MCU GCC Compiler>Includes. in the Include Paths window select the Add Paths icon (picture of page with green arrow) and click on the WorkSpace button. Use the tree to navigate to the new folder you created and click OK. Note this will create a workspace relative path to the project name using internal Eclipse variables which is much better IMHO.

France

Hi,
From the layout you describe I presume that either

  1. You use an old version of CubeMX
  2. You uncheck the “Generate project in root directory” checkbox when generating the project for System Workbench for STM32 in CubeMX

If you upgrade and generate in the root directory, the layout will be a lot more clear and will reflect the effective file layout in the workspace.
Bernard (Ac6)


You are correct that I do not have Generate under root checked. I am using version 4.16.0 of Cube MX which reports as the latest. I am usnig SW4STM32 built under the Mars.2 release. If I check Generate under root, the project that results does not reference the Hal_...cortex.c and .h files so I get the error “SysTick_IRQn could not be resolved”, and the HAL_SYSTICK_... calls as well as the HAL_NVIC_SetPriority call do not show up in the cyan color I am used to seeing. However, hovering over the call in main does show the definition. Bottom line is it compiles and creates the binary but not without error and the binary does not run.
France

Hi,

The “could not be resolved” errors are in fact not due to not referencing some files but to reference useless header files... In fact CubeMX provides the header files for all supported chips, not just the one used, and these header files are not protected by #ifdefs inside the file but around the #include that references them...

The net effect is that, by default, System Workbench will see several definitions for, say, SysTick_IRQn, and has no clue to which one is the right one, so the “could not be resolved” message.

To correct that you just have to switch System Workbench to only parse header files that are effectively included in your source files, either globally (in Window >> Preferences >> C/C++ >> Indexer) or just for the current project (in project >> Properties >> C/C++ General >> Indexer and checking the Enable project specific settings checkbox) and uncheck the Index unused headers checkbox.

Detailed explanations are in this FAQ: ((http://www.openstm32.org/tiki-view_faq.php?faqId=4#q21|Why did the IDE complains that SysTick_IRQn can’t be resolved when my project compile cleanly?))

Bernard (Ac6)


Hello,
I added some files in my project ,the files related to x-nucleo-iks01a1 and I got 816 error “symbol (name of some variables) is not resolved’. then I added the file path of every file but still same issue.
Let me know how the path of file is added in SW4STM32 if i did it wrong ?

It is difficult to determine right or wrong as your description of what you have done lacks sufficient detail. However, file paths for inlcude files is added by right clicking the project name in the Project explorer tree and selecting Properties at the bottom of the menu or by left clicking on the project name in the Project explorer tree and pressing Alt+Enter. In the Properties dialog window left side, expand the > C/C++ Build catagory by clicking on the right arrow and select Settings in the indented list. To the right should appear some tabs under the Configuration: list box. Select the Tool Settings tab. Under the > MCU GCC Compiler heading select the Includes heading. To the right will appear the include file paths. A path can be editted by simply double clicking the path. A new path is added by using the add icon (depicting a document page with a green plus symbol) located to the right just below the scroll window containing the paths. A dialog window will appear that allows navigation within the file system or the workspace ( I prefer the later).

Hi,

I am new to STM32 HAL Programming and trying to make a code for Touchscreen LCD using STM3220G-EVAL Board. I am getting this fatal error in the include file #include “../Common/fonts.h” . It shows as no such file or directory

Could anyone please help me fix this error? I am using SW4STM32 as my IDE. I have also attached my code here.


Thank You

Mohd Tanveer

Mohd,
Step 1 is to verify you have a directory and file off of the Workspace/project folder/Common.
I also noticed that just below the #include “../Common/fonts.h” you have a line that includes another fonts.h. Are they the same file? If so you will get complaints about duplicate definitions. If the fonts.h file you are using is in conjunction with using the LCD screen utilities, the utilities folder needs to be copied over to your project and paths set to the various folders.

Hi Gregreenwood,

Thank you so much for your valuable reply.

Actually I got this example code from the internet and I’m trying to run it on my hardware. I have reduced the number of errors in the program to just 4 which were over 250 initially.
And as you advised, I have verified the directory and file off of the Workspace/project folder/Common.I could not find any such directory.

The only error in my program is shown in #include “../Common/fonts.h” file because of which I am not able to compile my code. I have even tried removing fonts.h file but still the problem persists.

As I said I am new to STM32 HAL Programming, so could you please suggest me a way out or suggest me some links where I can find this file or directory and add it to my program?

Thank You
Mohd Tanveer

Hi,

Greetings to everyone here!

Could anyone suggest me how to Interface STM32F2XX (STM3220G-eval) or STM32F4XX with SSD1963 (864x480) LCD Display Control. I am new to HAL LCD programming (If someone has a dummy code, please do share).

Thanks

HI. I recently got an STM3220g eval board and want to use the LCD screen too. Did you manage to find any basic code or tutorials? I’ve got some of the HAL examples working but not the LCD...

 

Newest Forum Posts

  1. Монтаж камина с грилем в Москве - установка и барбекю by KpddomErorb, 2025-05-10 18:28
  2. SPI on Nucleo_STMH533RE by royjamil, 2025-05-04 20:13
  3. SPI on Nucleo_STMH533RE by higginsa1, 2025-03-25 07:37
  4. SPI on Nucleo_STMH533RE by royjamil, 2025-03-23 11:31
  5. SPI on Nucleo_STMH533RE by higginsa1, 2025-03-23 09:33
  6. Configuring DMA for ADC in SW? by sam.hodgson, 2025-03-04 12:58
  7. Build a project in "release" mode by info@creosrl.it, 2025-02-20 18:12
  8. Build a project in "release" mode by info@creosrl.it, 2025-02-20 17:05
  9. Build a project in "release" mode by tang, 2025-02-20 10:36
  10. Build a project in "release" mode by info@creosrl.it, 2025-02-19 17:35

Last-Modified Blogs