Hi everyone,
I have a problem using lwip as I described in the post LWIP_ASSERT on pbuf_free function.
To catch the problem, I need a little complex breakpoint: I think the correct tool is using instruction trace; I've read the tutorial, but with that configuration I'm not able to trap the issue.
I need to set a trigger that is true when a (global) variable is written with any value, but only when another (global) variable has a specific value (0).
Is it possible to configure such a trigger? If yes, how? If no, how can I trap this condition?
Many thanks
Biafra
One important thing to note is that the use of the DebugMonitor exception is basically not compatible with using a debug probe (as these will enable "Halting debug" mode). And changing this is generally not possible from user application code.
To be honest though, I don't recall ever seeing anyone using the DebugMonitor exception before on Cortex-M devices before (although I'm sure someone somewhere does!). Generally when a debug probe is not connected you will see debug events (like a BKPT instruction) triggering a hard fault. There is more information on this in ARM's Cortex-M documentation.
Regards,
MCUXpresso IDE Support
Hi Biafra,
Yes, you can. This function is called watchpoint. Please read MCUXpresso_IDE_User_Guide.pdf section 11.5. You can set it when the IDE in debug mode.
Regards,
Jing
Hi jingpan,
Many thanks for your answer.
I know the watchpoint function, but it isn't the right tool for me, because the variable I'm interested in is written continuously and with such function enabled the CPU runs very slowly and can't work.
I've read about instruction trace (MCUXpresso IDE Instruction Trace) and I think it can be the right tool for me, but the example is related to set a trigger that is true when a variable is written with a specific value (not when it is written with any value, but only when another variable has a specific value: this is the situation I'm trying to catch!).
Many thanks
Biafra
Hi,
I've made some tests and I think that the concept to operate according to my needs can be:
How must I configure the instruction trace to work such a way?
Many thanks
Biafra
Hi Biafra,
These three point can't be done at same time. There are only 4 watchpoint comparator. The first point need 2 comparator, the second one need 1 comparator. And a trigger event A also need 2 comparator. Further more, these comparator should combine together to fulfill your requirement. But as we can see, only 2 comparator can link together.
I made a demo to deal with requirement 1 and 2
Hope this can give you some help.
Regards,
Jing
Hi jingpan,
Unfortunately your solution isn't right for me.
Now I'm trying to use DebugMon interrupt to do the job.
I've configured the DWT peripheral to set the debug monitor interrupt, but I have two problems:
This is the code I use:
unsigned long DebugVar = 0;
unsigned long DebugHandler = 0;
void main( void )
{
unsigned long DebugCnt = 0;
...
//init debugmon
CoreDebug->DEMCR = CoreDebug_DEMCR_TRCENA_Msk | CoreDebug_DEMCR_MON_EN_Msk;
DWT->COMP0 = ( uint32_t )&DebugVar;
DWT->MASK0 = 0;
DWT->FUNCTION0 = ( 1 << 11 ) | ( 1 << 2 ) | ( 1 << 0 );
NVIC_SetPriority( DebugMonitor_IRQn, 7 );
EnableIRQ( DebugMonitor_IRQn );
while( 1 )
{
if( DebugCnt++ >= 100 ) //every 10 s
{
DebugCnt = 0;
DebugVar++; //write var
}
...
if( DebugHandler )
{
//debug
PRINTF( "Debug monitor handler executed\n" );
DebugHandler = 0;
}
vTaskDelay( 10 ); //systick = 10 ms: delay 100 ms
}
}
void DebugMon_Handler( void )
{
if( DWT->FUNCTION0 & DWT_FUNCTION_MATCHED_Msk )
DebugHandler = 1;
}
Is there any error? Why is the interrupt never executed? Is it possible to avoid stopping the execution during the debug session?
Many thanks
Biafra