diff options
Diffstat (limited to 'controller/fw/tools/gold_code_header_gen.py')
-rw-r--r-- | controller/fw/tools/gold_code_header_gen.py | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/controller/fw/tools/gold_code_header_gen.py b/controller/fw/tools/gold_code_header_gen.py index 8247457..fa98fce 100644 --- a/controller/fw/tools/gold_code_header_gen.py +++ b/controller/fw/tools/gold_code_header_gen.py @@ -58,19 +58,13 @@ if __name__ == '__main__': print(f' *') print(f' * Each code is packed left-aligned into {nbytes} bytes in big-endian byte order.') print(f' */') - print(f'const uint8_t gold_code_{args.n}bit[{2**args.n+1}][{nbytes}] = {{') + print(f'const uint8_t {args.variable}[{2**args.n+1}][{nbytes}] = {{') for i, code in enumerate(gold(args.n)): par = '{' + ' '.join(f'0x{d:02x},' for d in np.packbits(code)) + f'}}, /* {i: 3d} "{"".join(str(x) for x in code)}" */' print(textwrap.fill(par, initial_indent=' '*4, subsequent_indent=' '*4, width=120)) print('};') print() - print(f'const uint8_t * const {args.variable} __attribute__((weak)) = (uint8_t *const)gold_code_{args.n}bit;') - print(f'const size_t {args.variable}_nbits __attribute__((weak)) = {args.n};') else: print('/* THIS IS A GENERATED FILE. DO NOT EDIT! */') with print_include_guards(f'__GOLD_CODE_GENERATED_HEADER_{args.n}__'): - print(f'extern const uint8_t gold_code_{args.n}bit[{2**args.n+1}][{nbytes}];') - - with print_include_guards(f'__GOLD_CODE_GENERATED_HEADER_GLOBAL_SYM_{args.variable.upper()}__'): print(f'extern const uint8_t {args.variable}[{2**args.n+1}][{nbytes}];') - print(f'extern const size_t {args.variable}_nbits;') |