2015-06-27 02:20 PM
I used CubeMX to setup FREERTOS on STMF0m Discovery board, with STM32F051R8Tx
I keep getting Error 272: undeclared identifier ''SystemCoreClock Any suggestions how to fix that? Any help appreciated2015-06-28 05:55 AM
You may find the
setting in FreeRTOSConfig.h is defined to SystemCoreClock - SystemCoreClock is defined in the STM32 CMSIS core support files though, not in the FreeRTOS files. Does your project included the CMSIS core files?2015-06-28 09:23 AM
Hi Gerhard,
Without knowing more about the configuration, quite hard to reproduce (in fact, not reproduced yet, works fine for me with Mx 4.8 and IAR).
Would it be possible to know:
- CubeMx version in use: 4.x (with x = ?) ; standalone executable installed or Eclipse plugin used? - OS : Linux / Windows 7, 8 or 10 ? - toolchain being used : IAR / Keil / Atollic / SW4STM32 / ... ? Getting the project file (the one with .ioc extension) could help as well.Something that is common to most of the requests we get on CubeMx: we need to know tools and OS versions you use for a better support.
As is, without knowing more, as suggested in FreeRTOS.org answer, the generated project could be wrong and the file with SystemCoreClock missing
(file named in your case, system_stm32f0xx.c).Another possible root cause is that the lines in FreeRTOSConfig.h are ignored/removed by the C preprocessor because of a missing define.
#if defined(__ICCARM__) || defined(__CC_ARM) || defined(__GNUC__) #include <stdint.h> extern uint32_t SystemCoreClock; #endifI've just commented the ''extern uint32_t SystemCoreClock;'' in FreeRTOSConfig.h, and got with IAR, the following error
Error[Pe020]: identifier ''SystemCoreClock'' is undefined ...\MX4_10_FreeRTOS_F051R8Tx\Middlewares\Third_Party\FreeRTOS\Source\portable\IAR\ARM_CM0\port.c 445 Error while running C/C++ CompilerWhile commenting the line in the CMSIS file, I get the following one:
Linking Error[Li005]: no definition for ''SystemCoreClock'' [referenced from C:\Users\Fred\MX\2015-06-28\MX4_10_FreeRTOS_F051R8Tx\EWARM\ MX4_10_FreeRTOS_F051R8Tx Configuration\Obj\port.o]The error you get is a compilation error (something not defined, missing in a C file) as on my first try, or an issue at link time as on the 2nd try
(something defined as external but finally not found in any object file to link, meaning a file is missing, as suggested in FreeRTOs.org answer) ?Regards,
Fred
You may find the
setting in FreeRTOSConfig.h is defined to SystemCoreClock - SystemCoreClock is defined in the STM32 CMSIS core support files though, not in the FreeRTOS files. Does your project included the CMSIS core files?2015-06-28 02:41 PM
FredC
Thanks for the reply.My setup:
Win 8.1 STM32CubeMX V 4.8.0 Use Altium Tasking, wich is Eclipse with plug-insI see
uint32_t SystemCoreClock = 8000000; in system_stm32f0xx.c in subdir CMSIS\Device\ST\STM32F0xx\Source\TemplatesI see the compilation message:
Compiling system_stm32f0xx.cI get a number of warnings:
carm W576: [''D:\2\Tasking\0628F051_RTOS\Middlewares\Third_Party\FreeRTOS\Source\portable\GCC\ARM_CM0\portmacro.h'' 126/66] unknown attribute ''naked'' ignored amk E452: [''Middlewares\Third_Party\FreeRTOS\Source\portable\GCC\ARM_CM0\subdir.mk'' 9/0] target 'Middlewares\Third_Party\FreeRTOS\Source\portable\GCC\ARM_CM0\port.obj' returned exit code 1 carm W576: [''D:\2\Tasking\0628F051_RTOS\Middlewares\Third_Party\FreeRTOS\Source\portable\GCC\ARM_CM0\portmacro.h'' 127/75] unknown attribute ''naked'' ignored carm W576: [''..\Middlewares\Third_Party\FreeRTOS\Source\portable\GCC\ARM_CM0\port.c'' 125/50] unknown attribute ''naked'' ignored carm W576: [''..\Middlewares\Third_Party\FreeRTOS\Source\portable\GCC\ARM_CM0\port.c'' 132/58] unknown attribute ''naked'' ignored carm E272: [''..\Middlewares\Third_Party\FreeRTOS\Source\portable\GCC\ARM_CM0\port.c'' 560/28] undeclared identifier ''SystemCoreClock''In / during Compiling port.c
the undeclared identifier ''SystemCoreClock'' but the line is: portNVIC_SYSTICK_LOAD = ( configCPU_CLOCK_HZ / configTICK_RATE_HZ ) - 1UL; I am still a little lost with this. Any help appreciated2015-06-29 05:58 AM
Hi Gerhard,
Altium Tasking is not a toolchain among the ''default'' ones supported in CubeMx GUI (cf screenshot).
Any way, it could have worked ''as is'' without the lines in FreeRTOSConfig.h (something to investigate on our side, maybe to improve, but for the moment, they are present!) As a workaround, what you could try is to add in the FreeRTOSConfig.h file, inside a user section, the following lines dedicated to Altium Tasking toolchain, something like: /* USER CODE BEGIN Includes */ #if defined(__ALTIUM_TASKING__) #include <stdint.h> extern uint32_t SystemCoreClock; #endif /* USER CODE END Includes */ Note: the code inside a ''user code'' section is not lost when re-generating code with Mx. Then, definining that symbol (__ALTIUM_TASKING__) for your project in Altium toolchain (a setting dedicated to the C/C++ compiler, not to be defined for Asembler) could make things better for you. Regards, FredFredC
Thanks for the reply.My setup:
Win 8.1 STM32CubeMX V 4.8.0 Use Altium Tasking, wich is Eclipse with plug-insI see
uint32_t SystemCoreClock = 8000000; in system_stm32f0xx.c in subdir CMSIS\Device\ST\STM32F0xx\Source\TemplatesI see the compilation message:
Compiling system_stm32f0xx.cI get a number of warnings:
carm W576: [''D:\2\Tasking\0628F051_RTOS\Middlewares\Third_Party\FreeRTOS\Source\portable\GCC\ARM_CM0\portmacro.h'' 126/66] unknown attribute ''naked'' ignored amk E452: [''Middlewares\Third_Party\FreeRTOS\Source\portable\GCC\ARM_CM0\subdir.mk'' 9/0] target 'Middlewares\Third_Party\FreeRTOS\Source\portable\GCC\ARM_CM0\port.obj' returned exit code 1 carm W576: [''D:\2\Tasking\0628F051_RTOS\Middlewares\Third_Party\FreeRTOS\Source\portable\GCC\ARM_CM0\portmacro.h'' 127/75] unknown attribute ''naked'' ignored carm W576: [''..\Middlewares\Third_Party\FreeRTOS\Source\portable\GCC\ARM_CM0\port.c'' 125/50] unknown attribute ''naked'' ignored carm W576: [''..\Middlewares\Third_Party\FreeRTOS\Source\portable\GCC\ARM_CM0\port.c'' 132/58] unknown attribute ''naked'' ignored carm E272: [''..\Middlewares\Third_Party\FreeRTOS\Source\portable\GCC\ARM_CM0\port.c'' 560/28] undeclared identifier ''SystemCoreClock''In / during Compiling port.c
the undeclared identifier ''SystemCoreClock'' but the line is: portNVIC_SYSTICK_LOAD = ( configCPU_CLOCK_HZ / configTICK_RATE_HZ ) - 1UL; I am still a little lost with this. Any help appreciated