diff --git a/litex/soc/integration/export.py b/litex/soc/integration/export.py index ecd474669..3a00b88f7 100644 --- a/litex/soc/integration/export.py +++ b/litex/soc/integration/export.py @@ -257,13 +257,14 @@ def get_csr_header(regions, constants, csr_base=None, with_csr_base_define=True, r += "#ifndef CSR_ACCESSORS_DEFINED\n" r += "#include \n" r += "#endif /* ! CSR_ACCESSORS_DEFINED */\n" - csr_base = csr_base if csr_base is not None else regions[next(iter(regions))].origin + _csr_base = regions[next(iter(regions))].origin + csr_base = csr_base if csr_base is not None else _csr_base if with_csr_base_define: - r += "#ifndef CSR_BASE\n" + r += "\n#ifndef CSR_BASE\n" r += f"#define CSR_BASE {hex(csr_base)}L\n" r += "#endif\n" for name, region in regions.items(): - origin = region.origin - csr_base + origin = region.origin - _csr_base r += "\n/* "+name+" */\n" r += f"#define CSR_{name.upper()}_BASE {_get_csr_addr(csr_base, origin, with_csr_base_define)}\n" if not isinstance(region.obj, Memory):