usage: west: error: argument : invalid choice: 'build'

Hi,

I'm a real novice with this but I'm having this issue and I can't see how to resolve it.

Building HeartRate_sensor
west build --build-dir c:\Users\deirdre.hackett\Nordic\VS_projects\HeartRate_sensor\build c:\Users\anon\Nordic\VS_projects\HeartRate_sensor --pristine --board nrf52840dk_nrf52840 -- -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=On -DNCS_TOOLCHAIN_VERSION:STRING="NONE" -DBOARD_ROOT:STRING="c:/Users/anon/Nordic/VS_projects/HeartRate_sensor"

usage: west [-h] [-z ZEPHYR_BASE] [-v] [-V] <command> ...
west: error: argument <command>: invalid choice: 'build' (choose from 'init', 'update', 'list', 'manifest', 'diff', 'status', 'forall', 'help', 'config', 'topdir', 'selfupdate')
The terminal process failed to launch (exit code: 2).

[12:31:43] west build --build-dir c:\Users\anon\Nordic\VS_projects\HeartRate_sensor\build c:\Users\anon\Nordic\VS_projects\HeartRate_sensor
[12:32:15] Success.
[12:32:44] west build --build-dir c:\Users\anon\Nordic\VS_projects\HeartRate_sensor\build c:\Users\anon\Nordic\VS_projects\HeartRate_sensor
[12:32:45] Success.
[12:32:46] west flash -d c:\Users\anon\Nordic\VS_projects\HeartRate_sensor\build --skip-rebuild -r nrfjprog --snr 683130583
[12:33:03] Success.
IMPORTANT: The data below could contain sensitive or confidential information about your environment.
If you do not wish this to be seen by others, please make sure to remove it before sharing.

For help and support, visit the Nordic DevZone at devzone.nordicsemi.com/.

