Hello everyone
(target C6678, SYSBIOS 6.37, UIA 1.4.00.6, XDC tools 3.25, CCSv6...98)
We have an example application that uses LoggerSM.
Our issue only happens when DECODE = FALSE and OVERWRITE = TRUE.
This application (very simple and minimal) uses 1 SWI.
We have then a swi_post which calls LoggerSM_write4 which calls eraseRecords.
The application then hangs in the WHILE loop inside eraseRecords. It never goes out of it.
Here's the code for eraseRecords
static Void eraseRecords(SizeT numMAUToWrite) { SizeT freeSizeMAU = LoggerSM_getFreeSize(); SizeT numMAUInEvent = 0; Bits32 endPtr = (Bits32)LoggerSM_module->sharedObj->endPtr; volatile Char *readPtr = LoggerSM_module->sharedObj->readPtr; while (freeSizeMAU <= numMAUToWrite) { /* * - Get the size of the event record * - Update the running count * - adjust the temp read pointer */ numMAUInEvent = EventHdr_getLength(*(Int32 *)readPtr); freeSizeMAU += numMAUInEvent; readPtr = (Ptr)((Bits32)readPtr + numMAUInEvent); /* check for wrap condition */ if ((Bits32)readPtr >= endPtr) { readPtr = (Ptr)((Bits32)LoggerSM_module->sharedObj->buffer + ((Bits32)readPtr - endPtr)); } } LoggerSM_module->sharedObj->readPtr = readPtr; }
and here's the code for EventHdr_getLength
/* ======== EventHdr_getLength ======== * gets the event length (in bytes) from the first word of the event header */ #define ti_uia_runtime_EventHdr_getLength(eventWord1) \ ((UInt32)((eventWord1 & EventHdr_LENGTH_MASK) >> EventHdr_LENGTH_BIT_SHIFT))
I'd like to draw attention to this line :
numMAUInEvent = EventHdr_getLength(*(Int32 *)readPtr);
as you can see we expect a number of MAU
but we get a SIZE in BYTES with EventHdr_getLength
I think it could lead to errors on target where 1 MAU is different than 1 byte.
This may not be the cause of my issue.
I think the correct code should be :
numMAUInEvent = BITS8_TO_MAU(EventHdr_getLength(*(Int32 *)readPtr));
Let me know what you think
Thank you
Regards
Clement