Before doing STM32 development in order to obtain the STM32 chip internal data into a variety of methods. The first is to use the serial port to send data, and later the system updated to WIN10 after the serial drive is incompatible, so found another way to debug.
I was developing stm32 in Keil, STM32 program was compiled by Keil compiler and then downloaded to the chip via Jlink. In debug mode, you can view Stm32 's running memory directly, as shown in Figure 1-1
Figure 1-1 variable values and their memory values in Stm32
Whenever you know the address of an array in memory, you can find the sampled values stored in the corresponding address. The Keil also provides a built-in command to store the contents of the chip memory corresponding address segment on the computer, with the command format shown in table 1-1:
Table 1-1 Save Command Arguments
Command name |
First parameter |
A second parameter |
Save |
File location |
Memory segment Start position, Memory segment End Position |
For the demodubuffer1[5000] array in Figure 1-1, the starting address is 0x20000058, because each element occupies 2 bytes, so its last data address 0x20002767 (the array occupies 10000 bytes in total, Converting to 16 is 0x2710, that is, the last data address is 0x20000058+0x2710–0x1 = 0x20002767). Call the command "save". /sample.txt 0x20000058,0x20002767 "After the data is saved to the Sample.txt file, the data in the file is shown in Figure 1-2:
Figure 1-2 HEX386 format file saved to your computer
All of the memory data is stored in the HEX386 format, with the format meaning shown in table 1-2:
Table 2-2 HEX386 file formats
Format |
: Llaaaarrdddd ..... Ddddcc |
: |
The data that is used to represent the symbol follows the HEX386 format |
LL |
Length field, which represents the number of bytes in the data segment (D) |
Aaaa |
Address field, which represents the first byte of a data segment |
Rr |
Record type, indicating the meaning of the data segment value 00 Representative data 01 means end of record 02 for extension segment address records 04 for extended linear address records
|
Dd |
Data, which represents the memory |
Cc |
Checksum value, used to determine whether the obtained data is correct |
Stm32 is a small-end storage method, memory is a unit of 8bit a byte.