{
"platform": {
"os": "win32",
"osVersion": "Windows 10 Pro",
"osKernel": "10.0.19044",
"vscode": "1.62.3",
"electron": "13.5.2",
"node": "v14.16.0"
},
"system": {
"date": "2022-05-19T12:06:22.296Z",
"vscodeRoot": "c:\\Program Files\\Microsoft VS Code\\resources\\app",
"nrfConnectForDesktopInstalled": true,
"vscodeUptime": "00:37:37",
"osUptime": "03:29:08",
"cpu": {
"model": "11th Gen Intel(R) Core(TM) i5-1145G7 @ 2.60GHz",
"speed": "1498 MHz",
"count": 4
},
"memory": {
"total": "15.73 GB",
"free": "7.34 GB"
}
},
"workspace": {
"name": "Untitled (Workspace)",
"workspaceFile": "1652798537766",
"folders": [
"c:\\Users\\anon\\Nordic\\VS_projects\\HeartRate_sensor"
]
},
"extensions": {
"internal": {
"nordic-semiconductor.nrf-connect": {
"version": "2022.1.192",
"path": "c:\\Users\\anon\\.vscode\\extensions\\nordic-semiconductor.nrf-connect-2022.1.192",
"isActive": true
},
"nordic-semiconductor.nrf-terminal": {
"version": "2022.4.61",
"path": "c:\\Users\\anon\\.vscode\\extensions\\nordic-semiconductor.nrf-terminal-2022.4.61",
"isActive": true
},
"nordic-semiconductor.devicetree": null,
"nordic-semiconductor.kconfig": null
},
"external": {
"marus25.cortex-debug": "0.4.10",
"ms-vscode.cpptools": "1.7.1",
"ms-vscode-remote.remote-wsl-recommender": "0.0.12",
"ms-vscode.js-debug": "1.62.0",
"ms-vscode.js-debug-companion": "1.0.15",
"ms-vscode.references-view": "0.0.81",
"ms-vscode.vscode-js-profile-table": "0.0.18",
"cschlosser.doxdocgen": "1.4.0",
"jeff-hykin.better-cpp-syntax": "1.15.13",
"ms-vscode.cmake-tools": "1.9.2",
"ms-vscode.cpptools-extension-pack": "1.2.0",
"ms-vscode.cpptools-themes": "1.0.0",
"redhat.vscode-yaml": "1.7.0",
"trond-snekvik.gnu-mapfiles": "1.1.0",
"twxs.cmake": "0.0.17"
}
},
"tools": {
"C:\\Program Files\\Nordic Semiconductor\\nrf-command-line-tools\\bin\\nrfjprog.exe": "10.15.4",
"c:\\Users\\anon\\ncs\\v1.9.1\\toolchain\\opt\\bin\\cmake.exe": "3.20.5",
"c:\\Users\\anon\\ncs\\v1.9.1\\toolchain\\opt\\bin\\Scripts\\west.exe": "0.12.0",
"c:\\Users\\anon\\ncs\\v1.9.1\\toolchain\\opt\\bin\\python.exe": "3.8.2",
"c:\\Users\\anon\\ncs\\v1.9.1\\toolchain\\opt\\bin\\ninja.exe": "1.9.0",
"c:\\Users\\anon\\ncs\\v1.9.1\\toolchain\\opt\\bin\\gperf.exe": "3.1",
"c:\\Users\\anon\\ncs\\v1.9.1\\toolchain\\opt\\bin\\dtc.exe": "1.4.7",
"c:\\Users\\anon\\ncs\\v1.9.1\\toolchain\\opt\\bin\\arm-none-eabi-gcc.exe": "9-2019-q4-major",
"c:\\Users\\anon\\ncs\\v1.9.1\\toolchain\\opt\\bin\\gn.exe": "1977",
"c:\\Users\\anon\\ncs\\v1.9.1\\toolchain\\mingw64\\bin\\git.exe": "2.26.2.windows.1"
},
"connectedDevices": [
{
"id": "683130583"
}
],
"config": {
"nordic-semiconductor.nrf-connect": {
"topdir": "c:\\Users\\anon\\ncs\\v1.9.1",
"toolchain": {
"path": "c:\\Users\\anon\\ncs\\v1.9.1\\toolchain"
},
"ozonePath": "",
"applications": [
"${workspaceFolder}"
],
"jlink": {
"rtosPlugin": ""
},
"kconfig": {
"interface": "kconfig"
},
"welcome": {
"showOnStartup": false
},
"west": {
"env": {
"$base": "terminal"
}
},
"boardRoots": [],
"enableTelemetry": true
},
"nordic-semiconductor.nrf-terminal": {
"terminalMode": "character"
},
"nordic-semiconductor.devicetree": {
"modules": [
"${zephyrBase}",
"${zephyrBase}/../nrf",
"."
],
"zephyr": "",
"ctxFile": "",
"defaultBoard": ""
},
"nordic-semiconductor.kconfig": {
"root": "",
"env": {},
"cfiles": true,
"disable": false,
"zephyr": {
"base": ""
},
"python": "C:\\Program Files\\Python36\\python.exe",
"liveValue": true
},
"marus25.cortex-debug": {
"armToolchainPath": null,
"armToolchainPrefix": "arm-none-eabi",
"gdbPath": null,
"JLinkGDBServerPath": null,
"openocdPath": null,
"pyocdPath": null,
"PEGDBServerPath": null,
"stutilPath": null,
"stlinkPath": null,
"stm32cubeprogrammer": null,
"enableTelemetry": true,
"flattenAnonymous": false,
"registerUseNaturalFormat": true,
"variableUseNaturalFormat": true,
"dbgServerLogfile": null
}
},
"environment": {
"westExe": "c:\\Users\\anon\\ncs\\v1.9.1\\toolchain\\opt\\bin\\Scripts\\west.exe",
"westEnv": {
"ELECTRON_RUN_AS_NODE": "1",
"HOME": "C:\\Users\\anon",
"HOMEDRIVE": "C:",
"HOMEPATH": "\\Users\\anon",
"Path": "c:\\Users\\anon\\ncs\\v1.9.1\\toolchain\\mingw64\\bin;c:\\Users\\anon\\ncs\\v1.9.1\\toolchain\\mingw64\\libexec\\git-core;c:\\Users\\anon\\ncs\\v1.9.1\\toolchain\\opt\\bin;c:\\Users\\anon\\ncs\\v1.9.1\\toolchain\\opt\\bin\\Scripts;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Windows\\System32\\OpenSSH\\;C:\\Program Files\\Wolfram Research\\WolframScript\\;C:\\Program Files\\MATLAB\\R2020b\\runtime\\win64;C:\\Program Files\\MATLAB\\R2020b\\bin;C:\\Program Files\\Microsoft VS Code\\bin;C:\\Program Files\\PuTTY\\;C:\\Program Files\\nodejs\\;C:\\Program Files\\Git\\cmd;C:\\Program Files\\Nordic Semiconductor\\nrf-command-line-tools\\bin\\;C:\\Users\\anon\\AppData\\Local\\Microsoft\\WindowsApps;",
"ZEPHYR_BASE": "c:\\Users\\anon\\ncs\\v1.9.1\\zephyr",
"GNUARMEMB_TOOLCHAIN_PATH": "c:\\Users\\anon\\ncs\\v1.9.1\\toolchain\\opt",
"ZEPHYR_TOOLCHAIN_VARIANT": "gnuarmemb",
"PYTHONPATH": "c:\\Users\\anon\\ncs\\v1.9.1\\toolchain\\opt\\bin;c:\\Users\\anon\\ncs\\v1.9.1\\toolchain\\opt\\bin\\Lib;c:\\Users\\anon\\ncs\\v1.9.1\\toolchain\\opt\\bin\\Lib\\site-packages",
"Python3_ROOT": "c:\\Users\\anon\\ncs\\v1.9.1\\toolchain\\opt\\bin"
},
"toolchainPath": "c:\\Users\\anon\\ncs\\v1.9.1\\toolchain",
"toolchainBinPath": "c:\\Users\\anon\\ncs\\v1.9.1\\toolchain\\opt\\bin",
"toolchainVersion": "1.9.1"
},
"terminal": {
"shell": null,
"defaultProfile": null
}
}

