最近在研究大神給我的一個程序,挺長的,如果不是單步調試估計是看不懂了,其實編譯運行都是沒問題的,然後注意編譯的時候要加一個"-g"選項,保留調試信息,最好不要優化,即"-O0",運行時的命令行參數是:
./mkimage_imx8mm -fit -loader u-boot-spl-ddr.bin 0x7E1000 -out flash.bin
然後需要在調試時彈出來的launch.json配置文件中設置,主要注意兩個地方,
第一個是指定運行程序的位置:"program": "${workspaceFolder}/iMX8MM/mkimage_imx8mm",
另一個要注意的地方帶的參數之間每個空格都要用引號分隔開:"args": ["-fit","-loader","u-boot-spl-ddr.bin","0x7E1000","-out","flash.bin"]
其他基本保持默認就可以了。
完整的launch.json文件如下所示:
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/iMX8MM/mkimage_imx8mm",
"args": ["-fit","-loader","u-boot-spl-ddr.bin","0x7E1000","-out","flash.bin"],
"stopAtEntry": true,
"cwd": "${workspaceFolder}/iMX8MM/",
"environment": [],
"externalConsole": true,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}