Like a captured image below. size of StaticTimer_t & Timer_t are always same…after builds.
What does it mean? The size must not be same? How can I solve this?
Here is the definition of Timer_t in that version:
Here is the definition of StaticTimer_t in that version:
Normally the two would seem to be the same size. However I note there is a function pointer that is assumed to be the same size as a void * (pvTimerID and pxCallbackFunction). Is that the case on the S32? I think that is an ARM Cortex-M, so it should be.
Regarding the confusion about what condition the assert fires upon: If it’s a Cortex, you might stumble over the
ite
instruction which is a little tricky to understand. In any case, as Richard pointed out, the assert catches if the two are NOT equal.
Since you’re in assembly anyways, you might as well look at the values of the two registers compared right before the ite instruction, so you can clearly see that the two are not equal and what values they have.
I see two possible reasons for them being unequal: First, there is a file somewhere earlier in the #include search path hierarchy that declares the strucute differently from what you want, and second, there is a pack directive somewhere that forces one structure definition to be padded and not the other.
The easiest way to figure this out is to compile your timers.c with the -E instead of the -c option, so your .obj will contain the preprocessor output. That way you can look for the structure declaration and see pretty soon what is going on.
Dear, Mr/Ms RAc & Richard Barry.
Thanks to your guidance, I found that I pointed at a wrong position.
Same size should be…and stuck at another position(issue resolved).
And please forgive me for my bad analysis.