but they all have different env with me, so I still finding the procession for this target:
debugging Arduino UNO project in vs code by simavr om ubuntu.
But I DON’T KNOW HOW TO GO NEXT.
Should I create project in GUI interface of platformIO, or I should should continuously stay in CLI just as one start a new project in " New Terminal’ in VS Code.
The experience before mislead me, I tried debug in this way with Arduino extension for vs code, it didn’t work, so I have thought it should be avoided when I start to use extension platformIO.
Another question, I saw in other article, arduino extension maybe conflict with platformIO, so one should remove it before using platforIO extension. I saw this conflict prompt on windows 10, but I’m not sure if I could continuously verify Arduino code in vs code by platformIO, so I haven’t removed it till now. after all, all code were verified and uploaded bu Arduino extension.
additionally, there was no prompt of extensions conflict in ubuntu, should I also remove it(Arduino extension for vs code) before I use platformIO extension ?
Disable the Arduino VSCode extension if you intend to use PlatformIO - it will cause you grief in the future. You have the choice of either disabling it on a per workspace level if you want to use it sometimes, disabling it completely, or uninstalling the extension.
Also, you should not have needed to install SimAVR at all - PlatformIO would have installed it’s own version (and probably did anyway, and will be using that instead of the version you installed) the first time you tried to debug the project.
In other words,
install VS Code
install “platformIO” extension in VS Code
Add in “platformio.ini”:
[env:myenv]
platform = atmelavr
board = uno
debug_tool = simavr
Set some breakpoints (click to the left of line number for that line to get the red dot).
Start debugging (Debug sidebar icon -> Run arrow up the top or press F5 key)
Press F5 again (or Continue debug control button) to continue past the Arduino int main() into your own code.
Just as use Arduino extension in VS Code, you should always use CLI:
mkdir dir cd …then, code .(note, between code and ., there must a space, no space is not OK, more than one is still OK)
No, never. It is provided by the Arduino framework, so if it can’t be found, there is something seriously wrong with either your installation, or your configuration.
If you have never compiled something for the Arduino framework, it could be that the framework files haven’t been downloaded yet, meaning it’s a legitimate error at the time, but will be rectified at build time. Or your platformio.ini configuration may not have the 'framework = arduinoconfiguration parameter. Or perhaps yourframework-arduino` is corrupt, and needs re-installing.
Not quite sure what is happening here… sounds like you’re having some scope issues, when telling VSCode what folder to open. If you had a project at say ~/projects/MyProject, doing code ~/projects/MyProject would probably also work… not need to use cd to change to that directory.
I found debugging made by PLatformIO for Arduino is simulate, not emulate, that is to say, it could not debug behave on board. And I found it was because Atmel didn’t opened its related file.
There’s two options for debugging atmelavr hardware with platformio… both extremely new so not extensively tested. There’s simavr (sim as in simluate), which you can do without the hardware, but it’s not 100% like the actual hardware. There is also avr-debugger, which you can find out more about in this thread, and runs on the actual hardware.
However, if you’ve switched to Atmel Studio so you can use your Atmel ICE, and it’s working for you, I’d stick with what you have, since it works