# identifier "SystemCoreClock" is undefined

**URL:** <https://forums.freertos.org/t/identifier-systemcoreclock-is-undefined/8071>\
**Category:** Kernel\
**Created:** [September 22, 2019, 7:58pm UTC](https://forums.freertos.org/t/identifier-systemcoreclock-is-undefined/8071 "2019-09-22T19:58:36Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [September 22, 2019, 7:58pm UTC](https://forums.freertos.org/t/identifier-systemcoreclock-is-undefined/8071/1 "2019-09-22T19:58:36Z")

</div>

**[manua](https://sourceforge.net/u/manua/)** wrote on [Sunday, September 22, 2019](https://sourceforge.net/p/freertos/discussion/382005/thread/3ea8098e9f/#de26):

Hi,

First attempt at trying FreeRTOS with MDK5. Trying to build add to a sample STM32F334 project that exists;

Created a folder within the existing project, copied relevant FreeRTOS files.

Copied the FreeRTOSConfig.h file from FreeRTOS/Demo/CORTEX\_M4F\_STM32F407ZG-SK/  
Wasn’t very sure whether the stock config file helps.

I get the following build failure.

…

compiling port.c…  
FreeRTOS\portable\RVDS\ARM\_CM4F\port.c(712): error: #20: identifier “SystemCoreClock” is undefined  
ortNVIC\_SYSTICK\_LOAD\_REG = (  
onfigSYSTICK\_CLOCK\_HZ / configTICK\_RATE\_HZ ) - 1UL;  
FreeRTOS\portable\RVDS\ARM\_CM4F\port.c: 0 warnings, 1 error  
…

“.\Objects\Blinky.axf” - 1 Error(s), 0 Warning(s).

Do, I need to tweak the FreeRTOSConfig.h ?

Can somebody suggest what to do ?

Thanks,  
Manu

---

<div class="post-metadata">

**Author:** ![rtel](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/rtel/32/31_2.png) [@rtel](https://forums.freertos.org/u/rtel)\
**Post date:** [September 22, 2019, 8:19pm UTC](https://forums.freertos.org/t/identifier-systemcoreclock-is-undefined/8071/2 "2019-09-22T20:19:58Z")

</div>

**[rtel](https://sourceforge.net/u/rtel/)** wrote on [Sunday, September 22, 2019](https://sourceforge.net/p/freertos/discussion/382005/thread/3ea8098e9f/#de26/4b4a):

SystemCoreClock is the name of a variable used by CMSIS header files.  
If you are using a CMSIS header file for your chip it should be defined  
in there, and including the CMSIS header file from within  
FreeRTOSConfig.h will fix the issue. Otherwise manually edit  
FreeRTOSConfig.h to replace the reference to SystemCoreClock with  
whatever clock speed is used to feed the SysTick timer on your device -  
the configCPU\_CLOCK\_HZ parameter is the one to set.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [September 22, 2019, 8:20pm UTC](https://forums.freertos.org/t/identifier-systemcoreclock-is-undefined/8071/3 "2019-09-22T20:20:17Z")

</div>

**[aggarg-aws](https://sourceforge.net/u/aggarg-aws/)** wrote on [Sunday, September 22, 2019](https://sourceforge.net/p/freertos/discussion/382005/thread/3ea8098e9f/#de26/7391):

The variable SystemCoreClock is exported from stm32 system file which usually contains SystemInit and SystemCoreClockUpdate functions. For STM32F334, it should be called system\_stm32f3xx.c.

You can use STM32CubeMX to generate a MDK5 project for STM32F334 which can be used a starting point.

Thanks.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [September 22, 2019, 8:27pm UTC](https://forums.freertos.org/t/identifier-systemcoreclock-is-undefined/8071/4 "2019-09-22T20:27:24Z")

</div>

**[aggarg-aws](https://sourceforge.net/u/aggarg-aws/)** wrote on [Sunday, September 22, 2019](https://sourceforge.net/p/freertos/discussion/382005/thread/3ea8098e9f/#de26/6cb2):

I am attaching this MDK5 project for STM32F3348 Discovery board which I generated using CubeMX - if that helps you.

Thanks.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [September 22, 2019, 8:59pm UTC](https://forums.freertos.org/t/identifier-systemcoreclock-is-undefined/8071/5 "2019-09-22T20:59:06Z")

</div>

**[manua](https://sourceforge.net/u/manua/)** wrote on [Sunday, September 22, 2019](https://sourceforge.net/p/freertos/discussion/382005/thread/3ea8098e9f/#de26/6cb2/9774):

Hi Gaurav,

Thanks for sending the CubeMX. But I’ve been using the std peripheral library.  
What I did was download FreeRTOS 10.2.1 and then extract the relevant  
files into MDK5.

I see that you have an additional freertos.c and a main.c, which  
probably uses RTX ?  
(cmsis\_os.h).  
The project builds, but I’m confused with all the mix in there

Reading documentation with MDK5, makes it even more confusing with  
CMSIS v1, v2 and so on.

Thanks,  
Manu

On Mon, Sep 23, 2019 at 1:57 AM Gaurav Aggarwal  
[aggarg-aws@users.sourceforge.net](mailto:aggarg-aws@users.sourceforge.net) wrote:

> I am attaching this MDK5 project for STM32F3348 Discovery board which I generated using CubeMX - if that helps you.
> 
> Thanks.
> 
> Attachments:
> 
> stm32f334.zip (24.1 MB; application/x-zip-compressed)
> 
> * * *
> 
> identifier “SystemCoreClock” is undefined
> 
> * * *
> 
> Sent from [sourceforge.net](http://sourceforge.net) because you indicated interest in [SourceForge.net: Log In to SourceForge.net](https://sourceforge.net/p/freertos/discussion/382005/)
> 
> To unsubscribe from further messages, please visit [SourceForge.net: Log In to SourceForge.net](https://sourceforge.net/auth/subscriptions/)

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [September 22, 2019, 9:01pm UTC](https://forums.freertos.org/t/identifier-systemcoreclock-is-undefined/8071/6 "2019-09-22T21:01:46Z")

</div>

**[manua](https://sourceforge.net/u/manua/)** wrote on [Sunday, September 22, 2019](https://sourceforge.net/p/freertos/discussion/382005/thread/3ea8098e9f/#de26/7391/d37e):

Hi Gaurav, Richard,

I have the variable in system\_stm32f30x.c in my existing test project  
uint32\_t SystemCoreClock = 72000000;

In FreeRTOSConfig.h, I see the following:

#define configCPU\_CLOCK\_HZ ( SystemCoreClock )

Wondered whether manually copy-paste would be the right option.  
Or whether anything else was intended in the first place

Being new to FreeRTOS, thought the best would be to ask.

Thanks,  
Manu

On Mon, Sep 23, 2019 at 1:50 AM Gaurav Aggarwal  
[aggarg-aws@users.sourceforge.net](mailto:aggarg-aws@users.sourceforge.net) wrote:

> The variable SystemCoreClock is exported from stm32 system file which usually contains SystemInit and SystemCoreClockUpdate functions. For STM32F334, it should be called system\_stm32f3xx.c.
> 
> You can use STM32CubeMX to generate a MDK5 project for STM32F334 which can be used a starting point.
> 
> Thanks.
> 
> * * *
> 
> identifier “SystemCoreClock” is undefined
> 
> * * *
> 
> Sent from [sourceforge.net](http://sourceforge.net) because you indicated interest in [SourceForge.net: Log In to SourceForge.net](https://sourceforge.net/p/freertos/discussion/382005/)
> 
> To unsubscribe from further messages, please visit [SourceForge.net: Log In to SourceForge.net](https://sourceforge.net/auth/subscriptions/)

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [September 22, 2019, 9:05pm UTC](https://forums.freertos.org/t/identifier-systemcoreclock-is-undefined/8071/7 "2019-09-22T21:05:28Z")

</div>

**[manua](https://sourceforge.net/u/manua/)** wrote on [Sunday, September 22, 2019](https://sourceforge.net/p/freertos/discussion/382005/thread/3ea8098e9f/#de26/4b4a/e6d5):

Hi Richard,

On Mon, Sep 23, 2019 at 1:50 AM Richard Barry  
[rtel@users.sourceforge.net](mailto:rtel@users.sourceforge.net) wrote:

> SystemCoreClock is the name of a variable used by CMSIS header files.  
> If you are using a CMSIS header file for your chip it should be defined  
> in there, and including the CMSIS header file from within  
> FreeRTOSConfig.h will fix the issue. Otherwise manually edit  
> FreeRTOSConfig.h to replace the reference to SystemCoreClock with  
> whatever clock speed is used to feed the SysTick timer on your device -  
> the configCPU\_CLOCK\_HZ parameter is the one to set.

Tried manually editing the variable in FreeRTOSConfig.h, but that does  
not appear to make any changes

//#define configCPU\_CLOCK\_HZ ( SystemCoreClock )  
#define configCPU\_CLOCK\_HZ ( ( unsigned long ) 72000000 )

The same error persists.

Wonder, what I am doing wrong …

Thanks,  
Manu

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [September 22, 2019, 9:06pm UTC](https://forums.freertos.org/t/identifier-systemcoreclock-is-undefined/8071/8 "2019-09-22T21:06:58Z")

</div>

**[manua](https://sourceforge.net/u/manua/)** wrote on [Sunday, September 22, 2019](https://sourceforge.net/p/freertos/discussion/382005/thread/3ea8098e9f/#de26/4b4a/a769):

Hi Richard,

I am using the STM32F3348-Discovery-FW\_V1.0.0 firmware package,  
which is centered around the STM32F30x\_StdPeriph\_Driver package.

The variable’s defined in the system\_stm32f30x.c file

The initial thought was whether something else to be done, without  
manually editing the file and hence the question in the first place.

Thanks,  
Manu

On Mon, Sep 23, 2019 at 1:50 AM Richard Barry  
[rtel@users.sourceforge.net](mailto:rtel@users.sourceforge.net) wrote:

> SystemCoreClock is the name of a variable used by CMSIS header files.  
> If you are using a CMSIS header file for your chip it should be defined  
> in there, and including the CMSIS header file from within  
> FreeRTOSConfig.h will fix the issue. Otherwise manually edit  
> FreeRTOSConfig.h to replace the reference to SystemCoreClock with  
> whatever clock speed is used to feed the SysTick timer on your device -  
> the configCPU\_CLOCK\_HZ parameter is the one to set.
> 
> * * *
> 
> identifier “SystemCoreClock” is undefined
> 
> * * *
> 
> Sent from [sourceforge.net](http://sourceforge.net) because you indicated interest in [SourceForge.net: Log In to SourceForge.net](https://sourceforge.net/p/freertos/discussion/382005/)
> 
> To unsubscribe from further messages, please visit [SourceForge.net: Log In to SourceForge.net](https://sourceforge.net/auth/subscriptions/)

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [September 22, 2019, 9:07pm UTC](https://forums.freertos.org/t/identifier-systemcoreclock-is-undefined/8071/9 "2019-09-22T21:07:16Z")

</div>

**[aggarg-aws](https://sourceforge.net/u/aggarg-aws/)** wrote on [Sunday, September 22, 2019](https://sourceforge.net/p/freertos/discussion/382005/thread/3ea8098e9f/#de26/6cb2/9774/2de4):

> > What I did was download FreeRTOS 10.2.1 and then extract the relevant  
> > files into MDK5.

This should work. I just provided that project so that you can see which file is exporting the variable.

Thanks.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [September 22, 2019, 9:14pm UTC](https://forums.freertos.org/t/identifier-systemcoreclock-is-undefined/8071/10 "2019-09-22T21:14:39Z")

</div>

**[manua](https://sourceforge.net/u/manua/)** wrote on [Sunday, September 22, 2019](https://sourceforge.net/p/freertos/discussion/382005/thread/3ea8098e9f/#de26/6cb2/9774/2de4/c54e):

On Mon, Sep 23, 2019 at 2:37 AM Gaurav Aggarwal  
[aggarg-aws@users.sourceforge.net](mailto:aggarg-aws@users.sourceforge.net) wrote:

> What I did was download FreeRTOS 10.2.1 and then extract the relevant  
> files into MDK5.
> 
> This should work. I just provided that project so that you can see which file is exporting the variable.

Tried manually editing FreeRTOSConfig.h. But that did not work. Same  
build error.

Attaching the project in here.

Thanks,  
Manu

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [September 22, 2019, 9:22pm UTC](https://forums.freertos.org/t/identifier-systemcoreclock-is-undefined/8071/11 "2019-09-22T21:22:42Z")

</div>

**[aggarg-aws](https://sourceforge.net/u/aggarg-aws/)** wrote on [Sunday, September 22, 2019](https://sourceforge.net/p/freertos/discussion/382005/thread/3ea8098e9f/#de26/6cb2/9774/2de4/c54e/586d):

The project you shared does not build because of some hardcoded paths referring to non-existent folder D:\STM32\_CMSIS.

Which FreeRTOSConfig.h is your project using and which one are you updating? The only FreeRTOSConfig.h I see in the attachment is in the folder 01\_Blinky\FreeRTOS\include which is not edited.

Thanks.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [September 22, 2019, 9:38pm UTC](https://forums.freertos.org/t/identifier-systemcoreclock-is-undefined/8071/12 "2019-09-22T21:38:38Z")

</div>

**[manua](https://sourceforge.net/u/manua/)** wrote on [Sunday, September 22, 2019](https://sourceforge.net/p/freertos/discussion/382005/thread/3ea8098e9f/#de26/6cb2/9774/2de4/c54e/586d/a5ec):

On Mon, Sep 23, 2019 at 2:52 AM Gaurav Aggarwal  
[aggarg-aws@users.sourceforge.net](mailto:aggarg-aws@users.sourceforge.net) wrote:

> The project you shared does not build because of some hardcoded paths referring to non-existent folder D:\STM32\_CMSIS.
> 
> Which FreeRTOSConfig.h is your project using and which one are you updating? The only FreeRTOSConfig.h I see in the attachment is in the folder 01\_Blinky\FreeRTOS\include which is not edited.

I have the std peripheral lib (en.stsw-stm32148.zip) is extracted to

D:\STM32\_CMSIS\STM32F3348-Discovery\_FW\_V1.0.0\

The changes to FreeRTOSConfig.h, I did revert, seeing no difference in  
the build error and hence.

the one FreeRTOSConfig.g, that I have is in:  
01\_Blinky\FreeRTOS\include\FreeRTOSConfig.h

Thanks,  
Manu

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [September 22, 2019, 9:59pm UTC](https://forums.freertos.org/t/identifier-systemcoreclock-is-undefined/8071/13 "2019-09-22T21:59:56Z")

</div>

**[aggarg-aws](https://sourceforge.net/u/aggarg-aws/)** wrote on [Sunday, September 22, 2019](https://sourceforge.net/p/freertos/discussion/382005/thread/3ea8098e9f/#de26/6cb2/9774/2de4/c54e/586d/a5ec/5fd4):

The header search path for your project is configured to D:\FreeRTOS\include and I suspect there is a FreeRTOSConfig.h in D:\FreeRTOS\include which is being picked up by the preprocessor.

I updated the header search paths to the following:

```auto
.\FreeRTOS\include
.\FreeRTOS\portable\RVDS\ARM_CM4F

```

In addition, I needed to comment out the SysTick\_Handler in Blinky.c to get rid of multiple definition error:

```auto
/*void SysTick_Handler(void)
{
	if (sys.delay != 0)
		sys.delay--;

	sys.ticks++;
}*/

```

Also, I changed the following defines to avoid missing hook functions linker errors:

```auto
#define configUSE_IDLE_HOOK 0
#define configUSE_TICK_HOOK 0
#define configCHECK_FOR_STACK_OVERFLOW	0
#define configUSE_MALLOC_FAILED_HOOK	0

```

After the above changes, the project builds for me.

Thanks.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [September 22, 2019, 10:43pm UTC](https://forums.freertos.org/t/identifier-systemcoreclock-is-undefined/8071/14 "2019-09-22T22:43:07Z")

</div>

**[manua](https://sourceforge.net/u/manua/)** wrote on [Sunday, September 22, 2019](https://sourceforge.net/p/freertos/discussion/382005/thread/3ea8098e9f/#de26/6cb2/9774/2de4/c54e/586d/a5ec/5fd4/651f):

On Mon, Sep 23, 2019 at 3:30 AM Gaurav Aggarwal  
[aggarg-aws@users.sourceforge.net](mailto:aggarg-aws@users.sourceforge.net) wrote:

> The header search path for your project is configured to D:\FreeRTOS\include and I suspect there is a FreeRTOSConfig.h in D:\FreeRTOS\include which is being picked up by the preprocessor.
> 
> I updated the header search paths to the following:
> 
> .\FreeRTOS\include  
> .\FreeRTOS\portable\RVDS\ARM\_CM4F
> 
> In addition, I needed to comment out the SysTick\_Handler in Blinky.c to get rid of multiple definition error:
> 
> /\*void SysTick\_Handler(void)  
> {  
> if (sys.delay != 0)  
> sys.delay–;
> 
> ```
> sys.ticks++;
> 
> ```
> 
> }\*/
> 
> Also, I changed the following defines to avoid missing hook functions linker errors:
> 
> #define configUSE\_IDLE\_HOOK 0  
> #define configUSE\_TICK\_HOOK 0  
> #define configCHECK\_FOR\_STACK\_OVERFLOW 0  
> #define configUSE\_MALLOC\_FAILED\_HOOK 0
> 
> After the above changes, the project builds for me.

The project now builds. Thanks!

I added task.h to Blinky.c, but then I get a red X mark next to the  
header include path, which states that it needs the FreeRTOS.h header.

But when the FreeRTOS.h header is included, I see the red X mark next  
to FreeRTOS.h which states:  
error in include chain (portmacro.h): use of undeclared label ‘basepri’

The build does complete though without any warning or errors though,  
Quite weird though.

Did try the delay implementation from FreeRTOS as in

> **[This page describes the RTOS vTaskDelay() FreeRTOS API function which is part...](https://www.freertos.org/a00127.html)**
>
> FreeRTOS is an open source, small footprint RTOS for microcontrollers. This page describes the vTaskDelay() FreeRTOS API function which is part of the RTOS task control API.

There’s something wrong with the delay, I guess ?

Thanks,  
Manu

/\*\*

- Blinky example
- Blinks LED @1Hz on PB.6  
\*/

#include \<stm32f30x.h\>  
#include \<stm32f30x\_rcc.h\>  
#include \<stm32f30x\_conf.h\>

#include \<FreeRTOS.h\>  
#include “task.h”

int main(void)  
{  
GPIO\_InitTypeDef gpio\_state;  
const TickType\_t xDelay = 500 / portTICK\_PERIOD\_MS;

```
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOB, ENABLE); /*

```

Enable the GPIO\_LED Clock \*/

```
/* Configure the GPIO_LED pin */
gpio_state.GPIO_Pin = GPIO_Pin_6; /* Pin 6 */
gpio_state.GPIO_Mode = GPIO_Mode_OUT;
gpio_state.GPIO_OType = GPIO_OType_PP; /* Push Pull

```

Output _/  
gpio\_state.GPIO\_PuPd = GPIO\_PuPd\_NOPULL; /_ No  
Pullup \*/  
gpio\_state.GPIO\_Speed = GPIO\_Speed\_50MHz;

```
GPIO_Init(GPIOB, &gpio_state); /* Port B */

while (1) {
    GPIOB->ODR ^= GPIO_Pin_6;
    vTaskDelay(xDelay);
}

```

}

---

<div class="post-metadata">

**Author:** ![rtel](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/rtel/32/31_2.png) [@rtel](https://forums.freertos.org/u/rtel)\
**Post date:** [September 23, 2019, 2:34am UTC](https://forums.freertos.org/t/identifier-systemcoreclock-is-undefined/8071/15 "2019-09-23T02:34:16Z")

</div>

**[rtel](https://sourceforge.net/u/rtel/)** wrote on [Monday, September 23, 2019](https://sourceforge.net/p/freertos/discussion/382005/thread/3ea8098e9f/#de26/6cb2/9774/2de4/c54e/586d/a5ec/5fd4/651f/d072):

If I am reading your code correctly then you are attempting to use a  
scheduler API function without first starting the scheduler running. I  
would highly recommend starting with some of the pre-configured examples  
and reading through the free book download available on  
[https://www.freertos.org/Documentation](https://www.freertos.org/Documentation)

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [September 23, 2019, 9:01am UTC](https://forums.freertos.org/t/identifier-systemcoreclock-is-undefined/8071/16 "2019-09-23T09:01:41Z")

</div>

**[manua](https://sourceforge.net/u/manua/)** wrote on [Monday, September 23, 2019](https://sourceforge.net/p/freertos/discussion/382005/thread/3ea8098e9f/#de26/6cb2/9774/2de4/c54e/586d/a5ec/5fd4/651f/d072/3095):

On Mon, Sep 23, 2019 at 8:04 AM Richard Barry  
[rtel@users.sourceforge.net](mailto:rtel@users.sourceforge.net) wrote:

> If I am reading your code correctly then you are attempting to use a  
> scheduler API function without first starting the scheduler running. I  
> would highly recommend starting with some of the pre-configured examples  
> and reading through the free book download available on  
> [Free RTOS Book and Reference Manual](https://www.freertos.org/Documentation)

Ahh… Without a task, I’ve been delaying the task!

Changed my code, but 2 issues still remain for me to move ahead.

/\*\*

- Blinky example
- Blinks LED @1Hz on PB.6  
\*/

#include \<stm32f30x.h\>  
#include \<stm32f30x\_rcc.h\>  
#include \<stm32f30x\_conf.h\>

#include \<FreeRTOS.h\>  
#include “task.h”

void HardFault\_Handler(unsigned int \*hardfault\_args, unsigned int r4,  
unsigned int r5, unsigned int r6)  
{

```
while (1);

```

}

void task\_led(void \*params)  
{  
while(1) {  
GPIOB-\>ODR ^= GPIO\_Pin\_6;  
vTaskDelay(500 / portTICK\_RATE\_MS);  
}  
}

int main(void)  
{  
GPIO\_InitTypeDef gpio\_state;

```
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOB, ENABLE); /*

```

Enable the GPIO\_LED Clock \*/

```
/* Configure the GPIO_LED pin */
gpio_state.GPIO_Pin = GPIO_Pin_6; /* Pin 6 */
gpio_state.GPIO_Mode = GPIO_Mode_OUT;
gpio_state.GPIO_OType = GPIO_OType_PP; /* Push Pull

```

Output _/  
gpio\_state.GPIO\_PuPd = GPIO\_PuPd\_NOPULL; /_ No  
Pullup \*/  
gpio\_state.GPIO\_Speed = GPIO\_Speed\_50MHz;

```
GPIO_Init(GPIOB, &gpio_state); /* Port B */

xTaskCreate(task_led, "LED", 512, NULL, 1, NULL);
vTaskStartScheduler();

```

}

Changing the code, I had to modify the Heap size in addition to the  
previous changes suggested by Gaurav;  
in FreeRTOSConfig.h changed :

//#define configTOTAL\_HEAP\_SIZE ( ( size\_t ) ( 75 \* 1024 ) )  
#define configTOTAL\_HEAP\_SIZE ( ( size\_t ) (9 \* 1024 ) )  
/\* F334 has 12k + 4k SRAM \*/

With that change, the build goes ahead.

#1. The MDK5 complains about FreeRTOS.h not found.  
(It looks odd, but the build goes ahead without errors or warnings.  
I would nevertheless like to fix this issue, though. Does not look nice.)  
Attached screenshot. The same issues exists with port.c as well,  
wherever FreeRTOS.h  
header is included.

Is it possible to fix this issue ? (It’s cosmetic though, but feels  
like an irritant)

#2. With the change to TOTAL HEAP SIZE I can see task\_led being executed.  
The TOTAL\_HEAP\_SIZE value that appears to work is between (5 \* 1024)  
and (9 \* 1024)  
Anything smaller than 5k does not work and anything greater than 9k  
does not work.

a) Does that mean that FreeRTOS Kernel is consuming 5k ?  
b) the F334 has about 12k SRAM, I should be able to use it as well ?

Thanks,

---

<div class="post-metadata">

**Author:** ![rtel](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/rtel/32/31_2.png) [@rtel](https://forums.freertos.org/u/rtel)\
**Post date:** [September 23, 2019, 1:24pm UTC](https://forums.freertos.org/t/identifier-systemcoreclock-is-undefined/8071/17 "2019-09-23T13:24:07Z")

</div>

**[rtel](https://sourceforge.net/u/rtel/)** wrote on [Monday, September 23, 2019](https://sourceforge.net/p/freertos/discussion/382005/thread/3ea8098e9f/#de26/6cb2/9774/2de4/c54e/586d/a5ec/5fd4/651f/d072/3095/f318):

Please read the book as per the link in my previous post - it describes  
how RAM is used - you can also check this FAQ  
[https://www.freertos.org/FAQMem.html](https://www.freertos.org/FAQMem.html) - I could repeat the information  
here but prefer just to link you to where the information is already  
available.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [September 23, 2019, 3:06pm UTC](https://forums.freertos.org/t/identifier-systemcoreclock-is-undefined/8071/18 "2019-09-23T15:06:56Z")

</div>

**[manua](https://sourceforge.net/u/manua/)** wrote on [Monday, September 23, 2019](https://sourceforge.net/p/freertos/discussion/382005/thread/3ea8098e9f/#de26/6cb2/9774/2de4/c54e/586d/a5ec/5fd4/651f/d072/3095/f318/19e9):

Thanks for the link. The documentation is quite clear and detailed.

Any thoughts, how I can fix the Header issue ?  
AFAICS, the path to the FreeRTOS.h header does exist.

Maybe I’m just blind, that I cant see what the problem is in the first place.

Thanks,

On Mon, Sep 23, 2019 at 6:54 PM Richard Barry  
[rtel@users.sourceforge.net](mailto:rtel@users.sourceforge.net) wrote:

> Please read the book as per the link in my previous post - it describes  
> how RAM is used - you can also check this FAQ  
> [FreeRTOS FAQ relating to FreeRTOS memory management and usage. FreeRTOS is an Open Source RTOS Kernel for small embedded systems](https://www.freertos.org/FAQMem.html) - I could repeat the information  
> here but prefer just to link you to where the information is already  
> available.
> 
> * * *
> 
> identifier “SystemCoreClock” is undefined
> 
> * * *
> 
> Sent from [sourceforge.net](http://sourceforge.net) because you indicated interest in [SourceForge.net: Log In to SourceForge.net](https://sourceforge.net/p/freertos/discussion/382005/)
> 
> To unsubscribe from further messages, please visit [SourceForge.net: Log In to SourceForge.net](https://sourceforge.net/auth/subscriptions/)

---

<div class="post-metadata">

**Author:** ![rtel](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/rtel/32/31_2.png) [@rtel](https://forums.freertos.org/u/rtel)\
**Post date:** [September 23, 2019, 3:14pm UTC](https://forums.freertos.org/t/identifier-systemcoreclock-is-undefined/8071/19 "2019-09-23T15:14:27Z")

</div>

**[rtel](https://sourceforge.net/u/rtel/)** wrote on [Monday, September 23, 2019](https://sourceforge.net/p/freertos/discussion/382005/thread/3ea8098e9f/#de26/6cb2/9774/2de4/c54e/586d/a5ec/5fd4/651f/d072/3095/f318/19e9/f065):

It does not look like a compiler issue to me - as you said the code  
builds just fine - most likely the editor is trying to parse your code  
in an attempt to be helpful and just getting it wrong. Eclipse is  
notorious for this and from your screenshot it looks like Keil is doing  
likewise. Your options are to a) ignore it, b) search the options to  
turn the feature off, c) search the options to try and tune it up so it  
gets it right.
