cancel
Showing results for 
Search instead for 
Did you mean: 

Hi, good morning, I have a compilation error what I add Flash functions such as HAL_FLASH_Unloc() ... I don't understand why, maybe I miss a setting in the project. The microcontroller is ESP32G070xx. Can anyone help me? Thank you very much Julian

JMigl.1
Associate

#include "stm32g0xx_hal.h"

  HAL_FLASH_Unlock();

  FLASH_Erase_Sector( FLASH_SECTOR_11,VOLTAGE_RANGE_1 );

  HAL_FLASH_Lock();

ERROR:

../Drivers/CMSIS/Device/ST/STM32G0xx/Include/stm32g070xx.h:531:31: error: expected declaration specifiers or '...' before '(' token

 531 | #define AHBPERIPH_BASE    (PERIPH_BASE + 0x00020000UL)

   |                ^

../Drivers/CMSIS/Device/ST/STM32G0xx/Include/stm32g070xx.h:569:32: note: in expansion of macro 'AHBPERIPH_BASE'

 569 | #define CRC_BASE       (AHBPERIPH_BASE + 0x00003000UL)

   |                ^~~~~~~~~~~~~~

../Drivers/CMSIS/Device/ST/STM32G0xx/Include/stm32g070xx.h:641:46: note: in expansion of macro 'CRC_BASE'

 641 | #define CRC         ((CRC_TypeDef *) CRC_BASE)

   |                       ^~~~~~~~

../Core/Src/upgrade_manager.h:10:44: note: in expansion of macro 'CRC'

  10 | char Upgrade_Manager_Close_File( uint16_t* CRC );

   |                      ^~~

1 ACCEPTED SOLUTION

Accepted Solutions
Imen.D
ST Employee

Hello @JMigl.1​ ,

Let me first welcome you to the STM32 Community =)

Regarding your reported issue, I think you should check the contents of the header files and your declarations.

I advise you to refer to the STM32CubeG0 MCU package and look at the source files to see how to use them.

You can start from a working example to have more idea about implementation, initialization code and related functions. Then make required updates according to your needs.

Please mark my answer as best by clicking on the "Select as Best" button if it helped 😊.

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen

View solution in original post

3 REPLIES 3
Imen.D
ST Employee

Hello @JMigl.1​ ,

Let me first welcome you to the STM32 Community =)

Regarding your reported issue, I think you should check the contents of the header files and your declarations.

I advise you to refer to the STM32CubeG0 MCU package and look at the source files to see how to use them.

You can start from a working example to have more idea about implementation, initialization code and related functions. Then make required updates according to your needs.

Please mark my answer as best by clicking on the "Select as Best" button if it helped 😊.

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
Imen.D
ST Employee

Hi @JMigl.1​ ,

Do you have still this problem to solve?

I'll be waiting for your feedback and share your update =)

Please close this topic by choosing "Select as Best" if your issue is resolved. This will help other users find that answer faster.

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen

Hi Imen,

yes the problem is solved, thank you very much for your advise, it was very useful for me! 😊

Please forgive me for the delay to answer you.

have a nice day!