Comments (11)
I quite like that I can just use a YAML file for custom targets right now. When building a custom flash loader for RISCV, it was very convenient to just edit a text file, without having to compile it afterwards. I think using WASM will make this quite a bit more complicated, especially for the simple cases, where no target specific code is required except for the flash loader itself.
For targets with specific code required, I quite like having some kind of limited scripting available,
like e.g. the Segger script files. They offer the ability to override some functions, like for target reset, with custom functions. I think a full scripting language or even Rust is not really required, usually the ability to write / read some memory locations is enough.
With the changes regarding the core list and memory map I agree, to support multiple cores this sounds reasonable.
from probe-rs.
A few thoughts previously posted on Matrix:
This approach comes with a downside of course: The user cannot hotload any target descriptions.
If Rust is going to replace Yaml, then why not to leave Yaml->Rust compatibility layer for loading yaml files at runtime? It will not be as powerful as pure rust, but anyway.
In fact, this yaml->rust thing is the only one I don't understant, but you clearly have more context than me :)
Other things look good, even from my riscv perspective.
Also I know it's not the case and probably will never be the case, but if you have an FPGA softcore, then your core configuration may be changed from build to build and that's where yaml description may help as it can be autogenerated along the core.
And one thing to add: some targets are more than just a core. For example, you may have a board with a FE310 chip an it can have different flash chips on different boards, also QSPI or generic SPI connection. These may require either board-specific flash loaders or somewhat generic "SPI flash" loader code that knows nothing about the core.
from probe-rs.
Yeah, I'd like to register a strong preference for being able to tweak and iterate on target definitions without rebuilding my tools/patching dependencies. I really like how data-driven the current probe-rs implementation is, without having a module per potential target processor -- where eventually target-processor-specific hacks get introduced. The current YAML model succeeds at this, even if YAML itself is not my favorite. (As long as it's a serde-compatible format, it almost doesn't matter anymore -- we're using TOML in our system builder but we could easily switch to JSON, etc.)
Format-wise, being able to use actual ELF binaries instead of a base64 string and a YAML-encoded symbol table would also be nice for iterating. A target description could potentially be a directory containing a control file and a collection of ELF binaries for verbs.
Remember that "the flash" is often not a thing. More complex systems (as @Disasm noted) will have several banks of internal flash, an external memory controller or two, and possibly the ability to boot from eMMC. The Keil CMSIS pack files include named flasher programs for each potential target (QSPI, internal, etc.), and including these as string-keyed named memories is probably the right approach, since vendors (or board makers!) can add new ones.
Otherwise the changes you propose look fine.
from probe-rs.
rhai might also be a good candidate for the scripting language. It looks like Rust, it's written in Rust, and it has exactly one mandatory dependency (smallvec).
from probe-rs.
I think I need to clarify how I intended to replace the YAML format with Rust/WASM :)
By no means I intend to recompile probe-rs or tools that use probe-rs on each ever so slight target config change :D That would be absolutely terrible to use.
What I rather suggest is that we load a WASM module (one for each target) during runtime, which contains certain symbols for things like the memory map, the algorithm blob, etc. Just like the YAML files.
But WASM would enable us to define a few handler signatures, let's say for unlocking a chip, which the implementor of the target definition could define additionally. We could then load those too if present and execute them during runtime!
This would only ever require recompilation of the WASM blob.
Format-wise, being able to use actual ELF binaries instead of a base64 string and a YAML-encoded symbol table would also be nice for iterating. A target description could potentially be a directory containing a control file and a collection of ELF binaries for verbs.
Actually, why I chose it to be base64 is just because it was easier to handle in the beginning. It sounds like a good thing to have separate files for the blobs! So let's add that to the feature list!
I am aware that there is several differently named algorithm blobs for different usages. The problem here is that those are all assigned to a specific region of memory. so there is actually ELF blobs where you might need 3 different algorithms (say, normal flash, option bytes, and some more config). How do you enable the user to select ALL of the algorithms they need and not just one? ;) Because not each target has the same amount and not every algorithm works for all memory regions :) At the moment we discover automatically which algorithm we need by the section. And we patched the target files to only contain one algorithm per region. I think this is not an issue within Keil because you have to select the algorithm manually I think (no guarantees).
from probe-rs.
I would rather not create a proprietary script dialect as this is time consuming, an entirely new project and not appealing to many (including me) I guess, as they have to learn some new language.
If we add some scripting I would prefer to use an existing language (without any real preference which one).
Other than that, I can understand that you all don't want to run an additional compile pass, even tho I don't see any trouble with it :)
from probe-rs.
There are some existing projects for scripting languages listed on Awesome Rust: https://github.com/rust-unofficial/awesome-rust#scripting. I was thinking of one of these, not implementing everything from scratch 😉
from probe-rs.
The main question here is how we make sure the language is actually maintained into the future and not just an experiment :)
mun-lang
looks nice here, but might not be the most mature.
from probe-rs.
is RustObjectNotation something that might fit here? https://github.com/ron-rs/ron
I've not used it yet but seems like rust+plaintext could be a sweet spot.
If no computation is necessary I think it would be best to keep it simple and have a config file format instead of a scripting language.
from probe-rs.
So I have made the changes I think are required for starters in #367.
The thing that is missing still is the addition of debug sequences and a mechanism for detecting targets.
Optimally we make those changes in multiple PRs. So this one is a start in that direction.
In this same PR I would also like to change the structure of the target files as follows:
Before we basically had
- family1.yaml
- family2.yaml
- ...
Now I would like to propose this structure
- st
- sequences.lua
- f0
- targets.yaml
- sequences.lua
- algo1.elf
- algo2.elf
- f1
- ...
- nordic
- ...
You can see the .lua ending. @mvirkkunen and I have located Lua as a promising candidate for sequences.
I had a feeling that most of the people involved didn't like WASM as a format for this. And I don't see Python, JS, Ruby, TCL or any weird custom language as actually possible candiates.
Lua comes without many dependencies, is meant for embedding, has nice Rust bindings with a proper sandbox (still exploitable, but our application is not security cirtical in that regard), has somewhat sane syntax and data types (it has actual integers and not just floats).
@mvirkkunen has made a first try which resulted in this: https://gist.github.com/mvirkkunen/5c5850c640d0c7a5628ec7cd4cb46884.
The idea is then to have per target sequences and per manufacturer sequences. The per manufacturer sequences are for auto-detection of a target for example.
If you have any inputs, ideas, objections or anything else, please state them here so we can finally get this going to fix some of our longest standing issues :)
from probe-rs.
I'll close this as most changes have been made and if we need further changes we can do this with the relevant issue/PR.
from probe-rs.
Related Issues (20)
- Panic handler not capturing all stack frames HOT 8
- ESP32 Pros3 using EspJtag HOT 3
- ESP-WROVER-KIT - Stepping into / Stepping Over code errors HOT 4
- Temporarily attaching to cores in low-level interface HOT 3
- nrf52840-dongle core is locked, -> erase -> connection unsuccessful/lack permission erase_all HOT 3
- probe-rs is much slower than OpenOCD in download speed
- probe-rs is much slower than OpenOCD in download speed HOT 7
- Xtensa semihosting support HOT 3
- probe-rs run fails with stack configuration error on STM32G431C6Tx HOT 1
- Cant flash ESP32-S2 HOT 14
- Cant flash ESP32-C2 HOT 13
- Can't Flash STM32F750N8Hx HOT 18
- Panic in `jtag_dtm.rs` when using `probe-rs` in combination with `ESP32-C3` and `ESP-Prog` HOT 29
- cargo-embed produces broken output, probe-rs does not HOT 11
- Register values are corrupted during step execution in Armv8a
- stm32f105rb works with probe-rs version 0.21.1 but not with 0.23.0 HOT 2
- Flashing `esp32-s3` with `probe-rs` causes flash algorithm verification fail HOT 14
- embedded-test: `--skip` conflicts with libtest_mimic HOT 1
- probe-rs info Failed to open the debug probe. HOT 14
- `probe-rs run test` fails on ESP32
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from probe-rs.