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 first target if the project has multiple targets.

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] [-a ARGUMENTS] [-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, --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
  -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.5.0.tar.gz (8.8 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.5.0-py3-none-any.whl (10.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: uv2compdb-0.5.0.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for uv2compdb-0.5.0.tar.gz
Algorithm Hash digest
SHA256 dd54c1d43bf9682ba2ea8a096285c73b5adb4e77e7a7d8440909a948747214a1
MD5 f516ffed4b24f0da47162c3c5e9acd89
BLAKE2b-256 49c0c3e891d9de55ae985f6b8f990b48f14eaafbea17b09809e76dafda816ae4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: uv2compdb-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 10.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for uv2compdb-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 520f49d3eaaa6a9c1265260c6bac7e492be4a3c38da1af35c3abc30c12c36197
MD5 56add8a899ce346f2583c06f0adb3989
BLAKE2b-256 ca7320ccb74043686c3dab98fadcaf6829f9f77bb91ee4c4a8d5e2421a941101

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