Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » 4DIAC - Framework for Distributed Industrial Automation and Control » About FreeRTOS (when FreeRTOS release? )
About FreeRTOS [message #1805596] Thu, 18 April 2019 12:07 Go to next message
cyt tpl is currently offline cyt tplFriend
Messages: 8
Registered: April 2019
Junior Member
Firstly I congratulation for you delevloped 4diac, open source runtime and plc programming ide.

I use STM32F746 discovery kit which includes ethernet. Also I did run freeRTOS and lwip on STM32F76 board.

I try to compile 4diac for freertos+lwip until now I did not success. Some errors like this:

"[100%] Linking CXX executable forte"
exit.c:(.text.exit+0x2c): undefined reference to `_exit'
CMakeFiles/forte.dir/arch/freeRTOS/main.cpp.obj: In function `forte_malloc(unsigned int)':
main.cpp:(.text._Z12forte_mallocj[_Z12forte_mallocj]+0xa): undefined reference to `pvPortMalloc'

undefined reference to `vTaskDelete'
undefined reference to `xTaskCreate'
.... etc.

I want to ask you officially support freeRTOS? can I compile forte for freertos+lwip (for stm32) or freeRTOS upcoming?



Re: About FreeRTOS [message #1805612 is a reply to message #1805596] Thu, 18 April 2019 18:28 Go to previous messageGo to next message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 866
Registered: January 2014
Senior Member
Hi,

thanks you.

Yes we support freeRTOS. From a quick look it seams that you didn't configure the freeRTOS lib (i.e., Cmake option FORTE_FreeRTOSLwIP_LIB). There these platform specific symbols should be defined.

Alois
Re: About FreeRTOS [message #1805643 is a reply to message #1805612] Fri, 19 April 2019 12:41 Go to previous messageGo to next message
cyt tpl is currently offline cyt tplFriend
Messages: 8
Registered: April 2019
Junior Member
Hi Professor,

thanks for reply. If I success to compile 4diac for stm32f7 I want to share with you, my illustrations.

I have little experince for cmake how to compile thats why I dont know how to define platform specific symbols.
I had earlier compiled freertos project for stm32f746 which includes "libSTM32F7xx_FreeRTOS.a" , "libSTM32F7xx_HAL_Driver.a".

This project's CMakelists.txt

# Load the the extern library
add_library (STM32F7xx_HAL_Driver STATIC IMPORTED)
set_property (TARGET STM32F7xx_HAL_Driver PROPERTY IMPORTED_LOCATION ${CMAKE_SOURCE_DIR}/Drivers/Build/lib/libSTM32F7xx_HAL_Driver.a)

# Load the the extern freertos library
add_library (STM32F7xx_FreeRTOS STATIC IMPORTED)
set_property (TARGET STM32F7xx_FreeRTOS PROPERTY IMPORTED_LOCATION ${CMAKE_SOURCE_DIR}/FreeRTOS/Build/lib/libSTM32F7xx_FreeRTOS.a)

In summary, how can I define FORTE_FreeRTOSLwIP_LIB? Which extension need to be this file?(".a" , "lib" ) I tried "libSTM32F7xx_FreeRTOS.a" but any results.

Thanks.

Re: About FreeRTOS [message #1805659 is a reply to message #1805643] Fri, 19 April 2019 17:49 Go to previous messageGo to next message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 866
Registered: January 2014
Senior Member
Hi,

maybe you then need more then one lib. In CMake Gui you can find, when selecting the advanced option, CMAKE_EXE_LINKER_FLAGS. There you can specify any option specific for you platform so in your case you could give "-lSTM32F7xx_FreeRTOS -lSTM32F7xx_HAL_Driver", where "-l stands for lowercase L". The font in this forum is not very good.

Furthermore you may need more compiler flags. This depends you your toolchain and your platform. you can yuse the CMake options for CXX_flags, Cpp flags to give this to our toolchain. We can unfortunately do this in a generic way. The best is that you take your example applications as reference.

Also please note that everytime when you make changes to your Cmake config you need to run configure and generate bevore you can run make again.

I hope this helps you to get this quickly runnig.

Cheers,
Alois
Re: About FreeRTOS [message #1805795 is a reply to message #1805659] Wed, 24 April 2019 08:35 Go to previous messageGo to next message
Jose Maria Jesus Cabral Lassalle is currently offline Jose Maria Jesus Cabral LassalleFriend
Messages: 136
Registered: February 2016
Senior Member
Hi,

I compiled forte for freeRTOS susscessfully. The easiest way I found was to compile forte as a library. Usually you have a project in some IDE for your board, where you have all the files for compiling a normal freeRTOS application.

The important thing is to select "FreeRTOSLwIP" as FORTE_ARCHITECTURE, add all the folders with headers files from your project to the variable FORTE_FreeRTOSLwIP_INCLUDES (separated by semicolon) and keep FORTE_BUILD_STATIC_LIBRARY true and FORTE_BUILD_EXECUTABLE false.
Re: About FreeRTOS [message #1805848 is a reply to message #1805795] Thu, 25 April 2019 11:48 Go to previous messageGo to next message
cyt tpl is currently offline cyt tplFriend
Messages: 8
Registered: April 2019
Junior Member
Thanks Jose Maria,

I compiled successfully "libforte-static.a". Now I am trying this library to add my project

add_library (forte-static STATIC IMPORTED)
set_property (TARGET forte-static PROPERTY IMPORTED_LOCATION ${CMAKE_SOURCE_DIR}/forte-incubation_1.10.1/src/libforte-static.a)

target_link_libraries (${CMAKE_PROJECT_NAME}.elf STM32F7xx_HAL_Driver STM32F7xx_FreeRTOS forte-static)


Although I set this flag (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D USE_HAL_DRIVER -D STM32F746xx -DFORTE_LITTLE_ENDIAN -DFORTE_USE_REAL_DATATYPE" ) there is something wrong:


/forte_lreal.h:38:25: error: 'setTDFLOAT' was not declared in this scope
setTDFLOAT(paValue);

Thanks..

Re: About FreeRTOS [message #1805857 is a reply to message #1805848] Thu, 25 April 2019 15:50 Go to previous messageGo to next message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 866
Registered: January 2014
Senior Member
Hi,

normally the FORTE_USE_REAL_DATATYPE FORTE_USE_LREAL_DATATYPE and FORTE_USE_64BIT_DATATYPE should be active per default. Are you explicitly setting some of them to off. TDFLOAT is required by the LREAL datatype.

I hope this helps,
Alois
Re: About FreeRTOS [message #1805951 is a reply to message #1805857] Mon, 29 April 2019 10:52 Go to previous messageGo to next message
cyt tpl is currently offline cyt tplFriend
Messages: 8
Registered: April 2019
Junior Member
Hi,

I compiled forte as a library "libforte-static.a" for use in my project. When "nm" command for I see which functions compile in static library ("nm libforte-static.a > nm.txt")
nm.txt that includes:

forte_sync.cpp.obj:
00000010 N $d
00000000 t $t
00000000 t $t
00000001 T _ZN19CFreeRTOSSyncObjectC1Ev
00000001 T _ZN19CFreeRTOSSyncObjectC2Ev
00000001 T _ZN19CFreeRTOSSyncObjectD1Ev
00000001 T _ZN19CFreeRTOSSyncObjectD2Ev
U vQueueDelete
U xQueueCreateMutex


That functions which about freertos undefined, didnt compile. Whatever I did, I couldnt compile freertos functions in forte.

In my project's cmake add_library(..libforte-static.a) I saw this error:

C:/Users/ARGE3/Desktop/F7Cmake/Forte/Build/src/libforte-static.a(forte_sem.cpp.obj): In function `forte::arch::CFreeRTOSSemaphore::CFreeRTOSSemaphore(unsigned int)':
C:/Users/ARGE3/Desktop/F7Cmake/Forte/src/arch/freeRTOS/forte_sem.cpp:21: undefined reference to `xQueueGenericCreate'


Because of this functions which about freertos, in libforte-static.a not defined.

So I couldnt include freertos files in forte cmake yet.
As though, forte not include my "libSTM32F7xx_FreeRTOS.a".
How can I do this?

Thanks for helping.
Re: About FreeRTOS [message #1805971 is a reply to message #1805951] Mon, 29 April 2019 14:17 Go to previous messageGo to next message
cyt tpl is currently offline cyt tplFriend
Messages: 8
Registered: April 2019
Junior Member
l compiled freertos files in forte any c files (I couldnt include lib file)
forte_add_sourcefile_c(FreeRTOS/Source/croutine.c)
forte_add_sourcefile_c(FreeRTOS/Source/event_groups.c)
now successfully, created libforte-static.a file and this library is used in my project. I created a hex file for STM32 but not work normally.
now i am working on lwip, try to include forte library for use my project.
Re: About FreeRTOS [message #1805976 is a reply to message #1805971] Mon, 29 April 2019 14:41 Go to previous messageGo to next message
Jose Maria Jesus Cabral Lassalle is currently offline Jose Maria Jesus Cabral LassalleFriend
Messages: 136
Registered: February 2016
Senior Member
I didn't understand quite well your current issue but the following functions:
vQueueDelete
xQueueCreateMutex
xQueueGenericCreate

should be in your freeRTOS code. Actually forte uses for example xSemaphoreCreateBinary and similar, which are part of the official API.

The easiest way to compile forte for freeRTOS is not to include the freeRTOs libraries, and then add libforte-static.a library to your project.
Re: About FreeRTOS [message #1806012 is a reply to message #1805976] Tue, 30 April 2019 13:18 Go to previous messageGo to next message
cyt tpl is currently offline cyt tplFriend
Messages: 8
Registered: April 2019
Junior Member
Hi,

I included libforte-static.a in my project and successfully compiled. But there is a problem with forte task (vForteTask) if this task compile in my project, any task not working.
If I dont compile forte task lwip(ethernet) is working.
Do you have any suggestion ?

Thanks
Re: About FreeRTOS [message #1806014 is a reply to message #1806012] Tue, 30 April 2019 13:36 Go to previous messageGo to next message
Jose Maria Jesus Cabral Lassalle is currently offline Jose Maria Jesus Cabral LassalleFriend
Messages: 136
Registered: February 2016
Senior Member
I'm not sure how you implement your forte task, but the easiest way of doing it is to include "forte_Init.h" (which is in the src/arch/freeRTOS folder) and then the code should look something like this:

static void forte_thread(void *arg)
{
	forteGlobalInitialize();
	TForteInstance forteInstance = 0;
	int resultForte = forteStartInstanceGeneric(0, 0, &forteInstance);
	if(FORTE_OK == resultForte){
		forteJoinInstance(forteInstance);
	}else{
		PRINTF("Error %d: Couldn't start forte\n", resultForte);
	}
	forteGlobalDeinitialize();
	vTaskDelete(NULL);
}
Re: About FreeRTOS [message #1806016 is a reply to message #1806014] Tue, 30 April 2019 13:55 Go to previous messageGo to next message
cyt tpl is currently offline cyt tplFriend
Messages: 8
Registered: April 2019
Junior Member
I implemented this task (which is in the src/arch/freeRTOS/main.cpp)
void vForteTask( void* pvParameters ){
  ( void ) pvParameters;

  RMT_DEV *poDev = new RMT_DEV;

  poDev->setMGR_ID("192.168.100.101:61499");
  poDev->startDevice();
  DEVLOG_INFO("FORTE is up and running\n");
  poDev->MGR.joinResourceThread();
  DEVLOG_INFO("FORTE finished\n");
  delete poDev;
  Test++;
  vTaskDelete(NULL);
}
Re: About FreeRTOS [message #1806017 is a reply to message #1806016] Tue, 30 April 2019 14:06 Go to previous messageGo to next message
cyt tpl is currently offline cyt tplFriend
Messages: 8
Registered: April 2019
Junior Member
Dear Jose Maria,

I guess you run forte on STM32F1xx am I right? Is forte running on Stm32 clearly?

Thanks

Re: About FreeRTOS [message #1806054 is a reply to message #1806017] Wed, 01 May 2019 17:12 Go to previous messageGo to next message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 866
Registered: January 2014
Senior Member
How much RAM have you available on your system. lwIP needs already quite a lot. This can be a problem with 4diac FORTE. Also on some systems I experienced that the tasks created by FORTE need a bit more stack size. Not sure what Jose's experience is here. Also 4diac FORTE will on startup create at least one socket. So lwIP needs to be up and running.

These are some of my experiences when working on very small embedded systems with 4diac FORTE. I hope they help.
Re: About FreeRTOS [message #1806206 is a reply to message #1806054] Mon, 06 May 2019 08:47 Go to previous message
Jose Maria Jesus Cabral Lassalle is currently offline Jose Maria Jesus Cabral LassalleFriend
Messages: 136
Registered: February 2016
Senior Member
Yes, I got running cleary in a Stm32 and also in a NXP .

As Alois said, you should start your LwIP first. After I check that the LwIP didn't fail, I start my forte task:

    if(sys_thread_new("forte_thread", forte_thread, NULL, 2000, 4) == NULL)
    	 LWIP_ASSERT("forte_thread(): Task creation failed.", 0);

the 2000 is the stack size. I'm not sure about it, but I think the stack later multiplies by 4 somewhere. Anyhow, I'd recommend to add:

void vApplicationMallocFailedHook(){
	for(;;){
		vTaskDelay(pdMS_TO_TICKS(1000));
	}
}

void vApplicationStackOverflowHook( TaskHandle_t xTask, char *pcTaskName ){
	for(;;){
		vTaskDelay(pdMS_TO_TICKS(1000));
	}
}



put a breakpoint in both vTaskDelay, and in FreeRTOSConfig.h file make sure you have:

#define configCHECK_FOR_STACK_OVERFLOW 1
#define configUSE_MALLOC_FAILED_HOOK 1

This will allow you to check if there's a problem with your memory size. If the breakpoints above are reached, your memory is too small
Previous Topic:open62541 version used in forte-1.10.2
Next Topic:QX block - "FB Not Initialized"
Goto Forum:
  


Current Time: Wed Aug 21 17:46:47 GMT 2019

Powered by FUDForum. Page generated in 0.03374 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top