cancel
Showing results for 
Search instead for 
Did you mean: 

what is the purpose of ''#define USE_FULL_ASSERT''

ch2
Associate III
Posted on January 03, 2014 at 12:16

Hello All,

I am new to STM32 cortex M3 controllers. I am building a basic application (LED toggling) in IAR embedded workbench v6.2. I am facing an error Error[Li005]: no definition for ''assert_failed''. What i want to know from you guys that what is the purpose of ''&sharpdefine USE_FULL_ASSERT''.

 

When I comment this line in ''stm32f10x_conf.h'' file, code compiles with no error. 

Thanks in advanced for comments and suggestions.

Baber

#use_full_assert #error[li005]
3 REPLIES 3
chen
Associate II
Posted on January 03, 2014 at 12:23

Hi

It is a macro (are you familiar with C macros?)

The Assert macro is often used during development to trap development bugs.

Often the assert macros are written to stop the code so that the failure point can be traced.

''Error[Li005]: no definition for ''assert_failed''''

means there is no definition for the macro ASSERT_FAILED

You can continue with the define commented out - then none of the assert macros will

do anything.

ch2
Associate III
Posted on January 03, 2014 at 12:46

Hi sung.chen,

I am familiar with C macros and I have used that many many times. Its nothing but a chunk of code that is replaces it self with full definition where it is called in the code.

If there is no definition for this macro where can I find the standard definition. If you have one kindly paste it here.

Thanks

Baber

ch2
Associate III
Posted on January 03, 2014 at 12:52

Problem solved used this definition 

void assert_failed(u8* file, u32 line)

  printf( ''\r\nassert_failed(). file: %s, line: %ld\r\n'', file, line );

  while (1)

  {}

}

Thanks for the guidance.