2022-09-08 09:44 AM
Hi, I am trying to use the peripherals with their peripherals rather than initializing it with CUBEMX tool. I am only selecting 'Serial Wire' option of Debug mode under System Core -> SYS with CUBEMX. However, when I build my program, it throws the error in the title. I googled it but found nothing helpful. How can I solve this problem?
Thx in advance for your helps.
2022-09-08 10:06 AM
Make sure you uncomment/select the modules you want in stm32f7xx_hal_conf.h
Make sure your project has "Include Paths" point to the appropriate CubeF7 directories/folders holding the include files you expect to pull in.
Make sure the command line to the compiler has USE_HAL_DRIVER and the specific IC you're using.
Perhaps review the meta-data in a working/functional project, and use that as a reference/template?
2022-09-08 01:56 PM
- I am using RTC, but do I need to enable it because I don't use HAL Library, I am using registers. I am coding in register(low) level?
- I looked at it, and everything is fine I guess, because related locations were added. I didn't mention but when I click CTRL+Left Click, I can see the definition of HAL_StatusTypeDef, but the compiler somehow cannot.
- STM32F746xx and USE_HAL_DRIVER symbols were already added.
I cannot understand the last statement/suggestion, perhaps my English isn't enough to understand. May you please make it clear? And what else do I need to check/add, or what else you can recommend?
2022-09-08 02:27 PM
Take a project that works, and review and understand the configurations and setting that project is using. Apply those same settings to your own.
It is generally easier to change something that is working than it is to fix something that is broken.
There are lot of pieces of code and include files that get pulled in selectively based on #define in stm32f7xx_hal_conf.h and others.
You have to #include the top level include file, and it needs to fetch the others.
Perhaps generate the preprocessor output, and inspect that to see what is and isn't seen by the compiler.
Show the full error messages in context. Start with the FIRST error as this can compound into other errors.
If you're doing register level work you shouldn't need the HAL, rather just the includes that provide the CMSIS register names, etc.
2022-09-09 01:35 AM
I think I've solved the problem. As I said, I am implementing the program with HAL Registers, so I wanted to implement my header and source files, in one of the source files, I included "stm32f746xx_hal_def.h" once I commented it, the problem is fixed. This time, however, I cannot use UNUSED macro to prevent the compiler warnings, and I don't wanna include the definition in my header file. Is there any suggestion to handle this issue? I think we can do this by using macro conditions?
2022-09-10 06:09 PM
> I don't use HAL Library
> USE_HAL_DRIVER symbols were already added
Don't you see anything wrong here?
> I am implementing the program with HAL Registers
First you have to understand what the HAL is and what the registers are.
2022-09-11 09:06 AM
@Anıl Koluaçık What is "HAL registers"? Functions or macros with names __HAL_*** or "low level" (LL) macros?
The library includes are meant to be used in this way:
2024-07-03 03:40 PM
I was having the same problem and included the exact lib of the driver I needed (so I had #include <stm...i2c.h> instead of the general stm...hal.h)
Thanks Pavel, you saved me.