if i check the iec61131 moduble, then the file will be very large,
then i complied the library with freertos and lwip,
the bin file will be over 512k, it runs out off the 512k flash.
Any experience?
The second problem is when i debug
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);
}
int resultForte = forteStartInstanceGeneric(0, 0, &forteInstance);
this line is hang up, why?]]>joy woo2020-05-14T03:24:39-00:00Re: forte+freertos+lwip on stm32 flash problem
https://www.eclipse.org/forums/index.php/mv/msg/1103776/1827429/#msg_1827429
first of all I assume you built everything with debug disabled? Debug symbols consume quite some memory.
I made good experiences with -Os (optimize for size) or -O2. The latter often produces smaller binaries for arm then -Os.
Furthermore I had a quick look on the default compiler settings of our default freeRTOS setup and it is missing quite some options that can help you on embedded systems.
I would experiment at least with the following compiler settings: -ffunction-sections -fdata-sections -fno-threadsafe-statics -fno-rtti -fno-exceptions
and the following linker options for the final linking stage linking your binary: -W,--gc-sections -fno-threadsafe-statics
The functions and data sections allow the linker with the gc-sections to remove not used elements. No-rtti and no-exceptions should greatly reduce the binary size as well.
No-Threadsafe-statics should reduce ram usage. If you take an older forte (1.8.4 or so) you will find there also CMakefiles for Lego Mindstorms nxt (in the ecos folder). There I did the most heavy tuning. Producing a Map file can help here to find out what is all part of your binary image.
Maybe some arm specific options like -mno-thumb-interwork could also bring some size reduction. But here I would refer to your tool-chain.
For your second problem I would a assume a stack size or heapsize problem. How much ram do you have? Can you step into and find out where it breaks inside.
I hope this helps you to move forward.
]]>Alois Zoitl2020-05-14T10:47:05-00:00Re: forte+freertos+lwip on stm32 flash problem
https://www.eclipse.org/forums/index.php/mv/msg/1103776/1828053/#msg_1828053
yes, now i have the problem of RAM, my device is stm32F407ZET6,
it's with 512k flash and 128k ram,the Eth is W5500,
in definition:
osThreadId_t defaultTaskHandle;
const osThreadAttr_t defaultTask_attributes = {
.name = "defaultTask",
.priority = (osPriority_t) osPriorityHigh,
.stack_size = 128 * 4
};
/* Definitions for Task02 */
osThreadId_t Task02Handle;
const osThreadAttr_t Task02_attributes = {
.name = "Task02",
.priority = (osPriority_t) osPriorityNormal,
.stack_size = 128 * 50
};
in main()
defaultTaskHandle = osThreadNew(StartDefaultTask, NULL, &defaultTask_attributes);
the forte version is 1.11 the freertos is 10.2.1 ,the lwip is 2.1.2,
the libforte-static.a is ready on windows with trueStudio, tool-chain is
arm-atollic-eabi.
it seems not enough ram according to the suspending thread stack
even I change
osThreadId_t Task02Handle;
const osThreadAttr_t Task02_attributes = {
.name = "Task02",
.priority = (osPriority_t) osPriorityNormal,
.stack_size = 128 * 50
};
to 128*80 it didn't work
]]>joy woo2020-05-30T15:47:09-00:00Re: forte+freertos+lwip on stm32 flash problem
https://www.eclipse.org/forums/index.php/mv/msg/1103776/1828119/#msg_1828119
Alois Zoitl2020-06-02T07:04:13-00:00Re: forte+freertos+lwip on stm32 flash problem
https://www.eclipse.org/forums/index.php/mv/msg/1103776/1828122/#msg_1828122
the #configTotal_HEAP_Size is by default 15360 = 15k, if i adjust the number to bigger, then the compiler will not pass.]]>joy woo2020-06-02T07:22:39-00:00Re: forte+freertos+lwip on stm32 flash problem
https://www.eclipse.org/forums/index.php/mv/msg/1103776/1828125/#msg_1828125
but 15k of heap will definitely not be enough. I think you need to deeper analyze what is needing your ram for what puproses and tune that.]]>Alois Zoitl2020-06-02T07:45:10-00:00Re: forte+freertos+lwip on stm32 flash problem
https://www.eclipse.org/forums/index.php/mv/msg/1103776/1828131/#msg_1828131
there is no problem, if 65360 then will not pass
then the error is different
as the snapshot]]>joy woo2020-06-02T08:26:06-00:00Re: forte+freertos+lwip on stm32 flash problem
https://www.eclipse.org/forums/index.php/mv/msg/1103776/1828155/#msg_1828155
Alois Zoitl2020-06-02T19:15:34-00:00Re: forte+freertos+lwip on stm32 flash problem
https://www.eclipse.org/forums/index.php/mv/msg/1103776/1828476/#msg_1828476
void CResource::initializeResIf2InConnections(){
if(0 != m_pstInterfaceSpec){
mResIf2InConnections = new CInterface2InternalDataConnection[m_pstInterfaceSpec->m_nNumDIs];
for(TPortId i = 0; i < m_pstInterfaceSpec->m_nNumDIs; i++){
(mResIf2InConnections + i)->setSource(this, i);
}
}
}
could this code cause memory alloc problem?
actully, could you give the suggestion how much ram is needed to run forte on stm32? Or to do what steps can reduce the ram consume? ]]>joy woo2020-06-10T12:20:01-00:00Re: forte+freertos+lwip on stm32 flash problem
https://www.eclipse.org/forums/index.php/mv/msg/1103776/1828480/#msg_1828480
#define configTOTAL_HEAP_SIZE ((size_t)35360)
the the ucheap is lower , but the same error in the same place]]>joy woo2020-06-10T13:14:29-00:00Re: forte+freertos+lwip on stm32 flash problem
https://www.eclipse.org/forums/index.php/mv/msg/1103776/1828487/#msg_1828487
Alois Zoitl2020-06-10T14:52:10-00:00Re: forte+freertos+lwip on stm32 flash problem
https://www.eclipse.org/forums/index.php/mv/msg/1103776/1828499/#msg_1828499
CIEC_WSTRING& MGR_ID() {
return *static_cast<CIEC_WSTRING*>(getDI(0));
}
getID(0)) is no problem, but *static_cast<CIEC_WSTRING*> caused BusFault_Handler
that is very wired
]]>joy woo2020-06-11T01:26:41-00:00Re: forte+freertos+lwip on stm32 flash problem
https://www.eclipse.org/forums/index.php/mv/msg/1103776/1828509/#msg_1828509
CIEC_ANY *CTypeLib::createDataTypeInstance(CStringDictionary::TStringId pa_nDTNameId, TForteByte *pa_acDataBuf) {
CIEC_ANY *poNewDT = 0;
CTypeEntry *poToCreate = findType(pa_nDTNameId, m_poDTLibStart);
if (0 != poToCreate) {
poNewDT = (static_cast<CDataTypeEntry *>(poToCreate))->createDataTypeInstance(pa_acDataBuf);
if (0 == poNewDT) // we could not create the requested object
m_eLastErrorMSG = e_OVERFLOW;
} else
m_eLastErrorMSG = e_UNSUPPORTED_TYPE;
return poNewDT;
}
e_UNSUPPORTED_TYPE;
can't findType, still researching]]>joy woo2020-06-11T07:40:55-00:00Re: forte+freertos+lwip on stm32 flash problem
https://www.eclipse.org/forums/index.php/mv/msg/1103776/1828517/#msg_1828517
the link list of m_poDTLibStart is not the complete one and not correct.
i don't know why]]>joy woo2020-06-11T09:07:02-00:00Re: forte+freertos+lwip on stm32 flash problem
https://www.eclipse.org/forums/index.php/mv/msg/1103776/1828518/#msg_1828518
__libc_init_array();
should not be called at the beginning of the main(), i removed it
because it has already been called by system, if called twice, then the initilzation would be problem
]]>joy woo2020-06-11T09:25:48-00:00Re: forte+freertos+lwip on stm32 flash problem
https://www.eclipse.org/forums/index.php/mv/msg/1103776/1828521/#msg_1828521
Alois Zoitl2020-06-11T09:53:49-00:00