Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add WDT pinging when WDT is present in csr.csv #35

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

bunnie
Copy link
Contributor

@bunnie bunnie commented Dec 14, 2020

@xobs could you please have a look at this and confirm that it'll handle the case of the WDT register not being in the csr.csv file gracefully?

I'm a little tripped up by the double-option that the HashMap returns and I think the outer one returning None just means the key doesn't exist and I can use that as an indicator if the WDT timer exists or not, but then I'm baffled by why there is an inner Option<u32> that just gets unwrapped and never checked anyways...

@bunnie bunnie requested a review from xobs December 14, 2020 10:40
@xobs
Copy link
Member

xobs commented Dec 24, 2020

Most of the configuration for these things are done inside crates/core/config.rs:parse(). This digests the register file into a big Config struct.

I think the correct move here would be to add a key to the Config struct for wdt_addr that is an Option<u32>. If the address is accessible and can be reached, it gets set to Some(value). Otherwise, set it to None.

The HashMap<Option<u32>> comes from a quirk of Wishbone-over-PCIe. In such a system, only a portion of the full Wishbone bus is available, and everything is offset by some fixed value. If a register exists but cannot be accessed due to being out of range, the register value will be Some(None).

(This was done because people were accessing the UART over PCIe, and were getting cryptic errors about the UART not existing at all. This is what begat such delights as:

        let debug_offset = if let Some(debug_offset) = matches.value_of("debug-offset") {
            parse_u32_address(debug_offset, offset)?
                .ok_or_else(|| ConfigError::AddressOutOfRange(debug_offset.to_owned()))?
        } else if let Some(debug_offset) = register_mapping.get("vexriscv_debug") {
            (*debug_offset)
                .ok_or_else(|| ConfigError::AddressOutOfRange("vexriscv_debug".to_owned()))?
        } else {
            0xf00f_0000
        };

).

@xobs
Copy link
Member

xobs commented Apr 20, 2021

The double wrapping is due to PCIe support. Since PCIe only gives a small window of the entire system memory, it might be that addresses exist but they have no mapping. For example, if a CSR is at offset 0x3000, but the map is only 0x1000 - 0x2000, then it would be Some(None). However, if the map was 0x1000 - 0x4000, then the it would be Some(0x2000) (i.e. with 0x1000 subtracted, since that's the window offset).

bunnie added 4 commits May 9, 2021 17:26
the progressbar crate used tries to be clever and suppresses
printing of data when you don't have a terminal.

that sucks for automation. work around this.
somehow, stupidly, if a thread panics, you still get a result
code of 0 from the program.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants