{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://catalog.lintel.tools/schemas/schemastore/img-catapult-psp/versions/1.0.0.json",
  "title": "JSON schema for Catapult PSP contents.yaml files",
  "description": "Used to validate Catapult Platform Support Pack (PSP) contents.yaml file, which provides an index of the files within the PSP",
  "x-lintel": {
    "source": "https://www.schemastore.org/img-catapult-psp-1.0.0.json",
    "sourceSha256": "33e02ed2bfb3ff62191d3653560bab8454edbdb0d3cfd6ad0dd3260e947a7252",
    "fileMatch": [
      "contents.yaml"
    ],
    "parsers": [
      "yaml"
    ]
  },
  "type": "object",
  "properties": {
    "platform": {
      "description": "Catapult platform support file contents",
      "type": "object",
      "properties": {
        "vendor": {
          "type": "string",
          "description": "Platform/device vendor name"
        },
        "name": {
          "type": "string",
          "description": "Name of platform - used to identify platform in IDE",
          "maxLength": 30
        },
        "description": {
          "type": "string",
          "description": "Full description of support pack"
        },
        "buildConfig": {
          "type": "string",
          "description": "Value of the PLATFORM macro definition used during build",
          "pattern": "^([A-Z]|[0-9]|_)+$"
        },
        "version": {
          "type": "string",
          "description": "Support pack version"
        },
        "license": {
          "type": "string",
          "description": "License text"
        },
        "documentationFile": {
          "$ref": "#/$defs/supportPackFile",
          "description": "Documentation file(s) - can be HTML or PDF"
        },
        "coreDescriptionFile": {
          "$ref": "#/$defs/supportPackFile",
          "description": "File containing description of core using IMG proprietary YAML format"
        },
        "peripheralRegisterDescriptionFile": {
          "$ref": "#/$defs/supportPackFile",
          "description": "File containing peripheral register information using CMSIS SVD XML format (see <https://www.keil.com/pack/doc/CMSIS/SVD/html/svd_Format_pg.html)>"
        },
        "openOCDConfigurationFile": {
          "$ref": "#/$defs/supportPackFile",
          "description": "File containing OpenOCD configuration (see <https://openocd.org/doc-release/html/Config-File-Guidelines.html#Config-File-Guidelines)>"
        },
        "launchConfig": {
          "type": "string",
          "description": "Launch configuration for platform",
          "pattern": "^(Alpine Model|Catapult Model|OpenOCD|Whisper|RemoteLinux)$"
        },
        "gdbAutoRunCommandString": {
          "type": "string",
          "description": "String with additional gdb commands to run to initiate connection to target"
        },
        "networkPortNumberForOCDConnections": {
          "type": "string",
          "description": "TCP/IP port number for OpenOCD connections.  Set to \"auto\" to automatically use any free port"
        },
        "isPlatformFPGA": {
          "type": "boolean",
          "description": "True only for FPGA platforms"
        },
        "fpgaBitFile": {
          "$ref": "#/$defs/supportPackFile",
          "description": "Bitfile for programming FPGA"
        },
        "fpgaProgConfigFile": {
          "$ref": "#/$defs/supportPackFile",
          "description": "OpenOCD config file for programming FPGA"
        },
        "traceSettingsString": {
          "type": "string",
          "description": "String with processor trace encoder settings required by the decoder"
        },
        "libsDirectory": {
          "$ref": "#/$defs/supportPackDirectory",
          "description": "Directory containing library files for use with the platform"
        },
        "headersDirectory": {
          "$ref": "#/$defs/supportPackDirectory",
          "description": "Directory containing header files for use with the platform"
        },
        "remoteHost": {
          "type": "string",
          "description": "Hostname or IP address for debug connection to remote machines"
        },
        "remoteUsername": {
          "type": "string",
          "description": "Username for debug connection to remote machines"
        }
      },
      "required": [
        "vendor",
        "name",
        "description",
        "buildConfig",
        "version",
        "license",
        "documentationFile",
        "coreDescriptionFile",
        "launchConfig"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "platform"
  ],
  "additionalProperties": false,
  "$defs": {
    "supportPackFile": {
      "description": "File within support pack",
      "type": "object",
      "properties": {
        "builtin": {
          "description": "builtin=\"true\" means that a file path is relative to the platform directory within the SDK installation.builtin=\"false\" means the file path is relative to the top level of the unzipped package",
          "type": "boolean"
        },
        "path": {
          "description": "file path within zip file",
          "type": "string"
        }
      },
      "required": [
        "builtin",
        "path"
      ],
      "additionalProperties": false
    },
    "supportPackDirectory": {
      "description": "Directory within support pack",
      "type": "object",
      "properties": {
        "path": {
          "description": "directory path within zip file",
          "type": "string"
        }
      },
      "required": [
        "path"
      ],
      "additionalProperties": false
    }
  }
}
