Skip to main content
Visitor II
August 9, 2024
Solved

Errors While Compiling STM32F10x Standard Peripheral Library in Keil

  • August 9, 2024
  • 1 reply
  • 4461 views

Hello,

I’m encountering multiple errors and warnings when trying to compile a project using the STM32F10x Standard Peripheral Library in Keil uVision. The specific errors are related to assert_param being undeclared and numerous UTF-8 warnings in comments.

Environment:

STM32F10x Standard Peripheral Library
Keil uVision (Using ARM Compiler v6.21)
Key Errors:

call to undeclared function 'assert_param'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
invalid UTF-8 in comment [-Winvalid-utf8] in stm32f10x.h
It seems like the compiler isn't recognizing the assert_param macro, which is leading to multiple errors. I’ve ensured that the stm32f10x_conf.h file includes the necessary header files, but the issue persists.

Has anyone experienced similar issues or can provide guidance on resolving these errors?

Thank you!

    This topic has been closed for replies.
    Best answer by romi

    Thank you for your kind response. I found the solution by defining USE_STDPERIPH_DRIVER in the project header file. I made the following changes in the stm32f10x_rcc.h header file, and now everything is working fine:

    #ifndef __STM32F10X_CONF_H
    #define __STM32F10X_CONF_H

    #define USE_STDPERIPH_DRIVER

    #include "stm32f10x.h" // Main STM32F10x header
    #include "stm32f10x_gpio.h" // GPIO header
    #include "stm32f10x_rcc.h" // RCC header
    // Include other necessary headers...

    // Define assert_param macro if not already defined
    #ifdef USE_STDPERIPH_DRIVER
    #define assert_param(expr) ((void)0) // Implement according to your needs
    #else
    #define assert_param(expr) ((void)0)
    #endif

    #endif /* __STM32F10X_CONF_H */

    1 reply

    Super User
    August 9, 2024

    > invalid UTF-8 in comment [-Winvalid-utf8] in stm32f10x.h

    You sure you have valid files? The library shouldn't have non UTF-8 characters.

    stm32f10x-stdperiph-lib/Project/STM32F10x_StdPeriph_Template/stm32f10x_conf.h at afa743577f2784e95be2d5003380fdb84a702519 · wajatimur/stm32f10x-stdperiph-lib (github.com)

    Perhaps post your file here?

    romiAuthor
    Visitor II
    August 9, 2024

    Thank you for your response. I double-checked the files, and they seem to be valid. The issue might not be with the library itself but potentially with the encoding settings on my end. I’ve followed the instructions as you suggested, but the problem persists.

    Here’s what I’ve tried so far:

    • Verified that the files are not corrupted and match the repository.
    • Made sure my editor is set to use UTF-8 encoding.
    • Recompiled the project after ensuring everything is in UTF-8.

    However, I still get the invalid UTF-8 in comment [-Winvalid-utf8] error in stm32f10x.h

    Graduate II
    August 9, 2024

    The SPL data back to uVision 4

    Where are you pulling these files? Some third-party repo, or the .zip files for the libraries off ST's site? What version?

    What line and comment is it objected too?