Skip to content

Commit

Permalink
Merge #21
Browse files Browse the repository at this point in the history
21: Convert `launch.json` properties to camelCase r=Tiwalun a=noppej

*Note:* The changes in this PR is dependent on being synchronized with [probe-rs PR #885](probe-rs/probe-rs#885)

*Changes*
* Convert all existing `launch.json` properties to camelCase
* Updates to README

Co-authored-by: JackN <[email protected]>
  • Loading branch information
bors[bot] and noppej authored Nov 12, 2021
2 parents 700083f + 8867726 commit a35df1b
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 46 deletions.
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ To work on this extensions, you first need to install VS Code and nodejs. Afterw
```bash
yarn
```
- Install a VS Code extension necessary for development:
- Install the extensions VS Code recommends. If you prefer to do this manually, you can find the list of recommended extensions in the repository's `.vscode/settings.json' file. These can then be installed from the command line, for example:
```bash
code --install-extension amodio.tsl-problem-matcher
```
Expand All @@ -47,5 +47,20 @@ To work on this extensions, you first need to install VS Code and nodejs. Afterw
* Select the debug environment `probe_rs Server Test`.
* Press `F5` to start debugging.

## Generating and releasing the extension
Because the extension is still regarded as being in 'Alpha' state, it is NOT being released on the Microsoft Visual Studio Code Extension Marketplace. The only way to get access to updated versions of the extension is to build it yourself, or to download it from the [GitHub release page](#development-setup) for this extension.

### Build the extension
Building the extension refers to the process that generates the installable `.vsix` package.
* Follow the instructions to [setup your development environment](#development-setup).
* In a terminal window, execute the following command:
```
yarn probe-rs:package
```
* This will generate a .vsix file in the root of the repository

### Updating the GitHub release page
* Whenever any PR has been merged, you need to create a new release and upload the `.vsix` in the repository's [release page](https://github.com/probe-rs/vscode/releases).
* This means that every PR needs to update the version number appropriately in the `package.json` file. Please [see the Semantic Versioning guidelines](https://semver.org/).
76 changes: 38 additions & 38 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "probe-rs-debugger",
"displayName": "Debugger for probe-rs",
"version": "0.3.0",
"version": "0.3.1",
"publisher": "probe-rs",
"description": "probe-rs Debug Adapter for VS Code.",
"author": {
Expand Down Expand Up @@ -91,7 +91,7 @@
"configurationAttributes": {
"launch": {
"required": [
"program_binary",
"programBinary",
"chip"
],
"properties": {
Expand All @@ -100,7 +100,7 @@
"description": "Optionally onnect to an existing `probe-rs-debugger` session on IP and Port, e.g. '127.0.0.1:50000'",
"default": "127.0.0.1:50000"
},
"program_binary": {
"programBinary": {
"type": "string",
"description": "The path (relative to `cwd` or absolute) to the binary for your target firmware",
"default": "./target/debug/thumbv7em-none-eabihf/${workspaceFolderBasename}"
Expand All @@ -114,7 +114,7 @@
"type": "string",
"description": "Please specify the appropriate chip from the list of supported chips reported by running `probe-rs-debugger list-chips`."
},
"core_index": {
"coreIndex": {
"type": "number",
"description": "The zero based index of the MCU core for this session",
"default": 0
Expand Down Expand Up @@ -143,15 +143,15 @@
"type": "number",
"description": "Specify the protocol speed in kHz."
},
"wire_protocol": {
"wireProtocol": {
"type": "string",
"description": "The correct wire Protocol to use.",
"enum": [
"Swd",
"Jtag"
]
},
"console_log_level": {
"consoleLogLevel": {
"type": "string",
"description": "The level of log info printed to the console. This also sets the RUST_LOG environment variable wherever possible.",
"enum": [
Expand All @@ -163,49 +163,49 @@
],
"default": "Error"
},
"connect_under_reset": {
"connectUnderReset": {
"type": "boolean",
"description": "This option will result in the target reset pin being held high during the attach operation.",
"default": false
},
"flashing_enabled": {
"flashingEnabled": {
"type": "boolean",
"description": "Flash the target before debugging.",
"default": true
},
"reset_after_flashing": {
"resetAfterFlashing": {
"type": "boolean",
"description": "Reset the target after flashing.",
"default": true
},
"halt_after_reset": {
"haltAfterReset": {
"type": "boolean",
"description": "Halt the target after reset.",
"default": true
},
"full_chip_erase": {
"fullChipErase": {
"type": "boolean",
"description": "Do a full chip erase, versus page-by-page erase.",
"default": false
},
"restore_unwritten_bytes": {
"restoreUnwrittenBytes": {
"type": "boolean",
"description": "Restore erased bytes that will not be rewritten from ELF.",
"default": false
},
"rtt_enabled": {
"rttEnabled": {
"type": "boolean",
"description": "If true, the debugger will open an RTT Terminal tab for each of the active channels on the target.",
"default": false
},
"rtt_channel_formats": {
"rttChannelFormats": {
"type": "array",
"items": {
"channel_number": {
"channelNumber": {
"type": "number",
"description": "The channel number to which this data format applies. If any active channel numbers are omitted, we will assume the default will be `format=String', and 'show_timestamps=false'."
"description": "The channel number to which this data format applies. If any active channel numbers are omitted, we will assume the default will be `dataFormat=String', and 'showTimestamps=false'."
},
"data_format": {
"dataFormat": {
"type": "string",
"description": "One of the supported data formats for RTT channels.",
"enum": [
Expand All @@ -220,10 +220,10 @@
],
"default": "String"
},
"show_timestamps": {
"showTimestamps": {
"type": "boolean",
"default": false,
"description": "Enable the inclusion of timestamps in the RTT output for `data_format=String`."
"description": "Enable the inclusion of timestamps in the RTT output for `dataFormat=String`."
}
}
}
Expand All @@ -232,15 +232,15 @@
"attach": {
"required": [
"chip",
"program_binary"
"programBinary"
],
"properties": {
"server": {
"type": "string",
"description": "Optionally onnect to an existing `probe-rs-debugger` session on IP and Port, e.g. '127.0.0.1:50000'",
"default": "127.0.0.1:50000"
},
"program_binary": {
"programBinary": {
"type": "string",
"description": "The path (relative to `cwd` or absolute) to the binary for your target firmware",
"default": "./target/thumbv7em-none-eabihf/debug/${workspaceFolderBasename}"
Expand All @@ -254,7 +254,7 @@
"type": "string",
"description": "Please specify the appropriate chip from the list of supported chips reported by running `probe-rs-debugger list-chips`."
},
"core_index": {
"coreIndex": {
"type": "number",
"description": "The zero based index of the MCU core for this session",
"default": 0
Expand Down Expand Up @@ -283,15 +283,15 @@
"type": "number",
"description": "Specify the protocol speed in kHz."
},
"wire_protocol": {
"wireProtocol": {
"type": "string",
"description": "The correct wire Protocol to use.",
"enum": [
"Swd",
"Jtag"
]
},
"console_log_level": {
"consoleLogLevel": {
"type": "string",
"description": "The level of log info printed to the console. This also sets the RUST_LOG environment variable wherever possible.",
"enum": [
Expand All @@ -303,19 +303,19 @@
],
"default": "Error"
},
"rtt_enabled": {
"rttEnabled": {
"type": "boolean",
"description": "If true, the debugger will open an RTT Terminal tab for each of the active channels on the target.",
"default": false
},
"rtt_channel_formats": {
"rttChannelFormats": {
"type": "array",
"items": {
"channel_number": {
"channelNumber": {
"type": "number",
"description": "The channel number to which this data format applies. If any active channel numbers are omitted, we will assume the default will be `format=String', and 'show_timestamps=false'."
"description": "The channel number to which this data format applies. If any active channel numbers are omitted, we will assume the default will be `dataFormat=String', and 'showTimestamps=false'."
},
"data_format": {
"dataFormat": {
"type": "string",
"description": "One of the supported data formats for RTT channels.",
"enum": [
Expand All @@ -330,10 +330,10 @@
],
"default": "String"
},
"show_timestamps": {
"showTimestamps": {
"type": "boolean",
"default": false,
"description": "Enable the inclusion of timestamps in the RTT output for `data_format=String`."
"description": "Enable the inclusion of timestamps in the RTT output for `dataFormat=String`."
}
}
}
Expand All @@ -345,12 +345,12 @@
"type": "probe-rs-debug",
"request": "launch",
"name": "probe-rs Test",
"program_binary": "./target/debug/thumbv7em-none-eabihf/${workspaceFolderBasename}",
"programBinary": "./target/debug/thumbv7em-none-eabihf/${workspaceFolderBasename}",
"chip": "STM32H745ZITx",
"connect_under_reset": true,
"flashing_enabled": true,
"reset_after_flashing": true,
"halt_after_reset": true
"connectUnderReset": true,
"flashingEnabled": true,
"resetAfterFlashing": true,
"haltAfterReset": true
}
],
"configurationSnippets": [
Expand All @@ -361,9 +361,9 @@
"type": "probe-rs-debug",
"request": "launch",
"name": "probe-rs Test",
"program_binary": "./target/debug/thumbv7em-none-eabihf/${workspaceFolderBasename}",
"programBinary": "./target/debug/thumbv7em-none-eabihf/${workspaceFolderBasename}",
"chip": "STM32H745ZITx",
"connect_under_reset": true
"connectUnderReset": true
}
}
]
Expand Down
14 changes: 7 additions & 7 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ class ProbeRSDebugAdapterServerDescriptorFactory implements vscode.DebugAdapterD
// Make sure we have a terminal window per channel, for RTT Logging
if (vscode.debug.activeDebugSession) {
let session = vscode.debug.activeDebugSession;
if (session.configuration.hasOwnProperty('rtt_enabled') &&
session.configuration.rtt_enabled) {
if (session.configuration.hasOwnProperty('rttEnabled') &&
session.configuration.rttEnabled) {
let channelWriteEmitter = new vscode.EventEmitter<string>();
let channelPty: vscode.Pseudoterminal = {
onDidWrite: channelWriteEmitter.event,
Expand Down Expand Up @@ -134,10 +134,10 @@ class ProbeRSDebugAdapterServerDescriptorFactory implements vscode.DebugAdapterD

switch (customEvent.event) {
case 'probe-rs-rtt-channel-config':
this.createRttTerminal(+customEvent.body?.channel_number, customEvent.body?.data_format, customEvent.body?.channel_name);
this.createRttTerminal(+customEvent.body?.channelNumber, customEvent.body?.dataFormat, customEvent.body?.channelName);
break;
case 'probe-rs-rtt-data':
let incomingChannelNumber: number = +customEvent.body?.channel_number;
let incomingChannelNumber: number = +customEvent.body?.channelNumber;
for (var [channelNumber, dataFormat, , channelWriteEmitter] of this.rttTerminals) {
if (channelNumber === incomingChannelNumber) {
switch (dataFormat) {
Expand Down Expand Up @@ -176,7 +176,7 @@ class ProbeRSDebugAdapterServerDescriptorFactory implements vscode.DebugAdapterD
}

async createDebugAdapterDescriptor(session: vscode.DebugSession, executable: vscode.DebugAdapterExecutable | undefined): Promise<vscode.DebugAdapterDescriptor | null | undefined> {
probeRsLogLevel = session.configuration.console_log_level;
probeRsLogLevel = session.configuration.consoleLogLevel;

// Initiate either the 'attach' or 'launch' request.
// We do NOT use DebugAdapterExecutable
Expand Down Expand Up @@ -210,8 +210,8 @@ class ProbeRSDebugAdapterServerDescriptorFactory implements vscode.DebugAdapterD
args.push(debugServer[1]);

var logEnv = 'error'; //This is the default
if (session.configuration.hasOwnProperty('console_log_level')) {
logEnv = session.configuration.console_log_level.toLowerCase();
if (session.configuration.hasOwnProperty('consoleLogLevel')) {
logEnv = session.configuration.consoleLogLevel.toLowerCase();
};

var options = {
Expand Down

0 comments on commit a35df1b

Please sign in to comment.