How to "goto definition" in Atmel Studio 7?

Go To Last Post
11 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi, I right click a function (the digitalWrite()) and select "goto implementation", as picture1 illustrated:

Then a .h file (Arduino.h) opened, as the picture2 illustrated:

But that's not what I expected, I want to goto the source code (the .c/.cpp file) of the "digitalWrite" function, can anyone give me an advise?

Best regards.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Arduino projects are built from a sketch object and a core object.
The core object is built once. Subsequent builds only need to compile the sketch part.
.
The sketch part only needs to know Arduino.h and not the core source code.
.
If you open the core dependencies, click on its Arduino.h
Then right-click on digitalWrite()
It might show you the core source code.
.
Untested.
.
David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

david.prentice wrote:
Arduino projects are built from a sketch object and a core object. The core object is built once. Subsequent builds only need to compile the sketch part. . The sketch part only needs to know Arduino.h and not the core source code. . If you open the core dependencies, click on its Arduino.h Then right-click on digitalWrite() It might show you the core source code. . Untested. . David.

Hi, david,

Thank you for replying. I test right click on digitalWrite() in Arduino.h file, but nothing appears.

Best regards.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I typed my original reply from my breakfast table.

 

I have just tried on a PC:

 

1.  opened an AS7 Arduino project

2.  built it.

3.  right clicked: ArduinoCore->Dependencies->Arduino.h

4.  enabled Visual Assist from VassistX menu.

5.  hovered on digitalWrite()

6.  right-clicked on Goto Implementation.

7.  editor opens wiring_digital.c on the digitalWrite() function code.

 

Visual Assist might slow down your PC but it should work.

You also get the painful prompts when writing code.

 

I then tried hovering and right-clicking on the sketch.cpp file.

Sure enough it found the correct ArduinoCore file i.e.

C:\Users\David Prentice\Documents\Atmel Studio\ARDUINO_PROJECTS\blinky\blinky\ArduinoCore\src\core\wiring_digital.c

 

So you don't even need to use ArduinoCore Dependencies

 

David.

Last Edited: Mon. Jan 6, 2020 - 08:41 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

david.prentice wrote:

I typed my original reply from my breakfast table.

 

I have just tried on a PC:

 

1.  opened an AS7 Arduino project

2.  built it.

3.  right clicked: ArduinoCore->Dependencies->Arduino.h

4.  enabled Visual Assist from VassistX menu.

5.  hovered on digitalWrite()

6.  right-clicked on Goto Implementation.

7.  editor opens wiring_digital.c on the digitalWrite() function code.

 

Visual Assist might slow down your PC but it should work.

You also get the painful prompts when writing code.

 

I then tried hovering and right-clicking on the sketch.cpp file.

Sure enough it found the correct ArduinoCore file i.e.

C:\Users\David Prentice\Documents\Atmel Studio\ARDUINO_PROJECTS\blinky\blinky\ArduinoCore\src\core\wiring_digital.c

 

So you don't even need to use ArduinoCore Dependencies

 

David.

Hi, david,

I hovering on digitalWrite(), as the following picture illustrated, but nothing appears. I'm puzzling...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

As David says, the IDE should be able to do this at the source level.

 

Does the project actually build?

 

If it does, a "workaround" to find the definition would be to run the sketch, and step into it using the debugger!

 

If it doesn't build, maybe that's because it really can't find the definition ... ?

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

awneil wrote:

As David says, the IDE should be able to do this at the source level.

 

Does the project actually build?

 

If it does, a "workaround" to find the definition would be to run the sketch, and step into it using the debugger!

 

If it doesn't build, maybe that's because it really can't find the definition ... ?

Hi, awneil,

Thank you for replying. I had built the project, but...

This problem make me crazysad, maybe it's time to give up...

 

Thank you, and David,

Best regards.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It looks as if you have installed VisualMicro

 

This will guarantee that you will suffer SPAM for evermore.

And any AS7.0 debugging gets trashed.

 

I would not touch VM with a bargepole.

 

If an experienced member is brave enough to risk VM she might be able to help.

 

Note that AS7.0 is a bit crap with importing Arduino sketches.

Since the Arduino IDE works well,.  it is a mystery why anyone might want to import into AS7

 

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

david.prentice wrote:
It looks as if you have installed VisualMicro

So maybe wanggaoteng needs to contact them about this?

 

https://www.visualmicro.com/page/contact-us.aspx

 

https://www.visualmicro.com/forums/

 

 

I would not touch VM with a bargepole.

Seems you're not the only one: https://www.avrfreaks.net/commen...

 

@ wanggaoteng  - does this work if you get rid of VisualMicro ?

 

Note that AS7.0 is a bit crap with importing Arduino sketches.

I've not tried it for anything "advanced" - but it worked for me when I tried it on a simple project.

 

the Arduino IDE works well

Does it do 'Go To Definition' ?

 

it is a mystery why anyone might want to import into AS7

The usually-cited answer is for debugging - but that now seems to be going away:

 

https://www.avrfreaks.net/forum/...

 

Microchip have some tutorials on importing to AS:

 

https://www.avrfreaks.net/forum/...

 

 

EDIT

 

clawson gives another reason here: https://www.avrfreaks.net/commen...

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
Last Edited: Thu. Jan 9, 2020 - 12:41 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

No,  the Arduino IDE has no "goto definition" capability.

 

The standard Arduino functions are well documented.   You can see the calling procedure from the Help menu.

 

Most Arduino sketches involve C++ class objects with a few standard functions.

The header files contain the class methods and other info.

 

I have never found this to be a problem.    Most class methods are pretty straightforward.

However,   something like a baremetal ARM project in Keil or AS7 do become unwieldy.    Navigating the Cortex header files for the correct spelled macro do need some assistance.

 

I would be interested to hear from an experienced VM user.    It might not be bad.

 

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

david.prentice wrote:
No,  the Arduino IDE has no "goto definition" capability

Thanks.

I've not used it - so didn't know.

 

david.prentice wrote:
The standard Arduino functions are well documented.

eg, 

 

https://www.arduino.cc/reference/en/language/functions/digital-io/digitalwrite/

 

https://www.arduino.cc/en/Reference.digitalWrite

 

and google can find the source:

 

https://github.com/arduino/ArduinoCore-avr/blob/master/cores/arduino/wiring_digital.c

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
Last Edited: Mon. Jan 6, 2020 - 11:41 AM