xTimerCreateStatic stucks at configASSERT

Hello, guys

I am very new to “FreeRTOS things”.

Here’s my first encountered problem.

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?

My configuration regarding this symptom’s like below.

#define configSUPPORT_STATIC_ALLOCATION          1
#define configSUPPORT_DYNAMIC_ALLOCATION         0
#define configTOTAL_HEAP_SIZE                    ( ( size_t ) 8192 )
#define configAPPLICATION_ALLOCATED_HEAP         0

/* Hook function related definitions. */
#define configUSE_IDLE_HOOK                      1
#define configUSE_TICK_HOOK                      1
#define configCHECK_FOR_STACK_OVERFLOW           2
#define configUSE_MALLOC_FAILED_HOOK             0
#define configUSE_DAEMON_TASK_STARTUP_HOOK       1
/* Daemon Task startup hook */
#ifdef __ICCARM__
	/* The #ifdef just prevents this C specific syntax from being included in
	assembly files. */
    void vApplicationDaemonTaskStartupHook( void );
#endif
#ifdef __GNUC__
	/* The #ifdef just prevents this C specific syntax from being included in
	assembly files. */
    void vApplicationDaemonTaskStartupHook( void );
#endif

/* Run time and task stats gathering related definitions. */
#define configGENERATE_RUN_TIME_STATS            0 
#define configUSE_TRACE_FACILITY                 0
#define configUSE_STATS_FORMATTING_FUNCTIONS     0

/* Co-routine related definitions. */
#define configUSE_CO_ROUTINES                    0
#define configMAX_CO_ROUTINE_PRIORITIES          ( 2 )

/* Software timer related definitions. */
#define configUSE_TIMERS                         1
#define configTIMER_TASK_PRIORITY                ( 3 ) 
#define configTIMER_QUEUE_LENGTH                 10
#define configTIMER_TASK_STACK_DEPTH             4096 

Any reponse would be really helpful!!

Thanks,

Sungho

No, they MUST be the same (see comment), but they are not. Probably some #include path problem.

Which FreeRTOS version are you using?

I am using “V10.0.1” with S32K144_SDK01

But assembly code shows that if same size then goes to infinite loop…

And " configASSERT( xSize == sizeof( Timer_t ) ); " <= Does this mean “if same then Assert” ? Am I wrong with “code reading”?

It means assert if they are not the same size.

Oops…Thanks for correcting me

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.

1 Like

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.