Tool/software: TI-RTOS
When I have the below class object created in he main(),
I had issuing runtime errors, and when I debugged it I have seen that object is corrupted by
hwi ISR stack. And I observed both in
memory view and by putting a hw breakpoint to my stack top.For double checking, I have put a dummy array (stackProtectBuffer) into the class,
and I have seen that array is also courupted. Dummy array solved my runtime
issue by this way.
class SmConfigCls: public ActiveCls {
public:
InterCoreCls interCoreObj;
SystemManagerCls systemManagerObj;
SensorCls SensorsObj;
MissionComputerCls missionComputerObj;
MaintenanceCls maintenanceObj;
BitCls bitObj;
ViewCls viewObj;
char stackProtectBuffer[1024];
private:
void initRelations();
public:
SmConfigCls() :
interCoreObj(CoreEnu_systemManager),
ActiveCls(4)
{
memset(stackProtectBuffer, 0, sizeof(stackProtectBuffer));
initRelations();
}
void* Run();
};
Int main(int cmdCount, char* commands[]) {
SmConfigCls sm;
BIOS_start(); /* does not return */
return (0);
}
I think there may be a bug in the kernel. Have a look at the following lines
in the family/c64p/Hwi.c
Hwi_module->isrStack = Hwi_getIsrStackAddress() - 8;
Hwi_module->taskSP = (Char *)-1;/* signal that we're executing on the */
/* ISR stack */
and here is the Hwi_getIsrStackAddress function in the same file.
Char *Hwi_getIsrStackAddress()
{
__extern __FAR__ char _stack[8];
__extern __FAR__ UInt8 __TI_STACK_SIZE;
UInt32 isrStack;
isrStack = (UInt32)_stack;
isrStack += (UInt32)&__TI_STACK_SIZE;
isrStack -= 0x1;
isrStack &= ~0x7; /* align to long word */
return ((Char *)isrStack);
}
As I understand hwi stack is put just on Program.stack and I think there may be bug in above code?
my device is 6678 and bios version is 6.46.0.23. C6000 compiler verison is 8.1.1 but I also tried 7.4.11.