Dump variables to PC

General discussions about working with the Astrobe IDE and programming ARM Cortex-M0, M3, M4 and M7 microcontrollers.
Post Reply
steve64
Posts: 44
Joined: Mon Jul 09, 2018 8:56 am
Location: Italy

Dump variables to PC

Post by steve64 » Tue Oct 23, 2018 11:02 am

I'm trying to fill an Oberon-07 array variable inside a program and, after program termination,
dumping back the array from the PC.

The array is defined as:

VAR
shared: ARRAY 32 OF BYTE;

and filled in the init body as:

FOR i := 0 TO 15 DO
shared := i
END;

where I also print the physical addresses as follows;

Out.Hex(SYSTEM.ADR(shared[0]),0); Out.Ln;
Out.Hex(SYSTEM.ADR(shared[1]),0); Out.Ln;
Out.Hex(SYSTEM.ADR(shared[2]),0); Out.Ln;

getting the following addresses:

2007F5C8H
2007F5C9H
2007F5CAH

Then on PC side I dump that memory area with ST-Link CLI tool:

st-link_cli -r8 2007F5C8 16
...
0x2007F5C8 : 63 69 81 26 6C 81 07 DE 54 EF 0A 9B DC F5 07 20
0x2007F5D8 : 3D 25 00 08 00 00

where dumped values are completely different. Am I missing something?
Last edited by steve64 on Tue Oct 23, 2018 3:50 pm, edited 1 time in total.

cfbsoftware
Site Admin
Posts: 525
Joined: Fri Dec 31, 2010 12:30 pm
Contact:

Re: Dump variables to PC

Post by cfbsoftware » Tue Oct 23, 2018 12:06 pm

I ran a similar test using the View > Device memory feature of the GUI STM32 ST-LINK Utility and it worked fine.

Make sure that the array shared is a global array and not local to a procedure. If it is local then the variables are stored on the stack and the storage space could subsequently be reused after the procedure terminates.

steve64
Posts: 44
Joined: Mon Jul 09, 2018 8:56 am
Location: Italy

Re: Dump variables to PC

Post by steve64 » Tue Oct 23, 2018 3:48 pm

The array is defined at module-level. Tomorrow I will check with the GUI utility instead of the CLI.

steve64
Posts: 44
Joined: Mon Jul 09, 2018 8:56 am
Location: Italy

Re: Dump variables to PC

Post by steve64 » Wed Oct 24, 2018 12:24 pm

I have now found the solution. The CLI command must connect in "hotplug" mode:

st-link_cli -c HOTPLUG -r8 2007F5C8 12

Thanks for previous feedback.

Post Reply