From 9a0d590cf11c5994d98ec7a10aeb67d7d2fc17f2 Mon Sep 17 00:00:00 2001 From: Peter McGoron Date: Thu, 14 Jul 2022 15:46:38 -0400 Subject: [PATCH] dont bring in csr locations when not necessary --- firmware/generate_csr_locations.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/firmware/generate_csr_locations.py b/firmware/generate_csr_locations.py index de9beb7..34062f7 100644 --- a/firmware/generate_csr_locations.py +++ b/firmware/generate_csr_locations.py @@ -6,6 +6,7 @@ reg_names = { "dac" : ("miso", "ctrl") } max_num = 8 +# TODO: make dependent on adc, dac def get_reg(j, name, num, pos): return j["csr_registers"][f"{name}{num}_{pos}"]["addr"] @@ -17,13 +18,15 @@ print(''' typedef volatile uint32_t *csr_t; #define ADC_MAX 8 #define DAC_MAX 8 +#ifdef CSR_LOCATIONS ''') for conv in iter(reg_names): for reg in reg_names[conv]: - print(f"const csr_t {conv}_{reg}[{max_num}] =", "{") + print(f"static const csr_t {conv}_{reg}[{max_num}] =", "{") for i in range(0,max_num): print("\t (csr_t)", get_reg(j, conv, i, reg), end='') if i != max_num - 1: print(",") print("\n};") +print("#endif // CSR_LOCATION")