Skip to main content
Visitor II
April 8, 2023
Question

Can a variable be modified by using it's name instead of it's address?

  • April 8, 2023
  • 3 replies
  • 1174 views

Hard coding address for variables could be problematic as the linker can move them during development. Is there a way to write a variable using its name instead of its address? The variables node has this information. How can I use the name in a templet to change the value of a variable?

    This topic has been closed for replies.

    3 replies

    Graduate II
    April 8, 2023

    Should be in object file as a symbol.​

    Visitor II
    April 8, 2023

    Mayve start from what do you want to achieve rather than one method which might not be the best solution. Magling through object, map or elf file seems weird.

    Explorer II
    August 24, 2023

    Yes, it is possible by using little helper function node. You can try my WriteByName v1.0 node (tested in STM32CubeMonitor 1.6.0).

    https://youtu.be/B6R8yJ6DEQo

    Download node source code (can be imported in cube monitor): nodes10.zip - nodes for STM32CubeMonitor 

    How it works: on the first run all variable names are used to build global variables with JSON messages. Those JSON messages contain variable memory address and type. When buttont/text is entered, this JSON message "value" is modified and sent to "acq out" / "probe out".