cancel
Showing results for 
Search instead for 
Did you mean: 

RTC

Aashritha_Vuda
Associate II

 

Hi Everyone,

I'm using a STM32H747XIH6 board.

checking RTC(Real Time Clock), peripheral through generating gui in STM32cubeide and configuring in STM32cubemx . After all the application completion I'm facing this kind of error ;

"gui/src/model/Model.cpp:3:10: fatal error: stm32h7xx_hal.h: No such file or directory
#include "stm32h7xx_hal.h"  in touchgfx run simulator".

If I remove the particular header file in stm32 cubeide the code is not working .

so anyone can help me out ?

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions

Your PC isn't an STM32. The simulator doesn't emulate the STM32. So it cannot use any of the STM32 HAL libraries.

The solution is simple:

  • use the compiler define SIMULATOR to detect if it is a simulator. You can use #ifdef SIMULATOR or #ifndef SIMULATOR. Then only include stm32h7xx_hal if it is not the simulator.
  • in case you want the time in the simulator you can use time.h instead

I made a simple clock application this way. It shows date and time and runs in simulator and on target.

Kudo posts if you have the same problem and kudo replies if the solution works.
Click "Accept as Solution" if a reply solved your problem. If no solution was posted please answer with your own.

View solution in original post

4 REPLIES 4
EmbDev
Senior

The simulator does not have a dependency on the STM32 HAL. As in the simulator you cannot interface with the STM32 hardware. If you want to test code using the RTC, you should run the code on the target. If you want to run the simulator you have to ensure the code that is used in the Model does not directly depend on the STM32 HAL.

Your PC isn't an STM32. The simulator doesn't emulate the STM32. So it cannot use any of the STM32 HAL libraries.

The solution is simple:

  • use the compiler define SIMULATOR to detect if it is a simulator. You can use #ifdef SIMULATOR or #ifndef SIMULATOR. Then only include stm32h7xx_hal if it is not the simulator.
  • in case you want the time in the simulator you can use time.h instead

I made a simple clock application this way. It shows date and time and runs in simulator and on target.

Kudo posts if you have the same problem and kudo replies if the solution works.
Click "Accept as Solution" if a reply solved your problem. If no solution was posted please answer with your own.
GaetanGodart
ST Employee

Hello @Aashritha_Vuda and welcome to the community!

 

The previous answers seems to answer your question quite clearly.

Please keep us updated on your progress! :smiling_face_with_smiling_eyes:

 

Regards,

Gaetan Godart
Software engineer at ST (TouchGFX)
GaetanGodart
ST Employee

Hello @Aashritha_Vuda ,

 

Have you been able to move forward with your project?

If one of the previous comment helped you solve your issue, I invite you to select it as "best answer".

If you are still encountering problems, I invite you to give us more information so we can help you.

 

Regards,

Gaetan Godart
Software engineer at ST (TouchGFX)