iarsystems / iar-vsc-debug

Visual Studio Code extension for the IAR C-SPY debugger
19 stars 1 forks source link

C-SPY macros #8

Closed pfitzner-io closed 2 years ago

pfitzner-io commented 2 years ago

Hi, I'm currently trying do download an extra image via the macro __loadImage and therefore created a mac file with the execUserSetup function. Unfortunately I'm not able to download it to my target. I tried the setupMacros option inside the launch json but it will not download the extra image.

setupMacros": [ "Path\File.mac" ]

If I put the mac file inside the deviceMacros option I can see via debug console that the extra image is downloaded to the target but debugging is then not working anymore. I guess it is also the wrong place as the name implies.

Also the option to pass arguments to the mac file via --macro_param would be helpful

Regards

HampusAdolfsson commented 2 years ago

Hi, It seems we've made a typo in the launch.json specification. The debugger expects a field called "macros", not "setupMacros". I'll make sure we fix this in the next release.

If you change setupMacros to macros in your launch.json, does that fix your problem? You can ignore any warnings about "Property macros is not allowed".

pfitzner-io commented 2 years ago

the macro file is now registered and executed but unfortunately it is not doing the same as the ide debugger->Images->Download extra image option. with the macro function __loadImage("Application.elf", 0, 0); the application is not stored in rom whereas with the ide option Download extra image the application is stored in rom.

the debug session is starting but no halt on entry. the session is like frozen whereas when i do the same setup with the mac file in the ide I can at least start debugging

HampusAdolfsson commented 2 years ago

That sounds like it might be another bug, I'll have a look at it. I'll also see if we could support macro parameters.

I won't be working in the coming weeks, however, so it might be a while until I can work on this.

HampusAdolfsson commented 2 years ago

Sorry for the delay. Could you clarify what is going wrong when using __loadImage? Is the image being downloaded to the wrong address, or is it not being downloaded at all. Is there any relevant output in the debug console?