# Getting compilation error in demo application of CORTEX\_MPS2\_QEMU\_IAR\_GCC

**URL:** <https://forums.freertos.org/t/getting-compilation-error-in-demo-application-of-cortex-mps2-qemu-iar-gcc/16445>\
**Category:** Libraries\
**Created:** [December 22, 2022, 10:23am UTC](https://forums.freertos.org/t/getting-compilation-error-in-demo-application-of-cortex-mps2-qemu-iar-gcc/16445 "2022-12-22T10:23:25Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![soumyaims](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/soumyaims/32/3069_2.png) [@soumyaims](https://forums.freertos.org/u/soumyaims)\
**Post date:** [December 22, 2022, 10:23am UTC](https://forums.freertos.org/t/getting-compilation-error-in-demo-application-of-cortex-mps2-qemu-iar-gcc/16445/1 "2022-12-22T10:23:25Z")

</div>

I am using the Freertos v202112.00. While compiling the standalone demo project of CORTEX\_MPS2\_QEMU\_IAR\_GCC, I am getting compilation error because freertos.h ,task.h included in main.c but don’t have these two files in the package of CORTEX\_MPS2\_QEMU\_IAR\_GCC. Even SMM\_MPS2.h file is missing, which is being included in IntQueueTimer.c

---

<div class="post-metadata">

**Author:** ![aggarg](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/aggarg/32/4245_2.png) [@aggarg](https://forums.freertos.org/u/aggarg)\
**Post date:** [December 22, 2022, 10:54am UTC](https://forums.freertos.org/t/getting-compilation-error-in-demo-application-of-cortex-mps2-qemu-iar-gcc/16445/2 "2022-12-22T10:54:18Z")

</div>

Are you compiling the provided project itself or did you make changes to it? Can you share the compiler output? Any reason for not using the latest version?

---

<div class="post-metadata">

**Author:** ![soumyaims](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/soumyaims/32/3069_2.png) [@soumyaims](https://forums.freertos.org/u/soumyaims)\
**Post date:** [January 5, 2023, 11:16am UTC](https://forums.freertos.org/t/getting-compilation-error-in-demo-application-of-cortex-mps2-qemu-iar-gcc/16445/3 "2023-01-05T11:16:36Z")

</div>

I downloaded FreeRTOSv202112.00. In that I am trying to build the Demo project : CORTEX\_MPS2\_QEMU\_IAR\_GCC on VS code. I am getting the compilation error as

```auto
[{
	"resource": "/d:/New_Project/latest_freertos/Richard/FreeRTOS-main/FreeRTOS/Demo/CORTEX_MPS2_QEMU_IAR_GCC/main.c",
	"owner": "C/C++",
	"code": "1696",
	"severity": 8,
	"message": "cannot open source file \"FreeRTOS.h\"",
	"source": "C/C++",
	"startLineNumber": 50,
	"startColumn": 1,
	"endLineNumber": 50,
	"endColumn": 22
},{
	"resource": "/d:/New_Project/latest_freertos/Richard/FreeRTOS-main/FreeRTOS/Demo/CORTEX_MPS2_QEMU_IAR_GCC/main.c",
	"owner": "C/C++",
	"code": "1696",
	"severity": 8,
	"message": "cannot open source file \"task.h\"",
	"source": "C/C++",
	"startLineNumber": 51,
	"startColumn": 1,
	"endLineNumber": 51,
	"endColumn": 18
}]

```

In that it is missing FreeRTOS.h and task.h file. Please let me know how to resolve this compilation error of this demo application.

---

<div class="post-metadata">

**Author:** ![aggarg](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/aggarg/32/4245_2.png) [@aggarg](https://forums.freertos.org/u/aggarg)\
**Post date:** [January 6, 2023, 9:26am UTC](https://forums.freertos.org/t/getting-compilation-error-in-demo-application-of-cortex-mps2-qemu-iar-gcc/16445/4 "2023-01-06T09:26:54Z")

</div>

Are you trying to do that on a Windows machine? If so, can you first try if you are able to build using the make command?

---

<div class="post-metadata">

**Author:** ![soumyaims](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/soumyaims/32/3069_2.png) [@soumyaims](https://forums.freertos.org/u/soumyaims)\
**Post date:** [January 6, 2023, 12:35pm UTC](https://forums.freertos.org/t/getting-compilation-error-in-demo-application-of-cortex-mps2-qemu-iar-gcc/16445/5 "2023-01-06T12:35:04Z")

</div>

As per the procedure, it is getting imported in VS code and I am building the cortex\_Mps2\_QEMU\_IAR\_GCC project. I launch the vs code and tried to build . I am getting FreeRTOS.h and task.h is missing in the project. It is having the make file too. Else please provide me a demo application for cortex\_MPS2\_QEMU\_IAR\_GCC.

---

<div class="post-metadata">

**Author:** ![aggarg](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/aggarg/32/4245_2.png) [@aggarg](https://forums.freertos.org/u/aggarg)\
**Post date:** [January 6, 2023, 1:32pm UTC](https://forums.freertos.org/t/getting-compilation-error-in-demo-application-of-cortex-mps2-qemu-iar-gcc/16445/6 "2023-01-06T13:32:54Z")

</div>

What is the Operating System running on the machine on which you are running VSCode? It is Linux (such as Ubuntu) or Microsoft Windows?

Also, can you share the complete output in the _Terminal_ tab (not in the _Problems_ tab)?

---

<div class="post-metadata">

**Author:** ![aggarg](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/aggarg/32/4245_2.png) [@aggarg](https://forums.freertos.org/u/aggarg)\
**Post date:** [January 8, 2023, 11:03am UTC](https://forums.freertos.org/t/getting-compilation-error-in-demo-application-of-cortex-mps2-qemu-iar-gcc/16445/7 "2023-01-08T11:03:54Z")

</div>

I started from a fresh Ubuntu 22.04 instance and I was able to make it work. After installations, here are the commands and outputs -

```auto
$ arm-none-eabi-gcc --version
arm-none-eabi-gcc (Arm GNU Toolchain 12.2.Rel1 (Build arm-12.24)) 12.2.1 20221205
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ arm-none-eabi-gdb --version
GNU gdb (Arm GNU Toolchain 12.2.Rel1 (Build arm-12.24)) 12.1.90.20221210-git
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

$ make --version
GNU Make 4.3
Built for x86_64-pc-linux-gnu
Copyright (C) 1988-2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

$ qemu-system-arm --version
QEMU emulator version 6.2.0 (Debian 1:6.2+dfsg-2ubuntu6.6)
Copyright (c) 2003-2021 Fabrice Bellard and the QEMU Project developers

$ whereis arm-none-eabi-gdb
arm-none-eabi-gdb: /home/ubuntu/softwares/arm-gnu-toolchain-12.2.rel1-x86_64-arm-none-eabi/bin/arm-none-eabi-gdb

$ git diff
diff --git a/FreeRTOS/Demo/CORTEX_MPS2_QEMU_IAR_GCC/.vscode/launch.json b/FreeRTOS/Demo/CORTEX_MPS2_QEMU_IAR_GCC/.vscode/launch.json
index ca2d87d64..1fd73b225 100644
--- a/FreeRTOS/Demo/CORTEX_MPS2_QEMU_IAR_GCC/.vscode/launch.json
+++ b/FreeRTOS/Demo/CORTEX_MPS2_QEMU_IAR_GCC/.vscode/launch.json
@@ -10,7 +10,7 @@
             "request": "launch",
             "program": "${workspaceFolder}/build/gcc/output/RTOSDemo.out",
             "cwd": "${workspaceFolder}",
- "miDebuggerPath": "/Applications/ARM/bin/arm-none-eabi-gdb-py",
+ "miDebuggerPath": "/home/ubuntu/softwares/arm-gnu-toolchain-12.2.rel1-x86_64-arm-none-eabi/bin/arm-none-eabi-gdb",
             "miDebuggerServerAddress": "localhost:1234",
             "stopAtEntry": true,
             "preLaunchTask": "Run QEMU"

```

I stumbled upon the following 2 issues, which may be of help to you as well -

1. I needed to install Python3.8 by building from source as it is needed by `arm-none-eabi-gdb`. The default version was 3.11.
2. I needed to add the following lines in VSCode settings.json so that VSCode tasks pick the PATH variable in my bashrc and find `arm-none-eabi-*` binaries -

```auto
{
    "terminal.integrated.automationProfile.linux": {
    "args": ["-i"],
    "path": "/usr/bin/bash"
    }
}

```

Thanks.

---

<div class="post-metadata">

**Author:** ![soumyaims](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/soumyaims/32/3069_2.png) [@soumyaims](https://forums.freertos.org/u/soumyaims)\
**Post date:** [January 9, 2023, 6:26am UTC](https://forums.freertos.org/t/getting-compilation-error-in-demo-application-of-cortex-mps2-qemu-iar-gcc/16445/8 "2023-01-09T06:26:36Z")

</div>

Thank you so much for your response. I am using Windows 10. On that I am using the visual studio code.

Microsoft Windows [Version 10.0.19045.2364]  
(c) Microsoft Corporation. All rights reserved.

```auto
C:\Users\DELL>arm-none-eabi-gcc --version
arm-none-eabi-gcc (GNU Arm Embedded Toolchain 10.3-2021.10) 10.3.1 20210824 (release)
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

C:\Users\DELL>

C:\Users\DELL>make --version
GNU Make 4.3
Built for Windows32
Copyright (C) 1988-2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

C:\Users\DELL>

```

I have installed the GNU ARM Embedded Toolchain on my windows system. Above is the console of the cmd.

The compilation error of demo CORTEX\_MPS2\_QEMU\_IAR\_GCC on VS code 🙂

```auto
[{
	"resource": "/d:/New_Project/latest_freertos/Richard/FreeRTOS-main/FreeRTOS/Demo/CORTEX_MPS2_QEMU_IAR_GCC/main.c",
	"owner": "C/C++",
	"code": "1696",
	"severity": 8,
	"message": "cannot open source file \"FreeRTOS.h\"",
	"source": "C/C++",
	"startLineNumber": 50,
	"startColumn": 1,
	"endLineNumber": 50,
	"endColumn": 22
}]

[{
	"resource": "/d:/New_Project/latest_freertos/Richard/FreeRTOS-main/FreeRTOS/Demo/CORTEX_MPS2_QEMU_IAR_GCC/main.c",
	"owner": "C/C++",
	"code": "1696",
	"severity": 8,
	"message": "cannot open source file \"task.h\"",
	"source": "C/C++",
	"startLineNumber": 51,
	"startColumn": 1,
	"endLineNumber": 51,
	"endColumn": 18
}]

```

---

<div class="post-metadata">

**Author:** ![aggarg](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/aggarg/32/4245_2.png) [@aggarg](https://forums.freertos.org/u/aggarg)\
**Post date:** [January 9, 2023, 10:41am UTC](https://forums.freertos.org/t/getting-compilation-error-in-demo-application-of-cortex-mps2-qemu-iar-gcc/16445/9 "2023-01-09T10:41:36Z")

</div>

Can you change your default profile of VSCode terminal to `Command Prompt` or `Power Shell` - [Terminal Profiles in Visual Studio Code](https://code.visualstudio.com/docs/terminal/profiles)

I tried with Power Shell and it worked for me.

> [@aggarg](#):
>
> `qemu-system-arm --version`

Have you installed `qemu-system-arm` also? You’ll need that for running the demo.

---

<div class="post-metadata">

**Author:** ![soumyaims](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/soumyaims/32/3069_2.png) [@soumyaims](https://forums.freertos.org/u/soumyaims)\
**Post date:** [January 9, 2023, 11:52am UTC](https://forums.freertos.org/t/getting-compilation-error-in-demo-application-of-cortex-mps2-qemu-iar-gcc/16445/10 "2023-01-09T11:52:07Z")

</div>

I installed the QEMU. Here it is

C:\Program Files\qemu\>qemu-system-arm --version  
QEMU emulator version 7.1.94 (v7.2.0-rc4-11947-g2dabd50cfb-dirty)  
Copyright (c) 2003-2022 Fabrice Bellard and the QEMU Project developers

C:\Program Files\qemu\>

As of now I am getting compilation error.Because in file main.c of cortex\_mps2\_qemu\_iar\_gcc having freertos.h and task.h. But in the entire workspace, these two headers are missing.

Console output 🙂

tempCodeRunnerFile.c:1:18: fatal error: task.h: No such file or directory  
#include “task.h”  
^  
compilation terminated.

[Done] exited with code=1 in 2.35 seconds

---

<div class="post-metadata">

**Author:** ![aggarg](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/aggarg/32/4245_2.png) [@aggarg](https://forums.freertos.org/u/aggarg)\
**Post date:** [January 9, 2023, 11:57am UTC](https://forums.freertos.org/t/getting-compilation-error-in-demo-application-of-cortex-mps2-qemu-iar-gcc/16445/11 "2023-01-09T11:57:26Z")

</div>

> [@soumyaims](#):
>
> But in the entire workspace, these two headers are missing.

Are you saying that these files do not exist at this location - `FreeRTOS/Source/include`? Is yes, have you cloned sub-modules?

---

<div class="post-metadata">

**Author:** ![soumyaims](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/soumyaims/32/3069_2.png) [@soumyaims](https://forums.freertos.org/u/soumyaims)\
**Post date:** [January 9, 2023, 12:02pm UTC](https://forums.freertos.org/t/getting-compilation-error-in-demo-application-of-cortex-mps2-qemu-iar-gcc/16445/12 "2023-01-09T12:02:07Z")

</div>

These two headers exists in FreeRTOS/Source/include but it doesn’t exists in \FreeRTOSv202112.00\FreeRTOS\Demo\CORTEX\_MPS2\_QEMU\_IAR\_GCC. I directly imported this folder on VS code and started to build.Hence it didn’t find these two files.

---

<div class="post-metadata">

**Author:** ![aggarg](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/aggarg/32/4245_2.png) [@aggarg](https://forums.freertos.org/u/aggarg)\
**Post date:** [January 9, 2023, 12:03pm UTC](https://forums.freertos.org/t/getting-compilation-error-in-demo-application-of-cortex-mps2-qemu-iar-gcc/16445/13 "2023-01-09T12:03:42Z")

</div>

That is fine. Did you change the profile as I asked?

---

<div class="post-metadata">

**Author:** ![soumyaims](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/soumyaims/32/3069_2.png) [@soumyaims](https://forums.freertos.org/u/soumyaims)\
**Post date:** [January 9, 2023, 12:13pm UTC](https://forums.freertos.org/t/getting-compilation-error-in-demo-application-of-cortex-mps2-qemu-iar-gcc/16445/14 "2023-01-09T12:13:54Z")

</div>

Just now installed powershell. What is the profile I need to set? In down left side , there is one powershell extension, It’s a drop down . Do I need to select powershell from that drop down box?

---

<div class="post-metadata">

**Author:** ![soumyaims](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/soumyaims/32/3069_2.png) [@soumyaims](https://forums.freertos.org/u/soumyaims)\
**Post date:** [January 9, 2023, 12:19pm UTC](https://forums.freertos.org/t/getting-compilation-error-in-demo-application-of-cortex-mps2-qemu-iar-gcc/16445/15 "2023-01-09T12:19:59Z")

</div>

Can I add task.h and freertos.h from FreeRTOS/Source/include into \FreeRTOSv202112.00\FreeRTOS\Demo\CORTEX\_MPS2\_QEMU\_IAR\_GCC?

---

<div class="post-metadata">

**Author:** ![soumyaims](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/soumyaims/32/3069_2.png) [@soumyaims](https://forums.freertos.org/u/soumyaims)\
**Post date:** [January 9, 2023, 12:31pm UTC](https://forums.freertos.org/t/getting-compilation-error-in-demo-application-of-cortex-mps2-qemu-iar-gcc/16445/16 "2023-01-09T12:31:10Z")

</div>

Just now installed powershell. What is the profile I need to set? In down left side , there is one powershell extension, It’s a drop down . Do I need to select powershell from that drop down box?

---

<div class="post-metadata">

**Author:** ![aggarg](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/aggarg/32/4245_2.png) [@aggarg](https://forums.freertos.org/u/aggarg)\
**Post date:** [January 9, 2023, 12:57pm UTC](https://forums.freertos.org/t/getting-compilation-error-in-demo-application-of-cortex-mps2-qemu-iar-gcc/16445/17 "2023-01-09T12:57:32Z")

</div>

> [@soumyaims](#):
>
> What is the profile I need to set? In down left side , there is one powershell extension, It’s a drop down . Do I need to select powershell from that drop down box?

There is a picture on this page which explains this - [Terminal Profiles in Visual Studio Code](https://code.visualstudio.com/docs/terminal/profiles)

> [@soumyaims](#):
>
> Can I add task.h and freertos.h from FreeRTOS/Source/include into \FreeRTOSv202112.00\FreeRTOS\Demo\CORTEX\_MPS2\_QEMU\_IAR\_GCC?

This is not needed.

---

<div class="post-metadata">

**Author:** ![soumyaims](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/soumyaims/32/3069_2.png) [@soumyaims](https://forums.freertos.org/u/soumyaims)\
**Post date:** [January 9, 2023, 1:28pm UTC](https://forums.freertos.org/t/getting-compilation-error-in-demo-application-of-cortex-mps2-qemu-iar-gcc/16445/18 "2023-01-09T13:28:58Z")

</div>

I selected windows powershell. Even as per your above conversation, U have selected windows powershell.The way to select powershell as

## [Windows PowerShell](https://code.visualstudio.com/docs/terminal/profiles#_windows-powershell)

When PowerShell 6+ is installed, Windows PowerShell is not included in the profiles list by default. To add Windows PowerShell as a profile, choose the **Select Default Profile** option in the new terminal dropdown and select the Windows PowerShell item. This will configure the profile and set it as your default.

---

<div class="post-metadata">

**Author:** ![soumyaims](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/soumyaims/32/3069_2.png) [@soumyaims](https://forums.freertos.org/u/soumyaims)\
**Post date:** [January 9, 2023, 1:30pm UTC](https://forums.freertos.org/t/getting-compilation-error-in-demo-application-of-cortex-mps2-qemu-iar-gcc/16445/19 "2023-01-09T13:30:55Z")

</div>

As I selected windows powershell. What is the next step? How to clear this compilation error?

---

<div class="post-metadata">

**Author:** ![soumyaims](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/soumyaims/32/3069_2.png) [@soumyaims](https://forums.freertos.org/u/soumyaims)\
**Post date:** [January 12, 2023, 4:20am UTC](https://forums.freertos.org/t/getting-compilation-error-in-demo-application-of-cortex-mps2-qemu-iar-gcc/16445/20 "2023-01-12T04:20:31Z")

</div>

Thanks to Gaurav for resolving my issue through online.Please close this ticket.

[Next page](https://forums.freertos.org/t/getting-compilation-error-in-demo-application-of-cortex-mps2-qemu-iar-gcc/16445.md?page=2)
