mirror of https://github.com/Desuuuu/klipper.git
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>
This commit is contained in:
parent
c5f50e73c2
commit
33a48d926c
2
Makefile
2
Makefile
|
@ -88,7 +88,7 @@ $(OUT)klipper.o: $(patsubst %.c, $(OUT)src/%.o,$(src-y)) $(OUT)declfunc.lds
|
||||||
$(OUT)compile_time_request.o: $(OUT)klipper.o ./scripts/buildcommands.py
|
$(OUT)compile_time_request.o: $(OUT)klipper.o ./scripts/buildcommands.py
|
||||||
@echo " Building $@"
|
@echo " Building $@"
|
||||||
$(Q)$(OBJCOPY) -j '.compile_time_request' -O binary $< $(OUT)klipper.o.compile_time_request
|
$(Q)$(OBJCOPY) -j '.compile_time_request' -O binary $< $(OUT)klipper.o.compile_time_request
|
||||||
$(Q)$(PYTHON) ./scripts/buildcommands.py $(OUT)klipper.o.compile_time_request $(OUT)autoconf.h $(OUT)compile_time_request.c
|
$(Q)$(PYTHON) ./scripts/buildcommands.py -d $(OUT)klipper.dict $(OUT)klipper.o.compile_time_request $(OUT)autoconf.h $(OUT)compile_time_request.c
|
||||||
$(Q)$(CC) $(CFLAGS) -c $(OUT)compile_time_request.c -o $@
|
$(Q)$(CC) $(CFLAGS) -c $(OUT)compile_time_request.c -o $@
|
||||||
|
|
||||||
$(OUT)klipper.elf: $(OUT)klipper.o $(OUT)compile_time_request.o
|
$(OUT)klipper.elf: $(OUT)klipper.o $(OUT)compile_time_request.o
|
||||||
|
|
|
@ -173,7 +173,7 @@ const uint8_t command_identify_data[] PROGMEM = {%s
|
||||||
// Identify size = %d (%d uncompressed)
|
// Identify size = %d (%d uncompressed)
|
||||||
const uint32_t command_identify_size PROGMEM = ARRAY_SIZE(command_identify_data);
|
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 = optparse.OptionParser(usage)
|
||||||
opts.add_option("-e", "--extra", dest="extra", default="",
|
opts.add_option("-e", "--extra", dest="extra", default="",
|
||||||
help="extra version string to append to version")
|
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",
|
opts.add_option("-v", action="store_true", dest="verbose",
|
||||||
help="enable debug messages")
|
help="enable debug messages")
|
||||||
|
|
||||||
|
@ -302,12 +304,18 @@ def main():
|
||||||
sys.stdout.write("Version: %s\n" % (version,))
|
sys.stdout.write("Version: %s\n" % (version,))
|
||||||
responses = [msg_to_id[msg] for msgname, msg in messages_by_name.items()
|
responses = [msg_to_id[msg] for msgname, msg in messages_by_name.items()
|
||||||
if msgname not in commands]
|
if msgname not in commands]
|
||||||
icode = build_identify(cmd_by_id, msg_to_id, responses, static_strings
|
datadict, icode = build_identify(cmd_by_id, msg_to_id, responses
|
||||||
, config, version)
|
, static_strings, config, version)
|
||||||
# Write output
|
# Write output
|
||||||
f = open(outcfile, 'wb')
|
f = open(outcfile, 'wb')
|
||||||
f.write(FILEHEADER + paramcode + parsercode + cmdcode + icode)
|
f.write(FILEHEADER + paramcode + parsercode + cmdcode + icode)
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
|
# Write data dictionary
|
||||||
|
if options.write_dictionary:
|
||||||
|
f = open(options.write_dictionary, 'wb')
|
||||||
|
f.write(datadict)
|
||||||
|
f.close()
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
Loading…
Reference in New Issue