Skip to main content

Generate Compilation Database by parse Keil µVision project

Project description

uv2compdb

Generate Compilation Database by parse Keil µVision project.

Features

  • Parse strategy (dep/build_log -> XML)
  • Extract toolchain predefined macros with -p option
  • VariousControls hierarchical merge (Target -> Group -> File)

Installation

pip install uv2compdb

Usage

Basic Usage

Generate compile_commands.json in the current directory for the current target (see .uvopt[x] file). Falling back to the first target if the current target is not found.

uv2compdb /path/to/project

Specify target and output

Generate compile_commands.json for a specific target and output

uv2compdb /path/to/project -t target -o /path/to/compile_commands.json

Help

usage: uv2compdb [-h] [-v] [-V] [-a ARGUMENTS] [-b] [-B] [-t TARGET] [-o OUTPUT] [-p] project

Generate compile_commands.json by parse Keil µVision project

positional arguments:
  project               Path to .uvproj[x] file

optional arguments:
  -h, --help            Show this help message and exit
  -v, --verbose         Enable verbose output
  -V, --version         Show version and exit
  -a ARGUMENTS, --arguments ARGUMENTS
                        Add extra arguments
  -b, --build           Try to build while dep/build_log files don't not exist
  -B, --always_build    Always try to build
  -t TARGET, --target TARGET
                        Target name
  -o OUTPUT, --output OUTPUT
                        Output dir/file path (default: compile_commands.json)
  -p, --predefined      Try to add predefined macros

Limit

  • Not parsed "Options" -> "C/C++" -> "Language / Code Generation"
  • Not parsed "Options" -> "ASM", so Asm file use same options with C file
  • Can't parse RTE components
  • Can't add toolchain predefined macros and include path
  • The support for C51 / ARMCC (AC5) not well
    • need config .clangd manually

Clangd

.clangd config

CompileFlags:
  CompilationDatabase: /path/to/compile-commands-dir
  Compiler: arm-none-eabi-gcc # use arm-neon-eabi-gcc instead of armcc
  Add:
    - -fdeclspec  # fix '__declspec' if use arm-none-eabi-gcc instead of armcc

Diagnostics:
  UnusedIncludes: None  # Strict(default), None
  # Suppress:
  #   - no_member
  #   - no_member_suggest
  #   - no_template
  #   - undeclared_var_use

References

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

uv2compdb-0.8.0.tar.gz (9.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

uv2compdb-0.8.0-py3-none-any.whl (11.3 kB view details)

Uploaded Python 3

File details

Details for the file uv2compdb-0.8.0.tar.gz.

File metadata

  • Download URL: uv2compdb-0.8.0.tar.gz
  • Upload date:
  • Size: 9.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.20

File hashes

Hashes for uv2compdb-0.8.0.tar.gz
Algorithm Hash digest
SHA256 12e22825567e7162c08727a0f87a48dd316dcc922d14a17699f4aa73683ca1e5
MD5 a8fb5e320509a5e1fc8da24c90c64287
BLAKE2b-256 82814ae9a5029f54f6f865aa5c604ee8ea13a8940e8f932e279d97b67cc0b93e

See more details on using hashes here.

File details

Details for the file uv2compdb-0.8.0-py3-none-any.whl.

File metadata

  • Download URL: uv2compdb-0.8.0-py3-none-any.whl
  • Upload date:
  • Size: 11.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.20

File hashes

Hashes for uv2compdb-0.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b3a04692b06734245ea9326556c5a3041b68d3c99b659c06a241afad2d6ce9f3
MD5 c5bd1a1bdc2df6918abbd53ff434bf79
BLAKE2b-256 a4cb5f2bf64201deed5d0f29608fc63fb975d1072dfc14cee7095ec024820eac

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page