Vs Code 调用 安川 MotoPlus >>> 二次开发

流程

  1. 安装MotoPlusIDE
  2. 配置 VS Code
  3. 编写代码
  4. 运行任务>编译 (生成 *.a *.d 文件)
  5. 生成.out文件
  6. 拷贝到控制器上(具体操作看手册 可以U盘 也可与网络传输 需要重启)

VS Code 配置

c_cpp_properties.json 配置

{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "C:\\Program Files (x86)\\Yaskawa\\MotoPlusIDE_DN\\mpbuilder\\inc",
                "C:\\Program Files (x86)\\Yaskawa\\MotoPlusIDE_DN\\mpbuilder\\gnu\\4.3.3-vxworks-6.9\\lib\\gcc\\i586-wrs-vxworks\\4.3.3\\include"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "windowsSdkVersion": "10.0.10240.0",
            "cStandard": "c11",
            "cppStandard": "c++17",
            "intelliSenseMode": "msvc-x64"
        }
    ],
    "version": 4
}

launch.json 配置

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "yrc1000_c",
            "type": "cppdbg",
            "request": "launch",
            // g++ -g 生成的调试用目标文件名
            "program": "ccpentium.exe",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceRoot}",
            "environment": [],
            "externalConsole": true,
            "MIMode": "gdb",
            // 输入 gdb 的路径 (有些情况下需要绝对路径)
            "miDebuggerPath": "gdb.exe",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ],
            // task.json 中指定的调试目标文件编译命令
            // 这样可以在调试前免去手动执行 build-debug 的一步
            "preLaunchTask": "build-debug"
        }
    ]
}

settings.json 配置

{
    "files.associations": {
        "motoplus.h": "c",
        "stdio.h": "c",
        "stdlib.h": "c",
        "mpstopwatch.h": "c",
        "mprs232c.h": "c",
        "mpsensctrl.h": "c",
        "mpsrvoctrl.h": "c",
        "mpciodef.h": "c",
        "mplegapi00.h": "c",
        "mpexfilectrl.h": "c",
        "mpsrvofcs.h": "c",
        "mpkmcevnt.h": "c",
        "mpmempart.h": "c",
        "string.h": "c",
        "stddef.h": "c",
        "mpparams.h": "c",
        "winsock2.h": "c",
        "time.h": "c",
        "limits.h": "c",
        "GET_POS.C": "cpp"
    },
    "C_Cpp.intelliSenseEngineFallback": "Disabled"
}

tasks.json 配置

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "编译",
            "type": "shell",
            "command": "ccpentium.exe",
            "args": [
                "-march=atom",
                "-nostdlib",
                "-fno-builtin",
                "-fno-defer-pop",
                "-fno-implicit-fp",
                "-fno-zero-initialized-in-bss",
                "-Wall",
                "-Werror-implicit-function-declaration",
                "-g",
                "-MD",
                "-MP",
                "-DCPU=_VX_ATOM",
                "-DTOOL_FAMILY=gnu",
                "-DTOOL=gnu",
                "-D_WRS_KERNEL",
                "-I",
                "${workspaceRoot}",
                "-I",  
                "C:\\Program Files (x86)\\Yaskawa\\MotoPlusIDE_DN\\mpbuilder\\inc", 
                "-c",
                "${file}",
                "-o",
                "${workspaceRoot}\\myout\\${fileBasenameNoExtension}.a"

            ],
            "group": "build",
            "presentation": {
                "reveal": "silent"
            },
            "problemMatcher": "$msCompile"
        },
        {
            "label": "生成out",
            "type": "shell",
            "command": "ccpentium.exe",
            "args": [

                "-nostdlib",
                "-r",
                "-WI",
                ",-X","-WI",
                "~FileList~",
                "-o","~OutputPath~"

            ],
            "group": "build",
            "presentation": {

                "reveal": "silent"
            },

            "problemMatcher": "$msCompile"
        }
    ]
}

将 C:\Program Files (x86)\Yaskawa\MotoPlusIDE_DN 替换为你的安装目录

这是我的安装目录


运行任务___
编译或生成out

生成的 .a .d 文件

在这里插入图片描述

评论 14
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

MingYang_jin

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值