Getting compilation error in demo application of CORTEX_MPS2_QEMU_IAR_GCC

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

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?

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

[{
	"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.

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?

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.

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)?

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 -

$ 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 -
    {
        "terminal.integrated.automationProfile.linux": {
        "args": ["-i"],
        "path": "/usr/bin/bash"
        }
    }
    

Thanks.

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.

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 :slight_smile:

[{
	"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
}]

Can you change your default profile of VSCode terminal to Command Prompt or Power Shell - Terminal Profiles in Visual Studio Code

I tried with Power Shell and it worked for me.

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

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 :slight_smile:

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

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

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.

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

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?

Can I add task.h and freertos.h from FreeRTOS/Source/include into \FreeRTOSv202112.00\FreeRTOS\Demo\CORTEX_MPS2_QEMU_IAR_GCC?

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?

There is a picture on this page which explains this - Terminal Profiles in Visual Studio Code

This is not needed.

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

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.

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

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