Forte on STM32F7 throws Hard Fault when creating ForteInstance [message #1838235] |
Fri, 19 February 2021 08:08 |
Tobias P Messages: 2 Registered: February 2021 |
Junior Member |
|
|
Hello,
I hope this is the correct forum for my problem.
I compiled forte as a static library for FreeRTOS+LwIP according to https://www.eclipse.org/4diac/en_help.php?helppage=html/installation/freeRTOSLwIP.html
I have my main Project in CubeIDE as a C++ Project, added the libforte-static.a and added the thread to start forte.
static void forte_thread(void *pvParameters)
{
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);
}
However, every time in forteStartInstanceGeneric() the MCU goes into Hard Fault. Reading the CFSR I can see the cause is INVSTATE:
Quote:INVSTATE Indicates the processor has tried to execute an instruction with an invalid Execution Program Status Register (EPSR) value. Among other things the ESPR tracks whether or not the processor is in thumb mode state. Instructions which use "interworking addresses"2 (bx & blx or ldr & ldm when loading a pc-relative value) must set bit[0] of the instruction to 1 as this is used to update ESPR.T. If this rule is violated, a INVSTATE exception will be generated. When writing C code, the compiler will take care of this automatically, but this is a common bug which can arise when hand-writing assembly.
I debugged the Disassembly, Hard Fault doesn't trigger on a specific instruction but always somewhere in the creation of Queue or Semaphore when it jumps to the heap in RAM. There are 2 undefined Instructions in my heap but I'm not sure where they are coming from
0x20001940: ;<UNDEFINED> instruction: 0xffffffff
same a couple of bytes later. (see attached screenshot)
Reading the explanation for INVSTATE I thought maybe I didn't compile in Thumb mode. However, these are my settings in CMake for CXX Compiler:
-mcpu=cortex-m7 --specs=nano.specs -mfpu=fpv5-d16 -mfloat-abi=hard -mthumb -Wl,--start-group -lc -lm -lstdc++ -lsupc++ -Wl,--end-group
I also tried --specs=nosys.specs
I configured CMake to use 64-Bit Datatypes which is the standard Setting, if I change it it doesn't compile at all tho
Does anyone have an Idea what the problem could be?
Any help is greatly appreciated
Greetings
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05313 seconds