Code functions differently in debug mode versus flash release - how do I find out why?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Code functions differently in debug mode versus flash release - how do I find out why?

2,063 Views
gearhead1107
Contributor IV

I'm currently working on a program for an 8-bit freescale chip (MC9S08QG8) in CodeWarrior v10.3 which uses the timer/ period capture to turn a frequency to an analog voltage.

I've gotten the thing to work pretty well in debug mode, but I noticed when I just flash the .abs file to the target to test the release build, it behaves as if the timer register is skewed. In other words, a 20ms period will normally turn on a DAC in debug mode (as intended). However, when the file is flashed directly, the DAC turns on at about 17.4ms. Ditto for other other cases; an event that's supposed to happen at 6.64ms happens at 5.75ms.

The code is interrupt-based - does anyone know what's different in debug vs direct flash that could cause this? Anything I can disable in debug mode to make it behave like a release build?

Labels (1)
Tags (4)
0 Kudos
Reply
1 Reply

1,572 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

Let's see Debug and Release in the Desktop case:

In the Desktop World, ‘Debug’ and ‘Release’ builds have following typical meaning:

  1. Debug builds have debugging and symbolic information included. The compiler is not optimizing to make debugging ‘easier’.
  2. Release builds have the debugging and symbolic information (Dwarf in ELF/Dwarf files) stripped off. Optimizations are enabled for best performance or code density.

By default, debug and release mode is the same in CW10. in a MQX project, the difference between debug mode and release mode is optimization level setting.

In debug mode: optimization level is 1.

In release mode: optimization level is 4.

You can also refer Erich blog for this topic

http://mcuoneclipse.com/2012/06/01/debug-vs-release/

can this help?


Have a great day,
Zhang Jun

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

0 Kudos
Reply