How to manually add a custom memory section

nRF Connect for VS Code

tags
nRF Connect for VS Code

You can also manually add a custom memory section directly in the launch.json file. Complete the following steps to manually add a custom memory section tab:

  1. Click the Configure debugging button (the cog wheel) that is to the right of Debug in the extension's Actions View.
    This opens the launch.json in your current workspace.
  2. Extend the configuration by adding a memorySections array to it.
    The following example shows how to add a 1-KB custom section that starts at the address 0xCAFE0000:

    Extend launch.json with a custom memory section
    [
      {
        "symbol": "symbol",
      },
      {
        "name": "Custom_section",
        "start": "0xCAFE0000",
        "size": 1024
      },
    ]
    
    • The start property defines the start address of the section.
    • The size property defines the number of bytes from the start address that the property should span.
    • Either integers or hex strings can be used for start, and only integers are valid for size.

    A validation check is run against these values and a warning message appears if they are invalid.

    The launch.json file should now include a memorySections array and look like the following:

    Full configuration
    {
        "configurations": [
            {
                "type": "nrf-connect",
                "request": "launch",
                "config": "${activeConfig}",
                "name": "Launch nRF Connect application",
                "memorySections": [
                    { "name": "Custom_section", "start": "0xCAFE0000", "size": 1024 }
                ]
            }
        ]
    }
    
  3. Save the file.

  4. Click Debug from the Actions View.
  5. Once the Debug toolbar appears in the editor, click on the Pause button.
  6. Open the nRF Debug panel from the Panel View (Ctrl-J).

You can now see the custom region tab in the Memory Explorer.