csr: Fix definition(s) of CSR_BASE in generated headers
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>
Fri, 22 May 2020 07:53:20 +0000 (17:53 +1000)
committerFlorent Kermarrec <florent@enjoy-digital.fr>
Wed, 27 May 2020 19:48:00 +0000 (21:48 +0200)
commitc78caeb998156fcb9dc050c60df702cb786e2514
tree4f0c0156f6d8cb1a43af6bffc6ed8873bf411a83
parentf8bb500a4396f29aecad5fb4b0a2a1758c25c514
csr: Fix definition(s) of CSR_BASE in generated headers

CSR_BASE is currently defined twice. Once in mem.h as the base
of the CSR region in the SoC address space, and once in csr.h
as the base address for all CSRs.

This fixes two issues with those definitions:

 - The mem.h one is unconditional which prevents an external
redefinition (which is useful under some circumstances such as
when using an address decoder outside of LiteX with a standalone
core).

 - The csr.h one is actually the origin of the first CSR region
rather than the origin of the CSR region in the SoC space. They
are usually the same ... unless you don't have CSR bank 0 in
which case the csr.h one becomes different. This causes conflicts
with the mem.h definition and breaks projects using a standalone
cores.

The first one is fixed by adding the #ifndef/#endif around the
definition of the memory regions, the second one by passing the
csr_base to use to get_csr_header()

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
litex/soc/integration/builder.py
litex/soc/integration/export.py