Add FreeRTOS CLI

Hello,

Is adding FreeRTOS CLI straightforward? I thought it should be, but actually come across compiling issues after adding the files FreeRTOS_CLI.h and FreeRTOS_CLI.c to the project. It causes lots of symbol in the other folders in the project to become unresolved. Is there anything that really needs attention when adding this module to the project?
Thanks!
Crane

Please post the compiler output so we can see which symbols are unresolved.

These are the symbols that gets unresolved:

Now I know why. It is because the FreeRTOS files are deleted from the project.

But I don’t understand how come they are deleted. What I did was just to add FreeRTOS_CLI.h and FreeRTOS_CLI.c to the project. Now these two files are deleted from the project, but the project doesn’t go back. I need to investigate that. Any possible reasons?

Hi @cranegsh,
Are you using demo directly or building your own project?
The reason files were deleted might be caused by your environment, such as “always re-clone repository before compiling”.

Thanks.

That is the reason of linker errors you are seeing.

If you are using git, it should be as simple as running git checkout -- . .

Thanks Actory for your reply.
I am building my own project.
But I don’t understand why it happens after copying FreeRTOS_CLI.h/c. Never happen before.

Thanks Gaurav!
Yes, I know how to restore the project. But why it happens? Might it happen again if I copy FreeRTOS_CLI.c/h to the project again.

That is hard to guess until you describe the steps you did in detail and preferably with screenshots. Copying a file at some location cannot modify the project file - you must have done something else to modify the project file.

Ok, I will go through the process again to see.

Update with the issue posted.
Somehow the .project file was modified. I didn’t realize how.
Once it is corrected, these compiling errors are gone.

The new issue is:
I copied the demo project file UARTCommandConsole.c to the project. It uses the type xComPortHandle and can’t recognize it.
After searching the FreeRTOS source file, it is defined in serial.h at FreeRTOS/Demo/Common/include. But when I add the head file to the project, it causes some compiling errors as in the below picture:

How should this file serial.h should be included in the project?

Thanks!
Crane

Just adding the location FreeRTOS/Demo/Common/include to your include search paths should be enough.

The errors you shared are compiler errors or just the IDE parser getting confused? Can you share the complete build log?

I want to create a project that is independent to the FreeRTOS source folder and copied everything from FreeRTOS to the project.
Just adding the location gets the exactly same result.
How to tell if they are compiler errors or IDE parser getting confused? Probably the latter one.
Here is the build log.
build log after adding serial.zip (2.4 KB)

I guess the compiler sees two copies of the head file serial.h. But I don’t know why.

Eclipse (or other editors) attempting to parse C code is a constant source of confusion to developers who mistake icons in the editor as compiler issues. You only need to pay attention to the compiler output, which is what you posted in your zip file. That shows real compiler errors, for example,

"../Freertos280049.c", line 57: error #760: variable "uint16_t" is not a type name
"../Freertos280049.c", line 115: error #18: expected a ")"
"../Freertos280049.c", line 115: error #18: expected a ")"
"../Freertos280049.c", line 116: error #18: expected a ")"

Which, without any other context, makes me think uint16_t is not defined in your stdint.h header file.

However, this error is from a file called Freertos280049.c - what is that?

I want to create a project that is independent to the FreeRTOS source folder and copied everything from FreeRTOS to the project.

There is some info on creating a new project here: Creating a new RTOS project

Not fully understand what this statement mean. Can you say more about this?

uint16_t is defined in _stdint.h.

Freertos280049.c is the main file of the project. These errors comes up after serial.h is included in the project. So I assume that this file is not the source of these errors.

Possibly there is a syntactic error in serial.h. You mind sharing it?

This is the first error:

"C:/work/prj-freertos/FreeRTOSv202112.00/FreeRTOS/Demo/Common/include/serial.h", line 90: error #18: expected a ")"

Assuming that copy of serial.h is the same as the head revision in the current git repo, line 90 is:

xComPortHandle xSerialPortInit( eCOMPort ePort,
                                eBaud eWantedBaud,
                                eParity eWantedParity,
                                eDataBits eWantedDataBits,
                                eStopBits eWantedStopBits,
                                unsigned portBASE_TYPE uxBufferLength );

eCOMPort, eBause, eParity, eDataBits, eStopBits and xComPortHandle are defined in the same file, so should not cause a problem. That just leaves portBASE_TYPE - which is used in many places but is only available if you #include FreeRTOS.h first. Can you ensure FreeRTOS.h is included before serial.h (which means before you include the FreeRTOS CLI header files). If you are doing that already the error might be on the line before.

For now, serial.h is directly included form the FreeRTOS source folder. I checked the file date and it is the same as all other files, which means no change has ever been made. There is one line difference from what you posted.

Yes, it is included before serial.h. Here it is.

It is from FreeRTOS in FreeRTOS/Demo/Common/include folder.