Skip to main content
Associate
April 2, 2024
Solved

error: use of undeclared identifier 'assert'

  • April 2, 2024
  • 2 replies
  • 4441 views

I have a working code generated with STM32CUBEMX and TouchGFX 4.17, which I compiled with Keil using ARM compiler version 5. Now, we have updated the setup, and while trying to compile the code with ARM compiler version 6, Keil throws an error saying 'error: use of undeclared identifier 'assert''. This error occurs in more than 2000+ files related to TouchGFX.

I checked the files where it is throwing errors, and each file has a header #include <touchgfx/hal/Types.hpp>. In the file Types.hpp, the following headers are included:

 

 

#include <assert.h>
#include <stdint.h>
#include <touchgfx/hal/Config.hpp>

 

 

I went through the following articles, but the error still persists. How can I resolve this issue?

https://developer.arm.com/documentation/ka004216/latest/

https://developer.arm.com/documentation/100073/0618/The-Arm-C-and-C---Libraries/Tailoring-the-C-library-to-a-new-execution-environment/Program-exit-and-the-assert-macro

 

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

    Hello @Osman SOYKURT,

    Thank you for your inputs. I was able to resolve the issue, and I can now compile the code.

    I installed a fresh version of Keil uVision 5.39 and selected ARM:CMSIS v6.0.0 from the Software packs. Additionally, I had to select the recent version of ARM:CMSIS-RTX in the the Software packs.

    For some reason, the OSWrappers.cpp file in TouchGFX\target\generated wasn't updated after regenerating the code  with TouchGFXDesigner 4.23.2, so I had to manually include:

    #include <cassert>

    After doing so, the error was resolved.

    2 replies

    Osman SOYKURT
    Technical Moderator
    April 9, 2024

    Hello @Nece ,

    Could you describe the steps your did to upgrade your Keil version of your project?
    By the way, could you tell us which board do you use?
    "Now, we have updated the setup"  --> do you mean you updated to the newest TouchGFX (4.23.3) and STM32CubeMX (6.11.0)?

    Osman SOYKURTST Software Developer | TouchGFX
    NeceAuthorBest answer
    Associate
    April 17, 2024

    Hello @Osman SOYKURT,

    Thank you for your inputs. I was able to resolve the issue, and I can now compile the code.

    I installed a fresh version of Keil uVision 5.39 and selected ARM:CMSIS v6.0.0 from the Software packs. Additionally, I had to select the recent version of ARM:CMSIS-RTX in the the Software packs.

    For some reason, the OSWrappers.cpp file in TouchGFX\target\generated wasn't updated after regenerating the code  with TouchGFXDesigner 4.23.2, so I had to manually include:

    #include <cassert>

    After doing so, the error was resolved.