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

How to debug a custom native driver


Best Answer Steph, 25 February 2013 - 08:04 PM

Hi CW2,

 

Today I reinstalled all the software packages, NETMF SDK4.2, PK4.2, Netduino SDK etc. and that solved the problem!!!

I must have broken something when I installed .NET Framework 3.5 last week (because I wanted to create a Clone project)

 

However, I can now call CLR_Debug::Printf(...) from within my driver... I'm now back on track with debugging.

 

Many Thanks for your help.

Go to the full post


  • Please log in to reply
9 replies to this topic

#1 Steph

Steph

    Member

  • Members
  • PipPip
  • 16 posts

Posted 23 February 2013 - 01:37 PM

Good Day,

 

I'm currently busy writing a custom driver under my DeviceCode for Netduino.

 

My question is how can I print native debug information?

I think I saw something about using MFDeploy... but I'm not sure how?

 

Thanks for the help.

 



#2 CW2

CW2

    Advanced Member

  • Members
  • PipPipPip
  • 1592 posts
  • LocationCzech Republic

Posted 23 February 2013 - 01:58 PM

Try CLR_Debug::Printf().



#3 Steph

Steph

    Member

  • Members
  • PipPip
  • 16 posts

Posted 23 February 2013 - 03:41 PM

Hi CW2.

 

Thanks for the advice. I can't compile my firmware. I get error:

 

EXEC : error : L6218E: Undefined symbol CLR_Debug::Printf(const char*, ...)

 

I have included -  #include "........CLRCoreCore.h"



#4 CW2

CW2

    Advanced Member

  • Members
  • PipPipPip
  • 1592 posts
  • LocationCzech Republic

Posted 23 February 2013 - 03:50 PM

#include <TinyCLR_Debugging.h>

 

or

 

#include <TinyCLR_Runtime.h>



#5 Steph

Steph

    Member

  • Members
  • PipPip
  • 16 posts

Posted 23 February 2013 - 04:52 PM

I've tried to both header files.

 

I still get Undefined symbol error...

 

Do I have to check any other settings?

 

I've checked from Solution Wizzard (Edit an Existing Solution):

 * On the Project Selection Page - NativeSample is not selected (will it make any difference?) (only TinyBooter & TinyBooterDecompressor)

 * On the tinyclr page - Debugger, as well as Diagnostics are selected...



#6 CW2

CW2

    Advanced Member

  • Members
  • PipPipPip
  • 1592 posts
  • LocationCzech Republic

Posted 23 February 2013 - 06:53 PM

Ok, it seems to be linker error.

 

How did you create your custom driver project? Are you building it as a part of the firmware (i.e. its .featureproj added to tinyclr.proj)?



#7 Steph

Steph

    Member

  • Members
  • PipPip
  • 16 posts

Posted 23 February 2013 - 07:50 PM

Hi CW2,

 

I'm busy with an LCD Driver for the netduino project.

 

Using the SolutionWizard I do "Edit and Existing Solution".

 

I select Netduino project. In the Feature Selection window I check the "Graphics" checkbox and then in the "Unresolved Library window" I then select LCD_HAL, Generate Template & LCDController_HAL, Generate Template.

 

In the directory NetduinoDeviceCodeLCD_HAL I've added my .cpp and .h HAL_driver files and link my functions to the template's stubs.

 

All are working fine, I can initialize and clear the LCD. BitBld function is also working, BUT my pixels seem to be messed-up.

So now I want to use CLR_Debug::Printf(...) to display and debug the variables from:

BitBlt( int width, int height, int widthInWords, UINT32 data[], BOOL fUseDelta )

 

I've manually added my .cpp file in NetduinoDeviceCodeLCD_HALdotNetMF.proj



#8 CW2

CW2

    Advanced Member

  • Members
  • PipPipPip
  • 1592 posts
  • LocationCzech Republic

Posted 23 February 2013 - 09:12 PM

Hm, when I follow your steps (generate templates for LCD_HAL and LCDController_HAL) and add #include <TinyCLR_Runtime.h>, CLR_Debug:Printf(...) call into LCD_BitBlt() function in Display_Netduino_functions.cpp, the firmware compiles just fine (?)



#9 Steph

Steph

    Member

  • Members
  • PipPip
  • 16 posts

Posted 25 February 2013 - 08:04 PM   Best Answer

Hi CW2,

 

Today I reinstalled all the software packages, NETMF SDK4.2, PK4.2, Netduino SDK etc. and that solved the problem!!!

I must have broken something when I installed .NET Framework 3.5 last week (because I wanted to create a Clone project)

 

However, I can now call CLR_Debug::Printf(...) from within my driver... I'm now back on track with debugging.

 

Many Thanks for your help.



#10 CW2

CW2

    Advanced Member

  • Members
  • PipPipPip
  • 1592 posts
  • LocationCzech Republic

Posted 25 February 2013 - 08:21 PM

That's great news! You should be able to see CLR_Debug::Printf(...) diagnostics in Visual Studio Output window while debugging the application, or in MFDeploy after you connect it to Netduino (via Target/Connect, F5).

 

Dumping variables should work fine, but keep in mind the USB transmission will affect code execution and timing, so it may cause some side effects...

 

Fingers crossed :P






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.