FreeRTOS Win32 simulator C++

Hi,
Using eclipse 2012-12 the win32 port simulator works perfectly. Then I add Nature C++ to eclipse, adjust include path, but it does not links.
Anyone has any suggestion.
Best

Can you share the build log?

Hi Aggarg,

Sorry I did not update the topic. I worked on last night))).
This can be helpfull for people who are not very able to program in C++ like me.
After you add C++ to the demowin32 MingW project, in the menu project Natures,
you should update the include path for C++, and the preprocessor. You can copy from C
language settings. The includes for C++ need some more path, but the compiler tells you which.
Last, the more important which was the reason of my post, in the linker section, libraries section add winmm. Now it links. I made a C++ class with a static thread function, created a thread and everything ok.

Regards

Thank you for reporting back.

Hi,

Please do you know some sample code to write to uart using FreeRTOS Win32 Simulator?

Thanks.

Fortunato Marrelli
HTA s.r.l. - R&D - Software Engineer

This email may contain confidential and/or private information.

You should be able to use this as a reference - FreeRTOS/comm_if_windows.c at main · FreeRTOS/FreeRTOS · GitHub

[EDIT] - Updated link.

Hi,

Yes, I found this but I am not able to understand how this driver is used.

I did not find the caller project.

Best Regards

Fortunato Marrelli
HTA s.r.l. - R&D - Software Engineer

This email may contain confidential and/or private information.

All the projects at this location use this - https://github.com/FreeRTOS/FreeRTOS/tree/main/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator

An example is - https://github.com/FreeRTOS/FreeRTOS/tree/main/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/MQTT_Mutual_Auth_Demo_with_BG96

Note that it is an implementation of comm interface (which is used by our cellular interface) implemented using Windows communication over UART. That is why I said that you should be able to use it as a reference.

Hi,

thank you very much anyway. I tried to run the project but it did not run

a COM Uart, it was a MQTT task and I stopped when it asks some settings which

I do not know.

Have a nice day.

Fortunato Marrelli
HTA s.r.l. - R&D - Software Engineer

This email may contain confidential and/or private information.

Hi @Fortunato,
Please help to configure your setting in cellular_config.h and demo_config.h. (Allow me to take BG96 as example.)

In cellular_config.h, you need to set:

  • CELLULAR_COMM_INTERFACE_PORT
  • CELLULAR_APN

In demo_config.h, you can follow the instructions in Configuring the MQTT Broker Connection to set it up.

Please let us know if you have further question.
BTW, it would be good to have a separate topic for this question since your original problem had been resolved.

Thanks.

Hi,

Ok. It is the Configurating the MQTT broker I did not know what to do. I will check the documentation.

Regards

Fortunato Marrelli
HTA s.r.l. - R&D - Software Engineer

This email may contain confidential and/or private information.

I registered to AWS, it looks like the first step to do.

Thanks

Fortunato Marrelli
HTA s.r.l. - R&D - Software Engineer

This email may contain confidential and/or private information.

Hello Gaurav Aggarwal,

I checked mqtt_mutual_auth_demo_with_bg96 to see how serial com works.

I used directly prvCommIntfOpen,prvCommIntfSend,prvCommIntfReceive,prvCommIntfClose

and looks like it works, I can open the port, send characters and read characters.

Though, I cannot understand how the program works. I provided a receive callback but it is not

working, in particular I have seen this code, it looks like sets interrupts to simulate UARTS interrups.

Could you tell me if there is some detail explanation of the code?

if( commIntRet == IOT_COMM_INTERFACE_SUCCESS )

{

pCellularCommContext->commReceiveCallback = receiveCallback;

commIntRet = prvSetupCommTaskThread( pCellularCommContext );

}

if( commIntRet == IOT_COMM_INTERFACE_SUCCESS )

{

vPortSetInterruptHandler( portINTERRUPT_UART, prvProcessUartInt );

pCellularCommContext->commReceiveCallbackThread =

CreateThread( NULL, 0, prvCellularCommReceiveCBThreadFunc, hComm, 0, NULL );

/* CreateThread return NULL for error. */

if( pCellularCommContext->commReceiveCallbackThread == NULL )

{

LogError( ( “Cellular CreateThread fail %d”, GetLastError() ) );

commIntRet = IOT_COMM_INTERFACE_FAILURE;

}

}

What does Platform_CreateDetachedThread do?

Best Regards

Have a nice day

Fortunato Marrelli
HTA s.r.l. - R&D - Software Engineer

This email may contain confidential and/or private information.

Hi Fortunato,

The comm interface creates a windows thread to wait for the COM port EV_RXCHAR event. FreeRTOS is not aware of this windows thread.

The implementation create another FreeRTOS thread to poll the rxEvent and calls vPortGenerateSimulatedInterrupt in this FreeRTOS thread to handler the interrupt.

This thread is created with Platform_CreateDetachedThread. If this thread is not created properly, the receive callback function won’t be called.

Hello Ching-Hsin Lee,

Thank you very much for the explanation. It’s hard but It helps.

I think I will poll if any characters received without interrupts, when

I will be more confident I will use interrupts. AT this moment infact,

I am not very clear about the mechanism.

Best Regards.

Have a nice weekend

Fortunato Marrelli
HTA s.r.l. - R&D - Software Engineer

This email may contain confidential and/or private information.

Hi CHING-HSIN LEE,

could you please tell me how I can read a text file which is in the windows filesystem

in the WIN32-MingW port?

Best Regards

Fortunato Marrelli
HTA s.r.l. - R&D - Software Engineer

This email may contain confidential and/or private information.

Hi Fortunato,

The file operations in stdio are supported in WIN32-Mingw.
You can reference the demo OTA_pal implementation from this link

Thank you very much.

It really helps.

Best Regards

Fortunato Marrelli
HTA s.r.l. - R&D - Software Engineer

This email may contain confidential and/or private information.

Hi CHING-HSIN LEE

Your reply was perfect.

I can read and write files. Perfect.

Sorry If I make you a new question.

I have to use lwip or something similar to open a socket

And communicate over the ethernet. Could you suggest me again a sample project?

What is the IP address if I need to communicate?

Best Regards

Fortunato Marrelli
HTA s.r.l. - R&D - Software Engineer

This email may contain confidential and/or private information.

Hi @Fortunato,
I’d suggest to use FreeRTOS-Plus-TCP, which is also a TCP-IP stack for socket functionalities.
And you can take below demos as references:

  1. For Linux, refer to this FreeRTOS_Plus_TCP_Echo_Posix.
  2. For Windows, refer to this FreeRTOS_Plus_TCP_Minimal_Windows_Simulator.

Thanks.