Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

Does the Netduino ignore Debug.Print() commands when the debugger isn't attached?

debug debug.print debug.print()

  • Please log in to reply
4 replies to this topic

#1 Verdris

Verdris

    Advanced Member

  • Members
  • PipPipPip
  • 128 posts
  • LocationReno, NV

Posted 27 February 2013 - 12:03 AM

I have a lot of debugging outputs in my code, but the project is designed to mostly write to a data file. Does the Netduino know when the debugger is attached, and if so, does it ignore all debug.print() commands when no debugger is present?



#2 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 27 February 2013 - 02:18 AM

Hi Verdris, Debug.Print will always send its output to the debug port. We typically place an #if block around Debug statements so that we can compile them out in production code. Chris

#3 Verdris

Verdris

    Advanced Member

  • Members
  • PipPipPip
  • 128 posts
  • LocationReno, NV

Posted 27 February 2013 - 06:40 PM

Hi Verdris, Debug.Print will always send its output to the debug port. We typically place an #if block around Debug statements so that we can compile them out in production code. Chris

 

What's the syntax for #iffing out debug commands?



#4 cutlass

cutlass

    Advanced Member

  • Members
  • PipPipPip
  • 78 posts
  • LocationNew England. :)

Posted 28 February 2013 - 04:14 AM

What's the syntax for #iffing out debug commands?

 

http://msdn.microsof...9(v=vs.71).aspx

 

http://www.google.co...nal compilation

 

 

FWIW, without the conditional compilation, the debug command will still execute code and will still try to send stuff out through the USB port.  But, without an active USB connection, I'm not sure how much of the code executes, verses a call, not connected - so return.

Basically, other than performance and code space, there's no harm in keeping the debug commands.

 

If you're concerned about a customer/person hooking up to the USB port, put a little "J-B Weld" epoxy in connector (don't let it get on the pins in back of the connector).  That connector is now useless. :)  However, you'd still have the option to solder wires to the pins.  With J-B Weld, I doubt that connector would come off the board without taking some of the PCB with it.  Of course, there are plenty of other options (different glue, remove the USB connector, etc).  FWIW, removing the USB connector should be pretty simple with hot air.  Note that putting surface mount devices on a PCB is much much harder than removing them. :)

 

Good Luck!



#5 CW2

CW2

    Advanced Member

  • Members
  • PipPipPip
  • 1592 posts
  • LocationCzech Republic

Posted 28 February 2013 - 07:41 AM

What's the syntax for #iffing out debug commands?

 

In addition to what cutlass said, you can wrap Debug.Print() with your own method and decorate it with Conditional attribute, like shown here.







0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.