Note |
---|
We no longer use this codegen tooling to generate can packing functions. We instead generate the messages as part of scons build script, which creates getters and setters for each field of the can message. https://uwmidsun.atlassian.net/l/cp/z0ruBZP3 |
Introduction
Preface
Note: codegen tooling has been merged into firmware_xiv, so some of this write-up might be outdated. See https://uwmidsun.atlassian.net/l/c/HUVz1yu7 for info about the transition.
This page is more or less a write-up of a video by Arshan Khanifar that can be found here. If you prefer video to text, please watch the video.
...
How do you add new messages?
In a text editor of your choice, open up
can_messages.asciipb
Choose a non-used message id, and fill out a message definition, following the format of the other messages
Note: messages 0-9 are high priority messages, don’t use these.
Code Block msg { id: 99 source: EXAMPLE # target: EXAMPLE msg_name: "descriptive name" can_data { u8 { field_name_1: "blablabla" field_name_2: "albalbalb" } } }
If you need enums to go along with your messages, don’t forget to add them to exported_enums.h in the firmware_xiv repo.
Run
make gen
in the root of the repo.The generated files will be placed in the
codegen-tooling-msxiv/out
directory.
Copy the generated files into your firmware repo at
firmware-xiv/libraries/codegen-tooling/inc
.Check your messages were added correctly with
git diff
or other, then commit and push your changes.