The use of xilinx vivado sdk debugging skills c/c++ pointer record

1. Brief description

       During the period of soc fpga like ZYNQ, it was really too difficult to develop. It is already very difficult to develop fpga proficiently. Now fpga hardware logic needs to be developed, and arm is needed. I have been using zynq fpga for more than a year now, and I use zynq intermittently for projects, which is very cool and sour. Today, I will make a special note of c/c++ pointers. It’s not difficult. It’s easy to get confused. If you don’t write c code for a week, the pointers will not be used. You will have to take some time to pick them up every time. To improve efficiency, let’s summarize , Combined with vivado's SDK development tool record.

2. Body

1) Preparation

        Vivado builds a simple PS project (remember to check uart), generate bit, export hardware, start SDK, and create a new helloworld project. Then run to see if the serial port can print helloworld. If you can, this will successfully build the project.

2) Start

       (1) Enter the debug mode, the page is as follows, the yellow box is where the code is currently running, we have to click the button in the red box to perform single-step debugging (this is very familiar to those who are familiar with MCU or arm development), we simply go to hello Simply add the code in the blue box to the world source code. You can see that there is variable information in the pink box, and the current value is incorrect, because the line of data has not been executed yet. Click the red box and the value will become the value assigned by our code.

       (2) After clicking, you can see that the data value has changed. This is a decimal number, which can be converted into a hexadecimal number with a calculator, which is the same. Place the mouse on the data and the data information will be displayed, you can know the data address, such as the red box. In the lower right corner, click to enter memory, click the plus sign, and fill in the address of data, you can know the value of data in memory now. These are simple sdk debugging techniques.

       (3) Add the following pointer code, run it, and check the value in the address 0x01000000 in memory. Because it is a char type, it is a byte, and the arm is 32 bits, so this data occupies the lower 8 bits, and the value is correct.

       (4) Put the mouse on srcDPtr, and the information will be displayed as shown below. His value is 0x01000000, and his address is 0x10c020, which is quite confusing here. It can be understood that we assign 0x01000000 to srcDPtr, which is a variable of srcDPtr, so there should be a corresponding memory address. Here you can fully understand the pointer, the value of the pointer variable is the value of the corresponding address, the value of the pointer variable itself also needs memory storage, so it also has an address. Quite convoluted, so if you don't write c code every few days, it seems easy to be confused.

     (5) Add the following code and verify it according to the previous method.

3. Summary

    The learning process is very long, but looking back, it turns out that I have gone so far, looking into the distance, continue to move forward! ! !

Welcome to follow my public account: Core Kingdom, there are more FPGA & digital IC technology sharing, and you can also get open source FPGA projects!

Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_40377195/article/details/104312377