assert() behaviour

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

assert() behaviour

4,968件の閲覧回数
randyhermes
Contributor III

KDS 3.0

SDK 1.2

Using MQX

 

I'm using assert() to check some parameter ranges.

 

When it is triggered it drops into a infinite loop and nothing is output on the debug console.

There isn't any source for the actual assert function that I can find, so I can't determine how to get it to print out an error message.

And yes, I'm working with a debug image (DEBUG is defined).

 

I bet I'm missing some compiler define, but I can't find it documented anywhere.

 

Can anyone help?

 

Thanks

Randy

ラベル(1)
0 件の賞賛
返信
8 返答(返信)

3,971件の閲覧回数
massimiliano_fr
Contributor I

I reopen the thread because I have a question related to that topic.

I'm using the IMXRT1050 board and I saw the assertion failed declaration in assert.h file of the redlib library. Here below the code:

void __assertion_failed(char *_Expr) __attribute__ ((noreturn));

/*
* It is legal to reset NDEBUG and re-include <assert.h> hence the
* fact that this bit gets done every time it is included. This
* implementation follows the Rationale to the C99 standard.
*/

#ifdef NDEBUG
# define assert(ignore) ((void)0)
#else
#define _ASSERT_STR(x) _ASSERT_VAL(x)
#define _ASSERT_VAL(x) #x
#define assert(expr) \
((expr) ? (void)0 : \
__assertion_failed(__FILE__ ":" _ASSERT_STR(__LINE__) " : " #expr))

However there is definition of __assertion_failed function nowhere. Does a developer define it or the SDK provide it if some symbol is defined?

Thank you,

Massimiliano

0 件の賞賛
返信

3,971件の閲覧回数
Carlos_Musich
NXP Employee
NXP Employee

Hi Randy,

In the file <sdk_dir>\platform\utilities\src\fsl_misc_utilities.c, rename the assert_func() to __assert_func(). This function will connect to assert function of compiler.

Then rebuild ksdk_mqx_lib.


Best regards,
Carlos

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 件の賞賛
返信

3,971件の閲覧回数
pcpro178
Contributor III

I'm seeing the same behavior with MCUXpresso IDE v10.1.1 and FRDM-K64F SDK 2.4.2.  How do I rebuild ksdk_mqx_lib?

0 件の賞賛
返信

3,971件の閲覧回数
F50SC
Contributor III

Hi Carlos

I have this same issue.....but I only have the fsl_misc_utlities.h header file in my project....no source???

I'm using MQX Standard...selected from PE.

If I navigate to C:\Freescale\KSDK_1.2.0\platform\utilities\src .....I can see the following files \ folders.

virtual_com folder

fsl_debug_console.c

fsl_misc_utilities.c

print_scan,c

print_scan.h

In the project directory in KDS I have....

SDK>platform>utilities>inc>

     fsl_debug_console.h

     fsl_misc_utilities.h

again there is no src folder and no fsl_misc_utilites.c??

Regards

Jerome

0 件の賞賛
返信

3,971件の閲覧回数
Carlos_Musich
NXP Employee
NXP Employee

Hi jerome,

I dont get the problem. Inside C:\Freescale\KSDK_1.3.0\platform\utilities\src the is fsl_misc_utilities.c

Carlos

0 件の賞賛
返信

3,971件の閲覧回数
F50SC
Contributor III

Hi Carlos

Yes, correct I can see this file in the Freescale directory as per my post above. The only difference is I'm using KSDK 1.20?

The problem I have is there is no source folder named ie. SDK>platform>utilities>src  for my project in KDS.

See below....

pastedImage_1.png

Regards

Jerome

0 件の賞賛
返信

3,971件の閲覧回数
Carlos_Musich
NXP Employee
NXP Employee

Yes... you can change it in the SDK location. Not in your project.

Regards,

Carlos

0 件の賞賛
返信

3,973件の閲覧回数
Carlos_Musich
NXP Employee
NXP Employee

Hi Randy,

we have reproduced and reported this behavior to KSDK developers. However they are focused on higher priority tasks and will take a look to this issue in some weeks. Unfortunately there is no work around now for this case. Sorry for the inconvenience.


Best regards,
Carlos

0 件の賞賛
返信