Yesterday (or maybe the day before), I was browsing through some of the documentation and some where I ran into some documentation saying something along the line, that addr2line is not installed (or run) on windows, and you need to do something like install a version of it under something like WSL or brew or the like:
I was wondering why? I have been using addr2line on windows for a long time, mainly for debugging Teensy 4.x crash..
There is a version installed with the IDE that works fine for me. The only thing that is not there is the simple wrapper executable addr2line. instead you use:arm-none-eabi-addr2line.exe
In particular, this executable is located in the same place as the other gcc commands that you use as part of your build. In my case this is located at:
C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\tools\arm-none-eabi-gcc\7-2017q4\bin\arm-none-eabi-addr2line.exe
So for example if I have a mucked up version of blink:
/*
Blink
Turns an LED on for one second, then off for one second, repeatedly.
Most Arduinos have an on-board LED you can control. On the UNO, MEGA and ZERO
it is attached to digital pin 13, on MKR1000 on pin 6. LED_BUILTIN is set to
the correct LED pin independent of which board is used.
If you want to know what pin the on-board LED is connected to on your Arduino
model, check the Technical Specs of your board at:
https://www.arduino.cc/en/Main/Products
modified 8 May 2014
by Scott Fitzgerald
modified 2 Sep 2016
by Arturo Guadalupi
modified 8 Sep 2016
by Colby Newman
This example code is in the public domain.
https://www.arduino.cc/en/Tutorial/BuiltInExamples/Blink
*/
// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin LED_BUILTIN as an output.
while (!Serial && millis() < 5000) {}
Serial.begin(115200);
pinMode(LED_BUILTIN, OUTPUT);
Serial.println((uint32_t)&loop, HEX);
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(250); // wait for a second
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
delay(250); // wait for a second
}
Which printed out: 4101
And I run the command from the temp directory that Arduino built into:
C:\Users\kurte\AppData\Local\Temp\arduino\sketches\8FF1FD4F5F89C44F9E04F5882A575D15>C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\tools\arm-none-eabi-gcc\7-2017q4\bin\arm-none-eabi-addr2line.exe -e Blink.ino.elf 0x4101
C:\Users\kurte\AppData\Local\Temp\.arduinoIDE-unsaved2024724-12732-1uunws5.01ho\Blink/Blink.ino:35
You will see line 35 is correct.
Note: I don't normally do this full long path name. I have cheated and copied the installed addr2line to another directory that I have, that is on my: PATH
C:\Users\kurte\AppData\Local\Temp\arduino\sketches\8FF1FD4F5F89C44F9E04F5882A575D15>where addr2line.exe
C:\Users\kurte\bin\addr2line.exe
Over the last few years I have had to copy it twice as we changed to a newer version of gcc...
Sorry, I know I should probably try to locate again where I read the need to install it... But I am sort of lazy as I am not doing anything with these boards at the current time.
Kurt