This program turns a DBC file into a number of different formats.
dbcc is a program for converting a DBC file primarily into into C code that can serialize and deserialize CAN messages into structures that represent those messages and signals. It is also possible to print out the information contained in a structure.
See the license file for details of the license for this program, it is released under the MIT license. Dependencies, if linked against, may have their own license and their own set of restrictions if built against.
The sources file mpc.c and mpc.h originate from a parser combinator written in C called MPC and are licensed under the 3 Clause BSD license.
To build, you only need a C (C99) compiler and Make (probably GNU make, I make not effort to support other Make implementations). The dbcc program itself it written in what should be portable C with the only external dependency being your platforms C library.
You should be able to type:
make
To build, an executable called 'dbcc' is produced. To test run the tests, xmllint is required.
- When in doubt, format with indent with the "-linux" option.
- Use tabs, not spaces for formatting
- Use assertions where possible (not for error checking, for checking pre/post conditions and invariants).
- The tool should run on Windows and Linux with no modification.
- No external dependencies should brought into the project.
For a specification, as I understand it, of the DBC file format, see dbc.md. This is a work in progress.
There is a Vim syntax file for DBC files in the project, called dbc.vim
As well as C, XML can be generated, the project contains an XSD and XSLT file for the generated XML.
A flat CSV file can be generated, which is easier to import into Excel.
An XML based file that can be imported into Beyond Security's beSTORM and used to test CAN BUS infrastructure.
Consult the manual page for more information about the precise operation of the program.
- The floating point conversion routines assume your platform is using IEEE-754 floats. If it does not, then tough.
- A lot of the DBC file format is not dealt with:
- Special values
- Timeouts
- Error frames
- ...
- The generated C code has not been tested that much (it is probably incorrect). The generated code is also not MISRA C compliant, but it would not take too much to make it so.
- Integers that cannot be represented in a double width floating point number should be packed/unpacked correctly, however the encode/decode and printing functions will not as they use doubles for calculations (pack/unpack do not). This affects numbers larger than 2^53.
- Allow the merging of multiple DBC files
- Write unit tests to cover the converter and the generated code.
- Basic sanity checking of the DBC files could be built in.
- The easiest way to check this is by generating an XML file and verifying it with an XSD file
- Find/make more CAN database examples
- There are two pieces of information that are useful to any CAN stack for received messages; the time stamp of the received message, and the status (error CRC/timeout, message okay, or message never set). These conditions are not accounted for.