Typically it happens that I need to simulate not existing peripherals or change variables content at run time. Such can be easily done by a traditional debugger , if you start code execution from scratch. While with my AURIX Debugger, it is always possible to connect at any time and change variables content on the fly. Such even without stopping code execution!
To give some examples of it, I still use the well known binary ("Arduino_KIT_TC275_LK.hex") manipulating the variable 'chn36Measurement':
Clearly we must know where the compiler puts such variable in the SRAM memory. One way is to look into the link file (or the ELF file). In my case, the variable 'chn36Measurement' is located at 0x60000008, quite at the beginning of DSPR1 SRAM:
DUMP at RUN-TIME
As first example, I give reset-and-halt, run, halt and the dump the first 4 long-words from DSPR1 SRAM start:
Where the 'chn36Measurement' variable contains 0x4E7. To display it, you can use: "dump 0x60000000 4" (4 long-words dump) or "read 0x60000000" (read word) commands.
Change Variable content at RUN-TIME
Now, let's modify such variable, as for example:
Where, by using the command "write 0x60000008 0x11223344" we modify the 'chn36Measurement' variable. As visible above.
Byte-wise write to modify variables at RUN-TIME
Now, let's modify only le least significant byte of our 'chn36Measurement' variable, as for example:
Where, by using the command "w8 0x60000008 0x55" we modify only the least significant byte of 'chn36Measurement' variable. As visible above (note that the dumped value is now showing 0x11223355).
Byte-wise read of variables at RUN-TIME
Now, let's read only le least significant byte of our 'chn36Measurement' variable, as for example:
Where, by using the command "r8 0x60000008" we get only the least significant byte of 'chn36Measurement' variable; now 0x55.
Sources and AURIX Debugger download at: https://github.com/aurixinino/aurixocd/tree/main/AURIX_DEBUG_6
Commenti
Posta un commento