Fix kasli_soc-demo compilation error with cfg #250
|
@ -310,6 +310,7 @@ class GenericMaster(SoCCore):
|
||||||
self.add_csr_group("grabber", self.grabber_csr_group)
|
self.add_csr_group("grabber", self.grabber_csr_group)
|
||||||
|
|
||||||
|
|
||||||
|
self.rustc_cfg["has_virtual_leds"] = None
|
||||||
self.submodules.virtual_leds = virtual_leds.VirtualLeds()
|
self.submodules.virtual_leds = virtual_leds.VirtualLeds()
|
||||||
self.csr_devices.append("virtual_leds")
|
self.csr_devices.append("virtual_leds")
|
||||||
|
|
||||||
|
@ -482,6 +483,7 @@ class GenericSatellite(SoCCore):
|
||||||
self.add_csr_group("grabber", self.grabber_csr_group)
|
self.add_csr_group("grabber", self.grabber_csr_group)
|
||||||
# no RTIO CRG here
|
# no RTIO CRG here
|
||||||
|
|
||||||
|
self.rustc_cfg["has_virtual_leds"] = None
|
||||||
|
|||||||
self.submodules.virtual_leds = virtual_leds.VirtualLeds()
|
self.submodules.virtual_leds = virtual_leds.VirtualLeds()
|
||||||
self.csr_devices.append("virtual_leds")
|
self.csr_devices.append("virtual_leds")
|
||||||
|
|
||||||
|
|
|
@ -152,6 +152,7 @@ impl IoExpander {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn service(&mut self, i2c: &mut i2c::I2c) -> Result<(), &'static str> {
|
pub fn service(&mut self, i2c: &mut i2c::I2c) -> Result<(), &'static str> {
|
||||||
|
#[cfg(has_virtual_leds)]
|
||||||
for (led, port, bit) in self.virtual_led_mapping.iter() {
|
for (led, port, bit) in self.virtual_led_mapping.iter() {
|
||||||
let level = unsafe { csr::virtual_leds::status_read() >> led & 1 };
|
let level = unsafe { csr::virtual_leds::status_read() >> led & 1 };
|
||||||
self.set(*port, *bit, level != 0);
|
self.set(*port, *bit, level != 0);
|
||||||
|
|
Loading…
Reference in New Issue
IIRC misoc does that by default for all CSR cores and those lines are not necessary?
Running
python src/gateware/kasli_soc.py -r build/pl.rs -c build/rustc-cfg -m build/mem.rs kasli-soc-satellite.json
with the line omitted, thebuild/rust-cfg
don't have thehas_virtual_leds
linebuild/rust-cfg
https://github.com/m-labs/misoc/blob/master/misoc/integration/cpu_interface.py#L305
Please find out what is going on.
You may want to check migen-axi as well - it might not share this code with misoc.
Difference between artiq and artiq-zynq
In artiq repo, the rust-cfg is generated by calling
f.write(cpu_interface.get_rust_cfg(soc.get_csr_regions(), soc.get_constants()))
in themisoc/integration/build.py
.get_rust_cfg
analyze the content ofsoc.get_csr_regions()
andsoc.get_constants()
to carefully obtain the useful string and output it to the rust-cfg fileWhile in artiq-zynq, the
write_rustc_cfg_file(soc, filename)
is called to generated rust-cfg insrc/gateware/kasli_soc.py
soc.rustc_cfg = dict()
directly to rust-cfg filerust cfg difference if using
get_rust_cfg
write_rustc_cfg_file(soc, filename)
was modified to followget_rust_cfg
python src/gateware/kasli_soc.py -c build/rustc-cfg kasli-soc-satellite.json
rustc-cfg before modification
rustc-cfg after modification
Relevant code snippet
kasli_soc.py before modification
kasli_soc.py after modification
Yeah we should try to avoid divergence with misoc.