OpenSprinkler › Forums › OpenSprinkler Unified Firmware › vscode remote debugging configuration
- This topic has 5 replies, 2 voices, and was last updated 4 months, 1 week ago by ronnie.
-
AuthorPosts
-
July 30, 2024 at 5:16 pm #79703
ronnieParticipantI have been trying to set up an IDE code development environment for raspberry pi opensprinkler. I have vscode setup on a linux machine for remote debugging on the raspberry pi but can’t get the compile to work. Local compile works fine using the build.sh script. For instance compiling the main.cpp file results in undefined reference errors to all the external references. I assume this is fixed by modifying the json file but I don’t know exactly what to add or change in this file. I’ve tried a few things based on google searches. I have attached a screen shot of the default json file.
Attachments:
July 30, 2024 at 7:48 pm #79706
ronnieParticipantupdate:
Adding a single line to the json file shown in the attached image solved the undefined references problem. However, the opensprinkler.h file has “includes” for files not in the source folder as shown in a second attached image. The third attached file shows some of the errors. The local G++ compile doesn’t seem to care but vscode sure does. Note openthingsframework seems to handled in the platformio.ini file build instructions for non-pi versions of the code.Attachments:
July 31, 2024 at 12:16 pm #79714
ronnieParticipantUpdate 2:
Now using the ARDUINO instructions for vscode. Installed the platformio extension and removed from the platformio.ini everything except the linux directives. This fixed many errors. However, using the platformio build I got a can’t find “WProgram.h” error among others. This error appears to be caused by emailsender.h40 #if ARDUINO >= 100
41 #include “Arduino.h”
42 #else
43 #include “WProgram.h”
44 #endifAfter commenting out this code the error is resolved. The “else” is executed even if not ARDUINO… Should there be another “if” in this ?
The main remaining problem is openthingsframework is missing from the linux directives in the platformio.ini. Since openthingsframework is for ARDUINO I don’t think it is necessary for linux. But it has an include in opensprinkler.h.
Anybody have any ideas?July 31, 2024 at 5:55 pm #79718
RayKeymasterCan I ask you why you are trying to compile Linux firmware in VSCode? As the instructions in the README say clearly:
https://github.com/OpenSprinkler/OpenSprinkler-Firmware
For OSPi/OSBO or other Linux-based OpenSprinkler:
https://openthings.freshdesk.com/support/solutions/articles/5000631599You should use the bulid.sh script to compile it for Linux.
August 1, 2024 at 11:22 am #79727
ronnieParticipantIn answer to Dan’s question I want to develop code using the development tools VScode provides like breakpoints and tracking variables.
So finally I have been able to compile opensprinkler using vscode. I reverted back to the previous release before 2.2.1 since that’s what I am running now. The first problem Dan pointed out was that I was trying to compile the entire gihub folder of files. So I created a project folder with only the files needed by the pi version. This left me with only errors related to the pthread mosquitto libraries. The vscode can’t execute “sudo G++” so I had to copy the 2 libraries to the project folder and change their ownership and privileges to non-root. I’m now working on getting GDB to perform debugging. The attached vscode task json file image contents result in duplicating the build.sh script G++ command.
Attachments:
August 1, 2024 at 6:50 pm #79745
ronnieParticipantUpdate 3: SUCCESS
Finally it all works. I am able to compile and remotely debug Raspberry pi 4 Opensprinkler code using vscode on my Lubuntu linux virtual machine.
The final step was creating the launch.json file and learning how to use the vscode tools. I have attached the json files for anyone interested. Here’s a screen shot of a breakpoint on etherport.cpp:
-
AuthorPosts
- You must be logged in to reply to this topic.
OpenSprinkler › Forums › OpenSprinkler Unified Firmware › vscode remote debugging configuration