add memory regions to soc.svd
svd2rust does not recognize memory regions, but we'd like to make an access crate for Rust that does. This patch adds memory regions to soc.svd using the "vendorExtensions" tag, as specified in https://www.keil.com/pack/doc/cmsis/SVD/html/svd_Format_pg.html The vendorExtensions is added as a block after the Peripherals level, and has a format like this: ```xml <memoryRegion> <name>SRAM</name> <baseAddress>0x10000000</baseAddress> <size>0x00020000</size> </memoryRegion> <memoryRegion> <name>VEXRISCV_DEBUG</name> <baseAddress>0xEFFF0000</baseAddress> <size>0x00000100</size> </memoryRegion> <memoryRegion> <name>CSR</name> <baseAddress>0xF0000000</baseAddress> <size>0x00040000</size> </memoryRegion> ```
This commit is contained in:
parent
a1c023b900
commit
4a94bb78f6
|
@ -428,6 +428,15 @@ def get_csr_svd(soc, vendor="litex", name="soc", description=None):
|
||||||
svd.append(' </interrupt>')
|
svd.append(' </interrupt>')
|
||||||
svd.append(' </peripheral>')
|
svd.append(' </peripheral>')
|
||||||
svd.append(' </peripherals>')
|
svd.append(' </peripherals>')
|
||||||
|
if len(soc.mem_regions) > 0:
|
||||||
|
svd.append(' <vendorExtensions>')
|
||||||
|
for name, region in soc.mem_regions.items():
|
||||||
|
svd.append(' <memoryRegion>')
|
||||||
|
svd.append(' <name>{}</name>'.format(name.upper()))
|
||||||
|
svd.append(' <baseAddress>0x{:08X}</baseAddress>'.format(region.origin))
|
||||||
|
svd.append(' <size>0x{:08X}</size>'.format(region.size))
|
||||||
|
svd.append(' </memoryRegion>')
|
||||||
|
svd.append(' </vendorExtensions>')
|
||||||
svd.append('</device>')
|
svd.append('</device>')
|
||||||
return "\n".join(svd)
|
return "\n".join(svd)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue