aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2016-09-10 20:01:52 -0400
committerKevin O'Connor <kevin@koconnor.net>2016-09-10 20:01:52 -0400
commit33a48d926c4c5e1ac578d69f75efa84ab46c5426 (patch)
treef04bc1dffd7a9144d67ce30c47e20b70b499e606 /scripts
parentc5f50e73c232a2d7bed9df1218c9a85a0ad8c773 (diff)
downloadkutter-33a48d926c4c5e1ac578d69f75efa84ab46c5426.tar.gz
kutter-33a48d926c4c5e1ac578d69f75efa84ab46c5426.tar.xz
kutter-33a48d926c4c5e1ac578d69f75efa84ab46c5426.zip
build: Support creating and storing the data dictionary on each build
Generate the data dictionary in out/klipper.dict on each build. This makes it easier to use the dictionary when debugging. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/buildcommands.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/scripts/buildcommands.py b/scripts/buildcommands.py
index af9926ca..9b6acb45 100644
--- a/scripts/buildcommands.py
+++ b/scripts/buildcommands.py
@@ -173,7 +173,7 @@ const uint8_t command_identify_data[] PROGMEM = {%s
// Identify size = %d (%d uncompressed)
const uint32_t command_identify_size PROGMEM = ARRAY_SIZE(command_identify_data);
"""
- return fmt % (''.join(out), len(zdata), len(data))
+ return data, fmt % (''.join(out), len(zdata), len(data))
######################################################################
@@ -227,6 +227,8 @@ def main():
opts = optparse.OptionParser(usage)
opts.add_option("-e", "--extra", dest="extra", default="",
help="extra version string to append to version")
+ opts.add_option("-d", dest="write_dictionary",
+ help="file to write mcu protocol dictionary")
opts.add_option("-v", action="store_true", dest="verbose",
help="enable debug messages")
@@ -302,12 +304,18 @@ def main():
sys.stdout.write("Version: %s\n" % (version,))
responses = [msg_to_id[msg] for msgname, msg in messages_by_name.items()
if msgname not in commands]
- icode = build_identify(cmd_by_id, msg_to_id, responses, static_strings
- , config, version)
+ datadict, icode = build_identify(cmd_by_id, msg_to_id, responses
+ , static_strings, config, version)
# Write output
f = open(outcfile, 'wb')
f.write(FILEHEADER + paramcode + parsercode + cmdcode + icode)
f.close()
+ # Write data dictionary
+ if options.write_dictionary:
+ f = open(options.write_dictionary, 'wb')
+ f.write(datadict)
+ f.close()
+
if __name__ == '__main__':
main()