bnahill / PyCortexMDebug

A set of GDB/Python-based utilities to make life debugging ARM Cortex M processors a bit easier
GNU General Public License v3.0
175 stars 34 forks source link

Consideration: use an existing svd lib instead of rolling your own. #51

Open hanetzer opened 2 years ago

hanetzer commented 2 years ago

https://github.com/posborne/cmsis-svd For the sake of deduplicating work. Plus they ship quite a lot of SVDs you can use out of the box.

bnahill commented 2 years ago

That might have been a good idea had this not predated Paul's work by a few years. I support the idea of switching the parser over to something more robust but don't have the time for such an undertaking. I haven't been doing enough microcontroller debugging the last few years to motivate the jump, but am happy to keep this issue open to keep it from falling off the stack altogether.

hanetzer commented 2 years ago

ah, a very valid point. I wasn't aware of the timeline involved between the two projects, so sorry if it sounded presumptuous. Maybe I'll look into it myself.

bnahill commented 2 years ago

Alright I've started working on this! Paul's library is good, though I don't want to require some 5GB of XML. I'm also working on Python2-friendly type annotations for cmsis-svd to make it usable which I'll try to push back. Hopefully I can wrap this up before getting too busy with something else.

There are bugs in the parser I made and honestly I don't use this enough to fix them, and that's a disservice to everyone using this and finding their specific case isn't well-supported.

tannewt commented 1 year ago

Instead of shipping the xml with the package we could use https://github.com/pyocd/cmsis-pack-manager. It is used by pyocd to manage packs including svd files.

markrages commented 1 year ago

I found the cmsis-svd parser was insufficient for what I needed to implement in https://github.com/markrages/svd_gdb.

I am not proposing my parser as objectively better, but it is more closely aligned to PyCortexMDebug's use case.

Seems like a lot of duplicated effort all round!

bnahill commented 1 year ago

@markrages for sure! We all had our own needs. Someday I'll

I think the cmsis-svd library is sufficient here and there is a cmsis-svd branch which I believe is complete but not yet thoroughly tested because I don't have time for microcontroller things these days. Out of curiosity what is cmsis-svd missing? Maybe there are some details I'm unaware of...

https://github.com/bnahill/PyCortexMDebug/tree/switch-to-cmsis_svd

So far I've tested just playing around with the IO stubbed out to just print the accesses being made and it seems to work as expected, I think dealing with most of the quirks of SVD. I'm not sure if I changed the usage at all when neatening things but it's certainly a lot cleaner than it used to be. I'd appreciate any testing but understand most aren't in the business to test janky code out on the internet. I have a few microcontroller projects in the queue so maybe it'll get some attention again soon.