IMPORTANT: The data below could contain sensitive or confidential information about your environment.
If you do not wish this to be seen by others, please make sure to remove it before sharing.

For help and support, visit the Nordic DevZone at devzone.nordicsemi.com/.

{
"platform": {
"os": "win32",
"osVersion": "Windows 10 Pro",
"osKernel": "10.0.19044",
"vscode": "1.62.3",
"electron": "13.5.2",
"node": "v14.16.0"
},
"system": {
"date": "2022-05-19T12:06:54.056Z",
"vscodeRoot": "c:\\Program Files\\Microsoft VS Code\\resources\\app",
"nrfConnectForDesktopInstalled": true,
"vscodeUptime": "00:38:08",
"osUptime": "03:29:40",
"cpu": {
"model": "11th Gen Intel(R) Core(TM) i5-1145G7 @ 2.60GHz",
"speed": "1498 MHz",
"count": 4
},
"memory": {
"total": "15.73 GB",
"free": "7.27 GB"
}
},
"workspace": {
"name": "Untitled (Workspace)",
"workspaceFile": "1652798537766",
"folders": [
"c:\\Users\\anon\\Nordic\\VS_projects\\HeartRate_sensor"
]
},
"extensions": {
"internal": {
"nordic-semiconductor.nrf-connect": {
"version": "2022.1.192",
"path": "c:\\Users\\anon\\.vscode\\extensions\\nordic-semiconductor.nrf-connect-2022.1.192",
"isActive": true
},
"nordic-semiconductor.nrf-terminal": {
"version": "2022.4.61",
"path": "c:\\Users\\anon\\.vscode\\extensions\\nordic-semiconductor.nrf-terminal-2022.4.61",
"isActive": true
},
"nordic-semiconductor.devicetree": null,
"nordic-semiconductor.kconfig": null
},
"external": {
"marus25.cortex-debug": "0.4.10",
"ms-vscode.cpptools": "1.7.1",
"ms-vscode-remote.remote-wsl-recommender": "0.0.12",
"ms-vscode.js-debug": "1.62.0",
"ms-vscode.js-debug-companion": "1.0.15",
"ms-vscode.references-view": "0.0.81",
"ms-vscode.vscode-js-profile-table": "0.0.18",
"cschlosser.doxdocgen": "1.4.0",
"jeff-hykin.better-cpp-syntax": "1.15.13",
"ms-vscode.cmake-tools": "1.9.2",
"ms-vscode.cpptools-extension-pack": "1.2.0",
"ms-vscode.cpptools-themes": "1.0.0",
"redhat.vscode-yaml": "1.7.0",
"trond-snekvik.gnu-mapfiles": "1.1.0",
"twxs.cmake": "0.0.17"
}
},
"tools": {
"C:\\Program Files\\Nordic Semiconductor\\nrf-command-line-tools\\bin\\nrfjprog.exe": "10.15.4",
"c:\\Users\\anon\\ncs\\v1.9.1\\toolchain\\opt\\bin\\cmake.exe": "3.20.5",
"c:\\Users\\anon\\ncs\\v1.9.1\\toolchain\\opt\\bin\\Scripts\\west.exe": "0.12.0",
"c:\\Users\\anon\\ncs\\v1.9.1\\toolchain\\opt\\bin\\python.exe": "3.8.2",
"c:\\Users\\anon\\ncs\\v1.9.1\\toolchain\\opt\\bin\\ninja.exe": "1.9.0",
"c:\\Users\\anon\\ncs\\v1.9.1\\toolchain\\opt\\bin\\gperf.exe": "3.1",
"c:\\Users\\anon\\ncs\\v1.9.1\\toolchain\\opt\\bin\\dtc.exe": "1.4.7",
"c:\\Users\\anon\\ncs\\v1.9.1\\toolchain\\opt\\bin\\arm-none-eabi-gcc.exe": "9-2019-q4-major",
"c:\\Users\\anon\\ncs\\v1.9.1\\toolchain\\opt\\bin\\gn.exe": "1977",
"c:\\Users\\anon\\ncs\\v1.9.1\\toolchain\\mingw64\\bin\\git.exe": "2.26.2.windows.1"
},
"connectedDevices": [
{
"id": "683130583"
}
],
"config": {
"nordic-semiconductor.nrf-connect": {
"topdir": "c:\\Users\\anon\\ncs\\v1.9.1",
"toolchain": {
"path": "c:\\Users\\anon\\ncs\\v1.9.1\\toolchain"
},
"ozonePath": "",
"applications": [
"${workspaceFolder}"
],
"jlink": {
"rtosPlugin": ""
},
"kconfig": {
"interface": "kconfig"
},
"welcome": {
"showOnStartup": false
},
"west": {
"env": {
"$base": "terminal"
}
},
"boardRoots": [],
"enableTelemetry": true
},
"nordic-semiconductor.nrf-terminal": {
"terminalMode": "character"
},
"nordic-semiconductor.devicetree": {
"modules": [
"${zephyrBase}",
"${zephyrBase}/../nrf",
"."
],
"zephyr": "",
"ctxFile": "",
"defaultBoard": ""
},
"nordic-semiconductor.kconfig": {
"root": "",
"env": {},
"cfiles": true,
"disable": false,
"zephyr": {
"base": ""
},
"python": "C:\\Program Files\\Python36\\python.exe",
"liveValue": true
},
"marus25.cortex-debug": {
"armToolchainPath": null,
"armToolchainPrefix": "arm-none-eabi",
"gdbPath": null,
"JLinkGDBServerPath": null,
"openocdPath": null,
"pyocdPath": null,
"PEGDBServerPath": null,
"stutilPath": null,
"stlinkPath": null,
"stm32cubeprogrammer": null,
"enableTelemetry": true,
"flattenAnonymous": false,
"registerUseNaturalFormat": true,
"variableUseNaturalFormat": true,
"dbgServerLogfile": null
}
},
"environment": {
"westExe": "c:\\Users\\anon\\ncs\\v1.9.1\\toolchain\\opt\\bin\\Scripts\\west.exe",
"westEnv": {
"ELECTRON_RUN_AS_NODE": "1",
"HOME": "C:\\Users\\anon",
"HOMEDRIVE": "C:",
"HOMEPATH": "\\Users\\anon",
"Path": "c:\\Users\\anon\\ncs\\v1.9.1\\toolchain\\mingw64\\bin;c:\\Users\\anon\\ncs\\v1.9.1\\toolchain\\mingw64\\libexec\\git-core;c:\\Users\\anon\\ncs\\v1.9.1\\toolchain\\opt\\bin;c:\\Users\\anon\\ncs\\v1.9.1\\toolchain\\opt\\bin\\Scripts;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Windows\\System32\\OpenSSH\\;C:\\Program Files\\Wolfram Research\\WolframScript\\;C:\\Program Files\\MATLAB\\R2020b\\runtime\\win64;C:\\Program Files\\MATLAB\\R2020b\\bin;C:\\Program Files\\Microsoft VS Code\\bin;C:\\Program Files\\PuTTY\\;C:\\Program Files\\nodejs\\;C:\\Program Files\\Git\\cmd;C:\\Program Files\\Nordic Semiconductor\\nrf-command-line-tools\\bin\\;C:\\Users\\anon\\AppData\\Local\\Microsoft\\WindowsApps;",
"ZEPHYR_BASE": "c:\\Users\\anon\\ncs\\v1.9.1\\zephyr",
"GNUARMEMB_TOOLCHAIN_PATH": "c:\\Users\\anon\\ncs\\v1.9.1\\toolchain\\opt",
"ZEPHYR_TOOLCHAIN_VARIANT": "gnuarmemb",
"PYTHONPATH": "c:\\Users\\anon\\ncs\\v1.9.1\\toolchain\\opt\\bin;c:\\Users\\anon\\ncs\\v1.9.1\\toolchain\\opt\\bin\\Lib;c:\\Users\\anon\\ncs\\v1.9.1\\toolchain\\opt\\bin\\Lib\\site-packages",
"Python3_ROOT": "c:\\Users\\anon\\ncs\\v1.9.1\\toolchain\\opt\\bin"
},
"toolchainPath": "c:\\Users\\anon\\ncs\\v1.9.1\\toolchain",
"toolchainBinPath": "c:\\Users\\anon\\ncs\\v1.9.1\\toolchain\\opt\\bin",
"toolchainVersion": "1.9.1"
},
"terminal": {
"shell": null,
"defaultProfile": null
}
}

  • Hello Deirdre, 

    I'm a real novice with this but I'm having this issue and I can't see how to resolve it.

    No worries. Let's see if we can find the solution to this. Thank you for providing the support information! Slight smile

    The initial part I noticed is the two paths in the build command:

    west build --build-dir c:\Users\deirdre.hackett\Nordic\VS_projects\HeartRate_sensor\build c:\Users\anon\Nordic\VS_projects\HeartRate_sensor

    C:\Users\deirdre.hackett\....

    C:\Users\anon\...

    Is this the same folders?

    usage: west [-h] [-z ZEPHYR_BASE] [-v] [-V] <command> ...
    west: error: argument <command>: invalid choice: 'build' (choose from 'init', 'update', 'list', 'manifest', 'diff', 'status', 'forall', 'help', 'config', 'topdir', 'selfupdate')
    The terminal process failed to launch (exit code: 2).

    Looks like it does not find West, this is usually due to missing Zephyr base. However, in the provided support information it is defined: "ZEPHYR_BASE": "c:\\Users\\anon\\ncs\\v1.9.1\\zephyr",

    Have you installed the nRF Connect SDK using our Toolchain Manager?  Did you open VS Code from the Toolchain Manager? 

    Kind regards,
    Øyvind

  • Hi Øyvind,

    I was trying to anonimise myself but it didn't work obviously Slight smile

    Thanks for your reply.

    I resolved this by uninstalling the SDK and reinstalling in another folder.

    I have another issue related to the installation.

    Should I continue in this question or start a new one?

    I/my admin  installed the SDK and visual studio though the nRF connect tool chain manager.

    When i open visual studio through the toolchain manager it prompts me

    to "Select a kit for..."

    with the two option 

    Scan for kits (...compilers...)

    unspecified

    When I try to debug it gives me the message 

    Unable to start debugging: Unable to find J-Link directory to find JLinkGDBServerCL executable. Please make sure that J-Link is installed and that the 'HKEY_LOCAL_MACHINE\Software\SEGGER\J-Link' registry key is defined correctly.

    This is installed on a admin controlled machine where I just have a user profile.

    Any insight you can provide into how to resolve this would be appreciated.

    I will need to pass on the fix to my administrator as I have no control over the installation.

    Is there an issue with installing as an administrator and running as a user?Issues with Debugging using VScode with nRF connect and nrf sdk2.docx

    REgards,

    Deirdre

  • When I select scan for kits nothing happens 

    When i select unspecified:

    [variant] Loaded new set of variants
    [kit] Successfully loaded 0 kits from C:\Users\deirdre.hackett\AppData\Local\CMakeTools\cmake-tools-kits.json
    [kit] Successfully loaded 0 kits from C:\Users\deirdre.hackett\AppData\Local\CMakeTools\cmake-tools-kits.json
    [main] Configuring folder: hello_world_test5
  • Hi Deidre,

    Dtyn said:
    I was trying to anonimise myself but it didn't work obviously Slight smile

    Sorry, your name was visible in the path. Sweat smile

    Dtyn said:
    I resolved this by uninstalling the SDK and reinstalling in another folder.

    I'm happy to hear you solved the initial issue.

    Dtyn said:
    Should I continue in this question or start a new one?

    As it is not related to original topic of the ticket, you should register a new ticket. That said, the "select a kit for..." message is not related to the nRF Connect for VS Code extension but another extension in VS Code I believe. It is unfortunately misleading, and it can be ignored.

    In you case, you should check what devices are connected under "Connected devices" in the nRF Connect extension

    I will forward your feedback to our VS code extension team, as this is valuable information in regards to user experience. 

    Dtyn said:

    When I try to debug it gives me the message 

    Unable to start debugging: Unable to find J-Link directory to find JLinkGDBServerCL executable. Please make sure that J-Link is installed and that the 'HKEY_LOCAL_MACHINE\Software\SEGGER\J-Link' registry key is defined correctly.

    What debug button are you clicking? Make sure to use the one in our extension: 

    Kind regards,
    Øyvind

  • Thanks for your reply.

    I've created another ticket to continue this issue.

    To answer your last question:

     Yes I am definitely pressing the debug button in the nRF Connect extension.

    My admin installed everything in his admin profile other than VS code that he installed as a network device.

    Let me know if there other information you need to see.

    Is this an issue with an environment variable or registry key?

Related