Makefile: Translate null characters to newline characters in ctr requests

Store the CTR requests in compile_time_request.txt with the null
characters removed.  This makes it slightly easier to inspect the CTR
conversions.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2019-08-22 10:35:26 -04:00
parent 1022729a2a
commit 69fc1e63b4
3 changed files with 5 additions and 5 deletions

View File

@ -87,8 +87,8 @@ $(OUT)%.o.ctr: $(OUT)%.o
$(OUT)compile_time_request.o: $(patsubst %.c, $(OUT)src/%.o.ctr,$(src-y)) ./scripts/buildcommands.py $(OUT)compile_time_request.o: $(patsubst %.c, $(OUT)src/%.o.ctr,$(src-y)) ./scripts/buildcommands.py
@echo " Building $@" @echo " Building $@"
$(Q)cat $(patsubst %.c, $(OUT)src/%.o.ctr,$(src-y)) > $(OUT)klipper.compile_time_request $(Q)cat $(patsubst %.c, $(OUT)src/%.o.ctr,$(src-y)) | tr '\0' '\n' > $(OUT)compile_time_request.txt
$(Q)$(PYTHON) ./scripts/buildcommands.py -d $(OUT)klipper.dict -t "$(CC);$(AS);$(LD);$(OBJCOPY);$(OBJDUMP);$(STRIP)" $(OUT)klipper.compile_time_request $(OUT)compile_time_request.c $(Q)$(PYTHON) ./scripts/buildcommands.py -d $(OUT)klipper.dict -t "$(CC);$(AS);$(LD);$(OBJCOPY);$(OBJDUMP);$(STRIP)" $(OUT)compile_time_request.txt $(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: $(OBJS_klipper.elf) $(OUT)klipper.elf: $(OBJS_klipper.elf)

View File

@ -603,7 +603,7 @@ def main():
f = open(incmdfile, 'rb') f = open(incmdfile, 'rb')
data = f.read() data = f.read()
f.close() f.close()
for req in data.split('\0'): for req in data.split('\n'):
req = req.lstrip() req = req.lstrip()
if not req: if not req:
continue continue

View File

@ -2,8 +2,8 @@
#define __CTR_H #define __CTR_H
// Definitions for creating compile time requests. The DECL_CTR macro // Definitions for creating compile time requests. The DECL_CTR macro
// produces requests (text strings) that are placed in a special // produces requests (text strings) that are placed in a special
// section of the intermediate object files. The requests are then // section of the intermediate object files (*.o). The build extracts
// extracted during the build and passed to scripts/buildcommand.py. // these strings and places them in out/compile_time_requests.txt.
// The scripts/buildcommand.py code then generates // The scripts/buildcommand.py code then generates
// out/compile_time_request.c from these requests. // out/compile_time_request.c from these requests.