CMSIS5: Errors with using C++

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • CMSIS5: Errors with using C++

      Hello,
      I ran into an unpleasant moment due to which the build of my project stopped.The project was created for the STM32 microcontroller to study the use of C ++ for embedded systems.
      The corresponding packages are installed:
      stm32l4;
      CMSIS 5 (Core and DSP)

      SES Version: 5.40c

      To get access to some assembly functions (for example __NOP(), __SEV(), __WFI(), ... ) I include the file "cmsis_gcc.h" and I get the following errors:

      Source Code

      1. Building ‘stm32L4’ from solution ‘stm32L4’ in configuration ‘Debug’
      2. Compiling ‘main.cpp’
      3. main.cpp
      4. 'const __cmsis_start()::__copy_table_t __copy_table_start__', declared using local type 'const __cmsis_start()::__copy_table_t', is used but never defined [-fpermissive]
      5. 'const __cmsis_start()::__copy_table_t __copy_table_end__', declared using local type 'const __cmsis_start()::__copy_table_t', is used but never defined [-fpermissive]
      6. 'const __cmsis_start()::__zero_table_t __zero_table_start__', declared using local type 'const __cmsis_start()::__zero_table_t', is used but never defined [-fpermissive]
      7. 'const __cmsis_start()::__zero_table_t __zero_table_end__', declared using local type 'const __cmsis_start()::__zero_table_t', is used but never defined [-fpermissive]
      8. Build failed


      The search for a way to fix this error led to the forum: Github: ARM CMSIS. But the solution suggested there has to do with modifying the file "cmsis_gcc.h":

      Source Code

      1. // After "bugFix"
      2. typedef struct {
      3. uint32_t const* src;
      4. uint32_t* dest;
      5. uint32_t wlen;
      6. } __copy_table_t;
      7. typedef struct {
      8. uint32_t* dest;
      9. uint32_t wlen;
      10. } __zero_table_t;
      11. extern const __copy_table_t __copy_table_start__;
      12. extern const __copy_table_t __copy_table_end__;
      13. extern const __zero_table_t __zero_table_start__;
      14. extern const __zero_table_t __zero_table_end__;
      15. __STATIC_FORCEINLINE __NO_RETURN void __cmsis_start(void)
      16. {
      17. extern void _start(void) __NO_RETURN;
      18. for (__copy_table_t const* pTable = &__copy_table_start__; pTable < &__copy_table_end__; ++pTable) {
      19. for(uint32_t i=0u; i<pTable->wlen; ++i) {
      20. pTable->dest[i] = pTable->src[i];
      21. }
      22. }
      23. for (__zero_table_t const* pTable = &__zero_table_start__; pTable < &__zero_table_end__; ++pTable) {
      24. for(uint32_t i=0u; i<pTable->wlen; ++i) {
      25. pTable->dest[i] = 0u;
      26. }
      27. }
      28. _start();
      29. }
      Display All

      I believe that it is bad form to modify the file you supplied in the package.
      I have attached a project that reproduces the given problem: stm32.zip.

      Please, tell me how to deal with this error?
      ____________________________________________
      With best regards,
      Max
    • so, a little fix resolve this problem:

      C Source Code

      1. #ifdef __cplusplus
      2. extern "C" {
      3. #endif
      4. #include "cmsis_gcc.h"
      5. #ifdef __cplusplus
      6. }
      7. #endif
      It turns out that in the h-files of the smsys library it is necessary to add missing "extern "C" ".