Getting out of Arduino

Ok, Thanks a lot guys for your help! I got this to work finally. It didn’t work out of the box and had to do the following:

Updated local settings to the following: c_cpp_properties.json

{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "C:/Users/<USER>/Documents/Arduino/hardware/Move38-manual/avr/**",
                "C:/repos/Blinks/Blinks-SDK/cores/blinklib/**",
                "C:\\Users\\farbl\\Documents\\Arduino\\hardware\\Move38-manual\\avr\\**"
            ],
            "defines": [
                "F_CPU=8000000L",
                "ARDUINO=10813",
                "ARDUINO_AVR_BLINK",
                "ARDUINO_ARCH_AVR"
            ],
            "forcedInclude": [],
            "intelliSenseMode": "clang-x64",
            "compilerPath": "C:/Program Files (x86)/Arduino/hardware/tools/avr/bin/avr-gcc.exe",
            "cStandard": "c11",
            "cppStandard": "c++17"
        }
    ],
    "version": 4
}

Some of these are defaults, except:

  • Include path, added the SDK ones
  • Defines, copied them from SDK’s platform.txt (not sure if this is needed or not, but noticed these are used when using procmon)
  • Updated compiler path to point to Arduino

Also needed to change Intelli Sense engine to TagParser in settings.json as:

{
	"C_Cpp.intelliSenseEngine": "Tag Parser"
}

I then did CTRL+SHIFT+P to get Arduino commands and did init, select board, select programmer. This resulted in the following arduino.json:

{
    "sketch": "test.ino",
    "board": "Move38-manual:avr:blink",
    "programmer": "USBtinyISP",
    "port": "dummy"
}

Note the dummy port above I had to add later after upload was failing, looked at the extension source code and was checking for !dc.port, this dummy value seems to bypass this code block and upload worked after!

Also in the verify process I encountered the following warning:

blinklib.cpp:600:77: warning: invalid conversion from 'const volatile uint8_t* {aka const volatile unsigned char*}' to 'const uint8_t* {aka const unsigned char*}' [-fpermissive]

                             const uint8_t *datagramPayloadData =  packetData+1;    // Skip the packet header byte

                                                                   ~~~~~~~~~~^~

A cast seems to fix this:

const uint8_t *datagramPayloadData = (const uint8_t *) packetData+1; // Skip the packet header byte

One final note, that may be helpful, is instead of copying the SDK to Arduino folder, I created a symbolic link, like (windows):

cd %userprofile%\Documents\Arduino\hardware\Move38-manual
mklink /D avr C:\repos\Blinks\Blinks-SDK

Time to try some coding! :slight_smile: