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

Allow string for cpuFrequency and swoFrequency #1060

Open
mm-mm-bb opened this issue Nov 12, 2024 · 3 comments
Open

Allow string for cpuFrequency and swoFrequency #1060

mm-mm-bb opened this issue Nov 12, 2024 · 3 comments

Comments

@mm-mm-bb
Copy link

I need to support different chip with clock speed.
The setup is:

  • in the CMakePresets.json, each preset define a cacheVariables with the desired clock speed
  • cmake will save that variables inside of the .vscode/settings.json
  • in the launch.json i assign the variable to the "swoConfig.cpuFrequency"

Unfortunately, while this work for stuff like the swoPort, on the cpuFrequency field i get error "Expected "number"."

Describe the solution you'd like
Allow cpuFrequency and swoFrequency (but really any numeric field) to be a string.
Something similar was implemented here: https://github.com/microsoft/vscode-js-debug/pull/1880/files

Describe alternatives you've considered
CMake would have to edit the launch.json and not only the setting.json.
(launch.json using cacheVariables directly would NOT fix, as seems ${} must be in quotes to work)

@haneefdm
Copy link
Collaborator

Show me what your launch.json line for swoConfig.cpuFrequency looks like now and after the change. I am not understanding

@mm-mm-bb
Copy link
Author

this works

  "swoConfig":{
      [...]
      "swoFrequency": 2250000,
      [...]
   }

this does not work (not a number error)

  "swoConfig":{
      [...]
      "swoFrequency": "${config:target_core_clock}",
      [...]
   }

this does not work (unrecognized syntax)

  "swoConfig":{
      [...]
      "swoFrequency": ${config:target_core_clock},
      [...]
   }

target_core_clock is defined in .vscode/settings.json. Im using other variables set there, for example "svdFile": "${config:TARGET_SVD}", and that is fine

@mm-mm-bb
Copy link
Author

ok, took a little look at the code unfortunately is my first time looking at .ts.
seems like some of the field are string, some are numerics:

export interface SWOConfiguration {

not sure if the fix is as easy as changing to string, as that may break existing setups; maybe string|number is possible?

@haneefdm if you give me a hint on what is the best solution, i may give a try this weekend :)

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

No branches or pull requests

2 participants