2024-09-30 01:46 AM - last edited on 2024-09-30 02:15 AM by Andrew Neil
Hi,
Having successfully installed SW4STM32 I recently tried to build the example project detailed on the RIP Tutorial web page entitled "First time setup with blink LED example using SW4STM32 and HAL library". This "threw up" four errors. The first was classed as a fatal error whilst the other three errors involved "make" which I believe are due to the first error.
Within the IDE, on the "Problems" tab, the first error is listed as follows.
Description: fatal error: usbh_conf.h: No such file or directory
Resource: usbh_conf.h
Path: /STM32F4_Discovery_Blinky/Middlewares/ST/STM32_USB_Host_Library/Core/Inc line 28 C/C++ Problem
Within the ".../Inc/" directory is a further subdirectory called "usbh_core.h" within which is the "offending" (non-existent?!) usbh_conf.h This header file is clearly listed on both the Project Explorer and Outline tabs within the IDE. Opening this file shows the following. (How could this be done if the file did not exist ?!)
/**
******************************************************************************
* @file usbh_core.h
* @author MCD Application Team
* @brief Header file for usbh_core.c
******************************************************************************
* @attention
*
* <h2><center>© Copyright (c) 2015 STMicroelectronics.
* All rights reserved.</center></h2>
*
* This software component is licensed by ST under Ultimate Liberty license
* SLA0044, the "License"; You may not use this file except in compliance with
* the License. You may obtain a copy of the License at:
* http://www.st.com/SLA0044
*
******************************************************************************
*/
/* Define to prevent recursive ----------------------------------------------*/
#ifndef __USBH_CORE_H
#define __USBH_CORE_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "usbh_conf.h"
#include "usbh_def.h"
#include "usbh_ioreq.h"
#include "usbh_pipes.h"
#include "usbh_ctlreq.h"
It can be clearly seen that, with the first "#include", the file includes itself. The IDE flags this line (line 28 within usbh_conf.h) as the source of the error as the line is prepended with an error indicator in the form of a red square containing a yellow cross. Is this instance of the file including itself some form of overlooked/unintended file-level recursion ? Given the compiler directives that immediately precede this line, this would seem to be the case. I am at a loss at this point.
Stuart
2024-09-30 02:14 AM - edited 2024-09-30 02:32 AM
You're posting in the public community.
If you want to contact ST direct, you need to open a Case with the Support Centre:
Please see the posting tips for how to properly post source code:
@SElli.11 wrote:Within the IDE, on the "Problems" tab, the first error is listed as follows.
The 'Problems' tab re-orders messages, so it's not useful for determining which is the "first" error.
Use the 'Console' view instead:
The 'Console' view also gives extra indications of what & where, exactly, it's complaining about.
@SElli.11 wrote:Is this instance of the file including itself some form of overlooked/unintended file-level recursion ?
The header files all have so-called 'Include Guards'; eg,
/* Define to prevent recursive ----------------------------------------------*/
#ifndef __USBH_CORE_H
#define __USBH_CORE_H
So, no - this would not be a problem.
@SElli.11 wrote:This header file is clearly listed on both the Project Explorer and Outline tabs within the IDE. Opening this file shows the following. (How could this be done if the file did not exist ?!)
The IDE's editor knows where to find it, but the Compiler - which is what actually builds your code - doesn't
The Compiler uses the 'Include Paths' setting to find #include-d files
So check you 'Include Paths' - they need to list the place where this header exists.
PS:
2024-09-30 02:17 AM
@SElli.11 wrote:the RIP Tutorial web page
You mean this: https://riptutorial.com/ ?
That's a 3rd-party website - nothing to do with ST
2024-10-03 07:45 AM
Hi @SElli.11
usbh_conf.h is configuration file among header files. Maybe you didn't rename the template file and keep it as it is usbh_conf_template.h
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2024-10-03 12:55 PM
Goo evening FBL,
Thank you for your reply
"Maybe you didn't rename the template file and keep it as it is usbh_conf_template.h "
As I state in the first two lines of my original posting :-
"...I recently tried to build the example project detailed on the RIP Tutorial web page entitled "First time setup with blink LED example using SW4STM32 and HAL library"."
To be clear, the code that I showed in my original posting here was copied and pasted directly from that web page.
An examination of that source code will show that there wasn't/isn't a file called usbh_conf_template.h. Do you mean that I should rename usbh_conf.h itself to usbh_conf_template.h or that the #include usbh_conf.h within(!) the file should be changed to #include usbh_conf_template.h ? This template name may not be recognised by the build system as it is not in the folder/file path of the original software shown on that web page.
From what I can see, I think this reduces to a naming conflict. I'm just not sure whether usbh_conf.h should change its name or whether the file name that is #include-d within usbh_conf.h should change its name. The only support that is available on the RIP Tutorial web page is a chatGPT bot which I seriously doubt could handle this question.
Stuart
2024-10-03 01:03 PM
Good evening Mr Neil,
"You mean this: https://riptutorial.com/ ?
That's a 3rd-party website - nothing to do with ST"
Yes, I was aware of that when I made my original posting. I merely mentioned the web page in my original posting so that should anyone offer to help they would know from where I got the source code.
Stuart
2024-10-04 02:12 AM - edited 2024-10-04 02:15 AM
You may start a new project since I cannot progress in this subject without sharing your project. It seems, you are only missing the configuration file (or maybe the tutorial). You need to check the conf file should be present in your project and properly included under 'Include Paths'
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.