Giter Site home page Giter Site logo

Comments (9)

Yatekii avatar Yatekii commented on June 21, 2024 1

We check the ELF symbols :) That's something we did long before probe-run. We are just compatible with the Segger RTT standard while they went a more opinionated route.

How our RTT impl goes about this is like so:

  1. Check the ELF for the SEGGER_RTT symbol.
  2. If it's not there, scan the live chip memory if we can maybe find the RTT header.

We could make step 2 optional. Or we deprecate it alltogether in probe-rs run.

from probe-rs.

Yatekii avatar Yatekii commented on June 21, 2024 1

It looks to me that probe-rs doesn't check whether there are symbols but _SEGGER_RTT is absent as a signal that it should not scan the memory.

That is correct.

Yes that would be the behavior of probe-run as far as I understand.

Yup.

What do you mean by "patch this in the RTT code"?

I mean in the rtt module in probe-rs we could add this :)

Yes, I don't mind setting a flag to only rely on the debug symbols

I would make it so it needs to flag for the additional memory scan and otherwise just scans the ELF.

from probe-rs.

Yatekii avatar Yatekii commented on June 21, 2024

probe-rs run checks the binary just like probe-run. The only difference is that we scan the memory for 10 seconds if we can't find the SEGGER_RTT block because that's a valid usecase of RTT in the original standard, if you do not have any debug symbols.

I am happy to change this behavior or at least enable this only via a flag, because I think most people have ELF debug info if RTT is enabled.

from probe-rs.

ia0 avatar ia0 commented on June 21, 2024

probe-rs run checks the binary just like probe-run.

What is checked exactly? probe-run checks the ELF, not the runtime memory.

I think most people have ELF debug info if RTT is enabled.

Exactly, so it would make sense to not try to connect to RTT if the ELF doesn't have debug symbols. That would be a first simple check. This check could be further improved by checking for an _SEGGER_RTT symbol in the ELF like probe-run does, but I don't need this and would be fine if it's not implemented.

from probe-rs.

ia0 avatar ia0 commented on June 21, 2024

Oh I see, so the only difference is that probe-run checks for _SEGGER_RTT which is what defmt produces, while probe-rs checks for SEGGER_RTT. I see a few options to solve my problem then:

  1. Make defmt-rtt produce SEGGER_RTT (either in addition to or instead of _SEGGER_RTT) based on a feature to preserve backward compatibility.
  2. Make probe-rs also check for _SEGGER_RTT in additional to SEGGER_RTT, possibly gated by a feature but this doesn't seem necessary.
  3. Make probe-rs skip step 2 either based on a flag and/or based on whether the presence of debugging symbols in the ELF.

from probe-rs.

Yatekii avatar Yatekii commented on June 21, 2024

Sorry, I was imprecise in my answer, the header symbol value in memory is SEGGER_RTT, the DWARF symbol in the ELF is _SEGGER_RTT. You can find the code here.

"_SEGGER_RTT" => {

The only real fix here is 3. Because you compile in release mode - seemingly without debug symbols (you could ofc. generate them :)) - we cannot find the symbol and we start looking in RAM. Which doesn't have the header either (because you don't initialize it in release?) or it cannot find it within 10 secs. Dependent on memory size and where you start the scan this will take forever to find :D Maybe we should just patch this in the RTT code so there is a connect function that does not perform the scan if no symbol is found and use this. But maybe the flag would actually be a great choice so people that want to run without the debug info can still use it.

from probe-rs.

ia0 avatar ia0 commented on June 21, 2024

I see, indeed only (3) is an option.

I tried generating debug symbols but same issue. It looks to me that probe-rs doesn't check whether there are symbols but _SEGGER_RTT is absent as a signal that it should not scan the memory.

Maybe we should just patch this in the RTT code so there is a connect function that does not perform the scan if no symbol is found and use this.

Yes that would be the behavior of probe-run as far as I understand. What do you mean by "patch this in the RTT code"?

But maybe the flag would actually be a great choice so people that want to run without the debug info can still use it.

Yes, I don't mind setting a flag to only rely on the debug symbols (my probe-rs command line is generated anyway so it has no cost on my side and will always be set). I never want to scan the memory, I always set the symbol when I use RTT.

from probe-rs.

ia0 avatar ia0 commented on June 21, 2024

Perfect, thanks a lot!

from probe-rs.

Yatekii avatar Yatekii commented on June 21, 2024

YW!

from probe-rs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.