当前位置: 首页 > news >正文

debug - MCUXpresso - 将NXP工程编译过程的所有命令行参数找出来

文章目录

    • debug - MCUXpresso - 将NXP工程编译过程的所有命令行参数找出来
    • 概述
    • 笔记
    • cmd1
      • 整理
    • cmd2
      • 整理
    • cmd3
      • 整理
    • cmd4
      • 整理
    • cmd5
      • 整理
    • cmd6
      • 整理
    • cmd7
      • 整理
    • cmd8
      • 整理
    • cmd9
      • 整理
    • cmd10
      • 整理
    • cmd11
      • 整理
    • cmd12
      • 整理
    • cmd13
      • 整理
    • cmd14
      • 整理
    • cmd15
      • 整理
    • 第2次整理
      • step1
      • step2
      • step3
      • step4
      • step5
      • step6
    • 备注
    • 备注
    • END

debug - MCUXpresso - 将NXP工程编译过程的所有命令行参数找出来

概述

在这里插入图片描述
MCUXpresso的控制台窗口有编译日志,看了一下,全么?

16:43:14 **** Build of configuration Debug for project test3 ****
make -r -j16 all 
Building file: ../src/cr_cpp_config.cpp
Building file: ../src/cr_startup_lpc175x_6x.cpp
Building file: ../src/crp.c
Building file: ../src/test3.cpp
Invoking: MCU C++ Compiler
Invoking: MCU C++ Compiler
arm-none-eabi-c++ -DDEBUG -D__CODE_RED -D__NEWLIB__ -DCORE_M3 -DCPP_NO_HEAP -D__LPC17XX__ -O0 -fno-common -g3 -gdwarf-4 -Wall -c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fmerge-constants -fmacro-prefix-map="../src/"= -mcpu=cortex-m3 -mthumb -fstack-usage -MMD -MP -MF"src/cr_cpp_config.d" -MT"src/cr_cpp_config.o" -MT"src/cr_cpp_config.d" -o "src/cr_cpp_config.o" "../src/cr_cpp_config.cpp"
Invoking: MCU C Compiler
Invoking: MCU C++ Compiler
arm-none-eabi-c++ -DDEBUG -D__CODE_RED -D__NEWLIB__ -DCORE_M3 -DCPP_NO_HEAP -D__LPC17XX__ -O0 -fno-common -g3 -gdwarf-4 -Wall -c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fmerge-constants -fmacro-prefix-map="../src/"= -mcpu=cortex-m3 -mthumb -fstack-usage -MMD -MP -MF"src/cr_startup_lpc175x_6x.d" -MT"src/cr_startup_lpc175x_6x.o" -MT"src/cr_startup_lpc175x_6x.d" -o "src/cr_startup_lpc175x_6x.o" "../src/cr_startup_lpc175x_6x.cpp"
arm-none-eabi-gcc -std=gnu11 -DDEBUG -D__CODE_RED -D__NEWLIB__ -DCORE_M3 -DCPP_NO_HEAP -D__LPC17XX__ -O0 -fno-common -g3 -gdwarf-4 -Wall -c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections -fmerge-constants -fmacro-prefix-map="../src/"= -mcpu=cortex-m3 -mthumb -fstack-usage -MMD -MP -MF"src/crp.d" -MT"src/crp.o" -MT"src/crp.d" -o "src/crp.o" "../src/crp.c"
arm-none-eabi-c++ -DDEBUG -D__CODE_RED -D__NEWLIB__ -DCORE_M3 -DCPP_NO_HEAP -D__LPC17XX__ -O0 -fno-common -g3 -gdwarf-4 -Wall -c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fmerge-constants -fmacro-prefix-map="../src/"= -mcpu=cortex-m3 -mthumb -fstack-usage -MMD -MP -MF"src/test3.d" -MT"src/test3.o" -MT"src/test3.d" -o "src/test3.o" "../src/test3.cpp"
Finished building: ../src/cr_cpp_config.cppFinished building: ../src/cr_startup_lpc175x_6x.cppFinished building: ../src/crp.cFinished building: ../src/test3.cppBuilding target: test3.axf
Invoking: MCU C++ Linker
arm-none-eabi-c++ -nostdlib -Xlinker -Map="test3.map" -Xlinker --cref -Xlinker --gc-sections -Xlinker -print-memory-usage -mcpu=cortex-m3 -mthumb -T test3_Debug.ld -o "test3.axf" ./src/cr_cpp_config.o ./src/cr_startup_lpc175x_6x.o ./src/crp.o ./src/test3.o   
Memory region         Used Size  Region Size  %age UsedMFlash512:         776 B       512 KB      0.15%RamLoc32:          28 B        32 KB      0.09%RamAHB32:           0 B        32 KB      0.00%
Finished building target: test3.axfPerforming post-build steps
arm-none-eabi-size "test3.axf"; # arm-none-eabi-objcopy -v -O binary "test3.axf" "test3.bin" ; # checksum -p LPC1769 -d "test3.bin";text	   data	    bss	    dec	    hex	filename776	      0	     28	    804	    324	test3.axf16:43:16 Build Finished. 0 errors, 0 warnings. (took 2s.116ms)

整理一下,看看编译命令是否全?
整理了一下,命令都在,但是,不是特意将每个命令分开记录的(日志里面的一行,记录了多个arm-gcc命令行)。
且最后一个命令arm-none-eabi-size 后面还有一个注释,里面也有命令,却没执行。莫非执行命令行时,还能带注释?没听说过啊。
还是不放心,准备自己用调试工具将编译命令全部收集起来分析,这样最准确。

调试方法和上次的笔记一样。(debug - MDK - arm-none-eabi - 将MDK工程编译过程的所有命令行参数找出来)

笔记

在这里插入图片描述
将能编译过的工程先清一下。
看下PID
在这里插入图片描述
打开Procmon64.exe
添加过滤器
将当前MCUXPresso IDE的PID填进去
在这里插入图片描述
将进程创建加进去。
在这里插入图片描述
将进程开始和结束也加进去。
在这里插入图片描述
点击OK, 进入监控状态
在MCUXpresso中,清除一下工程,能看到调用了外部命令

Command line:	"C:\nxp\MCUXpressoIDE_25.6.136\ide\plugins\org.eclipse.cdt.core.win32.x86_64_11.4.0.202311271618\os\win32\x86_64\starter.exe" 2556 11 SABreak09fc0000000b SAWait09fc0000000b SATerm09fc0000000b SAKill09fc0000000b SACtrlc09fc0000000b 0 make -r -j16 clean

整理一下

"C:\nxp\MCUXpressoIDE_25.6.136\ide\plugins\org.eclipse.cdt.core.win32.x86_64_11.4.0.202311271618\os\win32\x86_64\starter.exe" 
2556 
11 
SABreak09fc0000000b SAWait09fc0000000b SATerm09fc0000000b SAKill09fc0000000b SACtrlc09fc0000000b 0 
make -r -j16 clean

这个命令好怪,是nxp家自己用的。
到现在,可以看出,MCUXpresso干活时,如果用到了外部的命令行工具,就会被捕获住。
那现在可以抓NXP工程如何被编译的了。

先清Procmon的主view.
在这里插入图片描述
编译工程
在这里插入图片描述
只捕获了一条,就编译完了。
在这里插入图片描述
捕获的这条信息如下:

Date:	2025-10-17 17:17:19.3366569
Thread:	44080
Class:	Process
Operation:	Process Create
Result:	SUCCESS
Path:	C:\nxp\MCUXpressoIDE_25.6.136\ide\plugins\org.eclipse.cdt.core.win32.x86_64_11.4.0.202311271618\os\win32\x86_64\starter.exe
Duration:	0.0000000
PID:	44856
Command line:	"C:\nxp\MCUXpressoIDE_25.6.136\ide\plugins\org.eclipse.cdt.core.win32.x86_64_11.4.0.202311271618\os\win32\x86_64\starter.exe" 2556 12 SABreak09fc0000000c SAWait09fc0000000c SATerm09fc0000000c SAKill09fc0000000c SACtrlc09fc0000000c 0 make -r -j16 all 

可以看出MCUXpresso编译工程时,是委托了他家自己的一个工具 starter.exe 来调用make来编译。
因为这个starter.exe只是运行一次就退出,还没法用PID的方法去监控。
现在修改过滤器,监控进程名称包含 starter.exe 的进程的操作。
在这里插入图片描述
现在监控的是nxp家starter.exe的创建进程操作。

在这里插入图片描述
make是gnu原版的。

C:\nxp\MCUXpressoIDE_25.6.136\ide\plugins\com.nxp.mcuxpresso.tools.win32_25.6.0.202501151204\buildtools\bin>make --version
GNU Make 4.4.1
Built for x86_64-w64-mingw32
Copyright (C) 1988-2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

看到,starter.exe是调用的make.exe来干活也不是他自己干的活…
那现在监控nxp家的make.exe的干活。
修改过滤器如下
在这里插入图片描述
将工程clear, 清procmon主view, 重新编译工程。
在这里插入图片描述
抓了一些,看一下。

C:/nxp/MCUXpressoIDE_25.6.136/ide/plugins/com.nxp.mcuxpresso.tools.win32_25.6.0.202501151204/buildtools/bin/sh.exe -c "arm-none-eabi-c++ -DDEBUG -D__CODE_RED -D__NEWLIB__ -DCORE_M3 -DCPP_NO_HEAP -D__LPC17XX__ -O0 -fno-common -g3 -gdwarf-4 -Wall -c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fmerge-constants -fmacro-prefix-map=\"../src/\"= -mcpu=cortex-m3 -mthumb -fstack-usage -MMD -MP -MF\"src/cr_startup_lpc175x_6x.d\" -MT\"src/cr_startup_lpc175x_6x.o\" -MT\"src/cr_startup_lpc175x_6x.d\" -o \"src/cr_startup_lpc175x_6x.o\" \"../src/cr_startup_lpc175x_6x.cpp\""

可以看出,make使用sh.exe启动的arm-none-eabi-x, 也并没有直接调用arm-gcc的命令行。

C:\nxp\MCUXpressoIDE_25.6.136\ide\plugins\com.nxp.mcuxpresso.tools.win32_25.6.0.202501151204\buildtools\bin\echo.exe

可以看出MCUXpresso上的编译提示信息,都是echo.exe打印出来的(应该是重定向到了MCUXpresso的控制台上)
在这里插入图片描述
可以看出sh.exe是可以处理带注释的命令行。
但是arm-gcc的exe是否能带命令行的注释未知。不知道为啥要命令行带注释,好奇怪。

看了一圈,sh.exe都是调用的 arm-none-eabi-x.exe来编译源码,用echo.exe来打印MCUXpresso控制台中的提示信息。

那现在只能去检测arm-none-eabi-x.exe的调用了。
转了一圈,虽然还是要直接检测创建的进程名字中包含 arm-none-eabi-x.exe的命令行。但是也大概知道了MCUXpresso最终怎么调用到的arm-gcc工具链。

修改过滤器如下,进程创建和进程开始都要过滤出来(发现有些进程没有经过进程创建,只有进程开始)
在这里插入图片描述
一共抓到15条arm-gcc的命令行调用。
在这里插入图片描述
逐个记录下来。

cmd1

arm-none-eabi-c++ -DDEBUG -D__CODE_RED -D__NEWLIB__ -DCORE_M3 -DCPP_NO_HEAP -D__LPC17XX__ -O0 -fno-common -g3 -gdwarf-4 -Wall -c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fmerge-constants -fmacro-prefix-map=../src/= -mcpu=cortex-m3 -mthumb -fstack-usage -MMD -MP -MFsrc/cr_cpp_config.d -MTsrc/cr_cpp_config.o -MTsrc/cr_cpp_config.d -o src/cr_cpp_config.o ../src/cr_cpp_config.cpp

整理

// cr_cpp_config.cpp => cr_cpp_config.oarm-none-eabi-c++ 
-DDEBUG -D__CODE_RED -D__NEWLIB__ -DCORE_M3 -DCPP_NO_HEAP -D__LPC17XX__ 
-O0 -fno-common -g3 -gdwarf-4 -Wall -c -fmessage-length=0 -fno-builtin 
-ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fmerge-constants -fmacro-prefix-map=../src/= 
-mcpu=cortex-m3 -mthumb -fstack-usage -MMD -MP 
-MFsrc/cr_cpp_config.d 
-MTsrc/cr_cpp_config.o 
-MTsrc/cr_cpp_config.d 
-o src/cr_cpp_config.o 
../src/cr_cpp_config.cpp

cmd2

arm-none-eabi-c++ -DDEBUG -D__CODE_RED -D__NEWLIB__ -DCORE_M3 -DCPP_NO_HEAP -D__LPC17XX__ -O0 -fno-common -g3 -gdwarf-4 -Wall -c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fmerge-constants -fmacro-prefix-map=../src/= -mcpu=cortex-m3 -mthumb -fstack-usage -MMD -MP -MFsrc/cr_startup_lpc175x_6x.d -MTsrc/cr_startup_lpc175x_6x.o -MTsrc/cr_startup_lpc175x_6x.d -o src/cr_startup_lpc175x_6x.o ../src/cr_startup_lpc175x_6x.cpp

整理

// cr_startup_lpc175x_6x.cpp => cr_startup_lpc175x_6x.oarm-none-eabi-c++ 
-DDEBUG -D__CODE_RED -D__NEWLIB__ -DCORE_M3 -DCPP_NO_HEAP -D__LPC17XX__ -O0 
-fno-common -g3 -gdwarf-4 -Wall -c -fmessage-length=0 -fno-builtin -ffunction-sections 
-fdata-sections -fno-rtti -fno-exceptions -fmerge-constants -fmacro-prefix-map=../src/= 
-mcpu=cortex-m3 -mthumb -fstack-usage -MMD -MP 
-MFsrc/cr_startup_lpc175x_6x.d 
-MTsrc/cr_startup_lpc175x_6x.o 
-MTsrc/cr_startup_lpc175x_6x.d 
-o src/cr_startup_lpc175x_6x.o 
../src/cr_startup_lpc175x_6x.cpp

cmd3

arm-none-eabi-gcc -std=gnu11 -DDEBUG -D__CODE_RED -D__NEWLIB__ -DCORE_M3 -DCPP_NO_HEAP -D__LPC17XX__ -O0 -fno-common -g3 -gdwarf-4 -Wall -c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections -fmerge-constants -fmacro-prefix-map=../src/= -mcpu=cortex-m3 -mthumb -fstack-usage -MMD -MP -MFsrc/crp.d -MTsrc/crp.o -MTsrc/crp.d -o src/crp.o ../src/crp.c

整理

// crp.c => crp.oarm-none-eabi-gcc 
-std=gnu11 -DDEBUG -D__CODE_RED -D__NEWLIB__ -DCORE_M3 -DCPP_NO_HEAP -D__LPC17XX__ -O0 
-fno-common -g3 -gdwarf-4 -Wall -c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections -fmerge-constants -fmacro-prefix-map=../src/= 
-mcpu=cortex-m3 -mthumb -fstack-usage -MMD -MP 
-MFsrc/crp.d 
-MTsrc/crp.o 
-MTsrc/crp.d 
-o src/crp.o 
../src/crp.c

cmd4

arm-none-eabi-c++ -DDEBUG -D__CODE_RED -D__NEWLIB__ -DCORE_M3 -DCPP_NO_HEAP -D__LPC17XX__ -O0 -fno-common -g3 -gdwarf-4 -Wall -c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fmerge-constants -fmacro-prefix-map=../src/= -mcpu=cortex-m3 -mthumb -fstack-usage -MMD -MP -MFsrc/test3.d -MTsrc/test3.o -MTsrc/test3.d -o src/test3.o ../src/test3.cpp

整理

test3.cpp => test3.oarm-none-eabi-c++ 
-DDEBUG -D__CODE_RED -D__NEWLIB__ -DCORE_M3 -DCPP_NO_HEAP -D__LPC17XX__ -O0 
-fno-common -g3 -gdwarf-4 -Wall -c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fmerge-constants -fmacro-prefix-map=../src/= 
-mcpu=cortex-m3 -mthumb -fstack-usage -MMD -MP 
-MFsrc/test3.d 
-MTsrc/test3.o 
-MTsrc/test3.d 
-o src/test3.o 
../src/test3.cpp

cmd5

C:/nxp/MCUXpressoIDE_25.6.136/ide/plugins/com.nxp.mcuxpresso.tools.win32_25.6.0.202501151204/tools/bin/../libexec/gcc/arm-none-eabi/14.2.1/cc1plus.exe -quiet -imultilib thumb/v7-m/nofp -iprefix C:/nxp/MCUXpressoIDE_25.6.136/ide/plugins/com.nxp.mcuxpresso.tools.win32_25.6.0.202501151204/tools/bin/../lib/gcc/arm-none-eabi/14.2.1/ -isysroot C:/nxp/MCUXpressoIDE_25.6.136/ide/plugins/com.nxp.mcuxpresso.tools.win32_25.6.0.202501151204/tools/bin/../arm-none-eabi -MMD src/cr_cpp_config.d -MF src/cr_cpp_config.d -MP -MT src/cr_cpp_config.o -MT src/cr_cpp_config.d -dD -D__USES_INITFINI__ -D DEBUG -D __CODE_RED -D __NEWLIB__ -D CORE_M3 -D CPP_NO_HEAP -D __LPC17XX__ ../src/cr_cpp_config.cpp -quiet -dumpdir src/ -dumpbase cr_cpp_config.cpp -dumpbase-ext .cpp -mcpu=cortex-m3 -mthumb -mfloat-abi=soft -mlibarch=armv7-m -march=armv7-m -g3 -gdwarf-4 -O0 -Wall -fno-common -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fmerge-constants -fmacro-prefix-map=../src/= -fstack-usage -o C:\Users\chenx\AppData\Local\Temp\ccnRcrIk.s

整理

// cr_cpp_config.cpp to ccnRcrIk.scc1plus.exe -quiet -imultilib thumb/v7-m/nofp 
-iprefix C:/nxp/MCUXpressoIDE_25.6.136/ide/plugins/com.nxp.mcuxpresso.tools.win32_25.6.0.202501151204/tools/bin/../lib/gcc/arm-none-eabi/14.2.1/ 
-isysroot C:/nxp/MCUXpressoIDE_25.6.136/ide/plugins/com.nxp.mcuxpresso.tools.win32_25.6.0.202501151204/tools/bin/../arm-none-eabi 
-MMD src/cr_cpp_config.d 
-MF src/cr_cpp_config.d 
-MP -MT src/cr_cpp_config.o 
-MT src/cr_cpp_config.d 
-dD -D__USES_INITFINI__ -D DEBUG -D __CODE_RED -D __NEWLIB__ -D CORE_M3 -D CPP_NO_HEAP -D __LPC17XX__ 
../src/cr_cpp_config.cpp -quiet -dumpdir src/ -dumpbase cr_cpp_config.cpp -dumpbase-ext .cpp 
-mcpu=cortex-m3 -mthumb -mfloat-abi=soft -mlibarch=armv7-m -march=armv7-m -g3 -gdwarf-4 -O0 -Wall -fno-common -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fmerge-constants -fmacro-prefix-map=../src/= 
-fstack-usage -o C:\Users\chenx\AppData\Local\Temp\ccnRcrIk.s

cmd6

C:/nxp/MCUXpressoIDE_25.6.136/ide/plugins/com.nxp.mcuxpresso.tools.win32_25.6.0.202501151204/tools/bin/../libexec/gcc/arm-none-eabi/14.2.1/cc1plus.exe -quiet -imultilib thumb/v7-m/nofp -iprefix C:/nxp/MCUXpressoIDE_25.6.136/ide/plugins/com.nxp.mcuxpresso.tools.win32_25.6.0.202501151204/tools/bin/../lib/gcc/arm-none-eabi/14.2.1/ -isysroot C:/nxp/MCUXpressoIDE_25.6.136/ide/plugins/com.nxp.mcuxpresso.tools.win32_25.6.0.202501151204/tools/bin/../arm-none-eabi -MMD src/cr_startup_lpc175x_6x.d -MF src/cr_startup_lpc175x_6x.d -MP -MT src/cr_startup_lpc175x_6x.o -MT src/cr_startup_lpc175x_6x.d -dD -D__USES_INITFINI__ -D DEBUG -D __CODE_RED -D __NEWLIB__ -D CORE_M3 -D CPP_NO_HEAP -D __LPC17XX__ ../src/cr_startup_lpc175x_6x.cpp -quiet -dumpdir src/ -dumpbase cr_startup_lpc175x_6x.cpp -dumpbase-ext .cpp -mcpu=cortex-m3 -mthumb -mfloat-abi=soft -mlibarch=armv7-m -march=armv7-m -g3 -gdwarf-4 -O0 -Wall -fno-common -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fmerge-constants -fmacro-prefix-map=../src/= -fstack-usage -o C:\Users\chenx\AppData\Local\Temp\ccqW7swd.s

整理

// cr_startup_lpc175x_6x.cpp => ccqW7swd.scc1plus.exe -quiet -imultilib thumb/v7-m/nofp 
-iprefix C:/nxp/MCUXpressoIDE_25.6.136/ide/plugins/com.nxp.mcuxpresso.tools.win32_25.6.0.202501151204/tools/bin/../lib/gcc/arm-none-eabi/14.2.1/ 
-isysroot C:/nxp/MCUXpressoIDE_25.6.136/ide/plugins/com.nxp.mcuxpresso.tools.win32_25.6.0.202501151204/tools/bin/../arm-none-eabi 
-MMD src/cr_startup_lpc175x_6x.d 
-MF src/cr_startup_lpc175x_6x.d 
-MP -MT src/cr_startup_lpc175x_6x.o 
-MT src/cr_startup_lpc175x_6x.d 
-dD -D__USES_INITFINI__ -D DEBUG -D __CODE_RED -D __NEWLIB__ -D CORE_M3 -D CPP_NO_HEAP -D __LPC17XX__ 
../src/cr_startup_lpc175x_6x.cpp 
-quiet -dumpdir src/ 
-dumpbase cr_startup_lpc175x_6x.cpp 
-dumpbase-ext .cpp -mcpu=cortex-m3 -mthumb -mfloat-abi=soft -mlibarch=armv7-m -march=armv7-m -g3 -gdwarf-4 -O0 -Wall -fno-common -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fmerge-constants -fmacro-prefix-map=../src/= -fstack-usage 
-o C:\Users\chenx\AppData\Local\Temp\ccqW7swd.s

cmd7

C:/nxp/MCUXpressoIDE_25.6.136/ide/plugins/com.nxp.mcuxpresso.tools.win32_25.6.0.202501151204/tools/bin/../libexec/gcc/arm-none-eabi/14.2.1/cc1.exe -quiet -imultilib thumb/v7-m/nofp -iprefix C:/nxp/MCUXpressoIDE_25.6.136/ide/plugins/com.nxp.mcuxpresso.tools.win32_25.6.0.202501151204/tools/bin/../lib/gcc/arm-none-eabi/14.2.1/ -isysroot C:/nxp/MCUXpressoIDE_25.6.136/ide/plugins/com.nxp.mcuxpresso.tools.win32_25.6.0.202501151204/tools/bin/../arm-none-eabi -MMD src/crp.d -MF src/crp.d -MP -MT src/crp.o -MT src/crp.d -dD -D__USES_INITFINI__ -D DEBUG -D __CODE_RED -D __NEWLIB__ -D CORE_M3 -D CPP_NO_HEAP -D __LPC17XX__ ../src/crp.c -quiet -dumpdir src/ -dumpbase crp.c -dumpbase-ext .c -mcpu=cortex-m3 -mthumb -mfloat-abi=soft -mlibarch=armv7-m -march=armv7-m -g3 -gdwarf-4 -O0 -Wall -std=gnu11 -fno-common -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections -fmerge-constants -fmacro-prefix-map=../src/= -fstack-usage -o C:\Users\chenx\AppData\Local\Temp\cc0uS4ch.s

整理

// crp.c => cc0uS4ch.scc1.exe -quiet -imultilib thumb/v7-m/nofp 
-iprefix C:/nxp/MCUXpressoIDE_25.6.136/ide/plugins/com.nxp.mcuxpresso.tools.win32_25.6.0.202501151204/tools/bin/../lib/gcc/arm-none-eabi/14.2.1/ 
-isysroot C:/nxp/MCUXpressoIDE_25.6.136/ide/plugins/com.nxp.mcuxpresso.tools.win32_25.6.0.202501151204/tools/bin/../arm-none-eabi 
-MMD src/crp.d 
-MF src/crp.d 
-MP 
-MT src/crp.o 
-MT src/crp.d 
-dD -D__USES_INITFINI__ -D DEBUG -D __CODE_RED -D __NEWLIB__ -D CORE_M3 -D CPP_NO_HEAP -D __LPC17XX__ 
../src/crp.c 
-quiet -dumpdir src/ 
-dumpbase crp.c 
-dumpbase-ext .c 
-mcpu=cortex-m3 -mthumb -mfloat-abi=soft -mlibarch=armv7-m -march=armv7-m -g3 -gdwarf-4 -O0 -Wall -std=gnu11 -fno-common -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections -fmerge-constants -fmacro-prefix-map=../src/= -fstack-usage 
-o C:\Users\chenx\AppData\Local\Temp\cc0uS4ch.s

cmd8

C:/nxp/MCUXpressoIDE_25.6.136/ide/plugins/com.nxp.mcuxpresso.tools.win32_25.6.0.202501151204/tools/bin/../libexec/gcc/arm-none-eabi/14.2.1/cc1plus.exe -quiet -imultilib thumb/v7-m/nofp -iprefix C:/nxp/MCUXpressoIDE_25.6.136/ide/plugins/com.nxp.mcuxpresso.tools.win32_25.6.0.202501151204/tools/bin/../lib/gcc/arm-none-eabi/14.2.1/ -isysroot C:/nxp/MCUXpressoIDE_25.6.136/ide/plugins/com.nxp.mcuxpresso.tools.win32_25.6.0.202501151204/tools/bin/../arm-none-eabi -MMD src/test3.d -MF src/test3.d -MP -MT src/test3.o -MT src/test3.d -dD -D__USES_INITFINI__ -D DEBUG -D __CODE_RED -D __NEWLIB__ -D CORE_M3 -D CPP_NO_HEAP -D __LPC17XX__ ../src/test3.cpp -quiet -dumpdir src/ -dumpbase test3.cpp -dumpbase-ext .cpp -mcpu=cortex-m3 -mthumb -mfloat-abi=soft -mlibarch=armv7-m -march=armv7-m -g3 -gdwarf-4 -O0 -Wall -fno-common -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fmerge-constants -fmacro-prefix-map=../src/= -fstack-usage -o C:\Users\chenx\AppData\Local\Temp\ccy2B8cm.s

整理

// test3.cpp => ccy2B8cm.s
cc1plus.exe 
-quiet -imultilib thumb/v7-m/nofp 
-iprefix C:/nxp/MCUXpressoIDE_25.6.136/ide/plugins/com.nxp.mcuxpresso.tools.win32_25.6.0.202501151204/tools/bin/../lib/gcc/arm-none-eabi/14.2.1/ 
-isysroot C:/nxp/MCUXpressoIDE_25.6.136/ide/plugins/com.nxp.mcuxpresso.tools.win32_25.6.0.202501151204/tools/bin/../arm-none-eabi 
-MMD src/test3.d 
-MF src/test3.d 
-MP -MT src/test3.o 
-MT src/test3.d 
-dD -D__USES_INITFINI__ -D DEBUG -D __CODE_RED -D __NEWLIB__ -D CORE_M3 -D CPP_NO_HEAP -D __LPC17XX__ 
../src/test3.cpp 
-quiet -dumpdir src/ 
-dumpbase test3.cpp 
-dumpbase-ext .cpp -mcpu=cortex-m3 -mthumb -mfloat-abi=soft -mlibarch=armv7-m -march=armv7-m -g3 -gdwarf-4 -O0 -Wall -fno-common -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fmerge-constants -fmacro-prefix-map=../src/= -fstack-usage 
-o C:\Users\chenx\AppData\Local\Temp\ccy2B8cm.s

cmd9

C:/nxp/MCUXpressoIDE_25.6.136/ide/plugins/com.nxp.mcuxpresso.tools.win32_25.6.0.202501151204/tools/bin/../lib/gcc/arm-none-eabi/14.2.1/../../../../arm-none-eabi/bin/as.exe -march=armv7-m -mfloat-abi=soft -meabi=5 -o src/cr_cpp_config.o C:\Users\chenx\AppData\Local\Temp\ccnRcrIk.s

整理

// ccnRcrIk.s => cr_cpp_config.oas.exe -march=armv7-m -mfloat-abi=soft -meabi=5 
-o src/cr_cpp_config.o 
C:\Users\chenx\AppData\Local\Temp\ccnRcrIk.s

cmd10

C:/nxp/MCUXpressoIDE_25.6.136/ide/plugins/com.nxp.mcuxpresso.tools.win32_25.6.0.202501151204/tools/bin/../lib/gcc/arm-none-eabi/14.2.1/../../../../arm-none-eabi/bin/as.exe -march=armv7-m -mfloat-abi=soft -meabi=5 -o src/cr_startup_lpc175x_6x.o C:\Users\chenx\AppData\Local\Temp\ccqW7swd.s

整理

ccqW7swd.s => cr_startup_lpc175x_6x.oas.exe -march=armv7-m -mfloat-abi=soft -meabi=5 
-o src/cr_startup_lpc175x_6x.o 
C:\Users\chenx\AppData\Local\Temp\ccqW7swd.s

cmd11

C:/nxp/MCUXpressoIDE_25.6.136/ide/plugins/com.nxp.mcuxpresso.tools.win32_25.6.0.202501151204/tools/bin/../lib/gcc/arm-none-eabi/14.2.1/../../../../arm-none-eabi/bin/as.exe -march=armv7-m -mfloat-abi=soft -meabi=5 -o src/crp.o C:\Users\chenx\AppData\Local\Temp\cc0uS4ch.s

整理

// cc0uS4ch.s => crp.oas.exe -march=armv7-m -mfloat-abi=soft -meabi=5 
-o src/crp.o 
C:\Users\chenx\AppData\Local\Temp\cc0uS4ch.s

cmd12

C:/nxp/MCUXpressoIDE_25.6.136/ide/plugins/com.nxp.mcuxpresso.tools.win32_25.6.0.202501151204/tools/bin/../lib/gcc/arm-none-eabi/14.2.1/../../../../arm-none-eabi/bin/as.exe -march=armv7-m -mfloat-abi=soft -meabi=5 -o src/test3.o C:\Users\chenx\AppData\Local\Temp\ccy2B8cm.s

整理

// ccy2B8cm.s => test3.o
as.exe -march=armv7-m -mfloat-abi=soft -meabi=5 
-o src/test3.o 
C:\Users\chenx\AppData\Local\Temp\ccy2B8cm.s

cmd13

arm-none-eabi-c++ -nostdlib -Xlinker -Map=test3.map -Xlinker --cref -Xlinker --gc-sections -Xlinker -print-memory-usage -mcpu=cortex-m3 -mthumb -T test3_Debug.ld -o test3.axf ./src/cr_cpp_config.o ./src/cr_startup_lpc175x_6x.o ./src/crp.o ./src/test3.o

整理

// link (.o) as test3.axf
// this o's set : test3_Debug.ld + cr_cpp_config.o + r_startup_lpc175x_6x.o + test3.oarm-none-eabi-c++ 
-nostdlib -Xlinker -Map=test3.map -Xlinker --cref -Xlinker --gc-sections -Xlinker -print-memory-usage -mcpu=cortex-m3 -mthumb 
-T test3_Debug.ld 
-o test3.axf 
./src/cr_cpp_config.o 
./src/cr_startup_lpc175x_6x.o 
./src/crp.o ./src/test3.o

cmd14

C:/nxp/MCUXpressoIDE_25.6.136/ide/plugins/com.nxp.mcuxpresso.tools.win32_25.6.0.202501151204/tools/bin/../libexec/gcc/arm-none-eabi/14.2.1/collect2.exe -plugin C:/nxp/MCUXpressoIDE_25.6.136/ide/plugins/com.nxp.mcuxpresso.tools.win32_25.6.0.202501151204/tools/bin/../libexec/gcc/arm-none-eabi/14.2.1/liblto_plugin.dll -plugin-opt=C:/nxp/MCUXpressoIDE_25.6.136/ide/plugins/com.nxp.mcuxpresso.tools.win32_25.6.0.202501151204/tools/bin/../libexec/gcc/arm-none-eabi/14.2.1/lto-wrapper.exe -plugin-opt=-fresolution=C:\Users\chenx\AppData\Local\Temp\cc3BwnrM.res --sysroot=C:/nxp/MCUXpressoIDE_25.6.136/ide/plugins/com.nxp.mcuxpresso.tools.win32_25.6.0.202501151204/tools/bin/../arm-none-eabi -X -o test3.axf -LC:/nxp/MCUXpressoIDE_25.6.136/ide/plugins/com.nxp.mcuxpresso.tools.win32_25.6.0.202501151204/tools/bin/../lib/gcc/arm-none-eabi/14.2.1/thumb/v7-m/nofp -LC:/nxp/MCUXpressoIDE_25.6.136/ide/plugins/com.nxp.mcuxpresso.tools.win32_25.6.0.202501151204/tools/bin/../lib/gcc/arm-none-eabi/14.2.1/../../../../arm-none-eabi/lib/thumb/v7-m/nofp -LC:/nxp/MCUXpressoIDE_25.6.136/ide/plugins/com.nxp.mcuxpresso.tools.win32_25.6.0.202501151204/tools/bin/../arm-none-eabi/lib/thumb/v7-m/nofp -LC:/nxp/MCUXpressoIDE_25.6.136/ide/plugins/com.nxp.mcuxpresso.tools.win32_25.6.0.202501151204/tools/bin/../lib/gcc/arm-none-eabi/14.2.1 -LC:/nxp/MCUXpressoIDE_25.6.136/ide/plugins/com.nxp.mcuxpresso.tools.win32_25.6.0.202501151204/tools/bin/../lib/gcc -LC:/nxp/MCUXpressoIDE_25.6.136/ide/plugins/com.nxp.mcuxpresso.tools.win32_25.6.0.202501151204/tools/bin/../lib/gcc/arm-none-eabi/14.2.1/../../../../arm-none-eabi/lib -LC:/nxp/MCUXpressoIDE_25.6.136/ide/plugins/com.nxp.mcuxpresso.tools.win32_25.6.0.202501151204/tools/bin/../arm-none-eabi/lib -Map=test3.map --cref --gc-sections -print-memory-usage ./src/cr_cpp_config.o ./src/cr_startup_lpc175x_6x.o ./src/crp.o ./src/test3.o -T test3_Debug.ld

整理

// 由arm-none-eabi-gcc调用的collect2.exe, 不用理解这里
collect2.exe 
-plugin C:/nxp/MCUXpressoIDE_25.6.136/ide/plugins/com.nxp.mcuxpresso.tools.win32_25.6.0.202501151204/tools/bin/../libexec/gcc/arm-none-eabi/14.2.1/liblto_plugin.dll 
-plugin-opt=C:/nxp/MCUXpressoIDE_25.6.136/ide/plugins/com.nxp.mcuxpresso.tools.win32_25.6.0.202501151204/tools/bin/../libexec/gcc/arm-none-eabi/14.2.1/lto-wrapper.exe 
-plugin-opt=-fresolution=C:\Users\chenx\AppData\Local\Temp\cc3BwnrM.res 
--sysroot=C:/nxp/MCUXpressoIDE_25.6.136/ide/plugins/com.nxp.mcuxpresso.tools.win32_25.6.0.202501151204/tools/bin/../arm-none-eabi 
-X -o test3.axf 
-LC:/nxp/MCUXpressoIDE_25.6.136/ide/plugins/com.nxp.mcuxpresso.tools.win32_25.6.0.202501151204/tools/bin/../lib/gcc/arm-none-eabi/14.2.1/thumb/v7-m/nofp 
-LC:/nxp/MCUXpressoIDE_25.6.136/ide/plugins/com.nxp.mcuxpresso.tools.win32_25.6.0.202501151204/tools/bin/../lib/gcc/arm-none-eabi/14.2.1/../../../../arm-none-eabi/lib/thumb/v7-m/nofp 
-LC:/nxp/MCUXpressoIDE_25.6.136/ide/plugins/com.nxp.mcuxpresso.tools.win32_25.6.0.202501151204/tools/bin/../arm-none-eabi/lib/thumb/v7-m/nofp 
-LC:/nxp/MCUXpressoIDE_25.6.136/ide/plugins/com.nxp.mcuxpresso.tools.win32_25.6.0.202501151204/tools/bin/../lib/gcc/arm-none-eabi/14.2.1 -LC:/nxp/MCUXpressoIDE_25.6.136/ide/plugins/com.nxp.mcuxpresso.tools.win32_25.6.0.202501151204/tools/bin/../lib/gcc 
-LC:/nxp/MCUXpressoIDE_25.6.136/ide/plugins/com.nxp.mcuxpresso.tools.win32_25.6.0.202501151204/tools/bin/../lib/gcc/arm-none-eabi/14.2.1/../../../../arm-none-eabi/lib 
-LC:/nxp/MCUXpressoIDE_25.6.136/ide/plugins/com.nxp.mcuxpresso.tools.win32_25.6.0.202501151204/tools/bin/../arm-none-eabi/lib -Map=test3.map 
--cref --gc-sections -print-memory-usage 
./src/cr_cpp_config.o 
./src/cr_startup_lpc175x_6x.o 
./src/crp.o 
./src/test3.o 
-T test3_Debug.ld

cmd15

arm-none-eabi-size test3.axf

整理

显示编译出的elf(axf)的信息给程序员看,没啥要解释的。

第2次整理

从抓到的15条命令看,底层的arm-gcc的exe(e.g. as.exe, ccl.exe, ccl-plus.exe, collect2.exe) 都是由arm-none-eabi-x.exe中的实现调用的。
所以,我们可以过滤掉arm-gcc调用的底层exe,再整理一下只有arm-none-eabi-x.exe的命令行,因为make调用的就是arm-none-eabi-x.exe, 并不会去调用更底层的arm-gcc的exe.

step1

// cr_cpp_config.cpp => cr_cpp_config.oarm-none-eabi-c++ 
-DDEBUG -D__CODE_RED -D__NEWLIB__ -DCORE_M3 -DCPP_NO_HEAP -D__LPC17XX__ 
-O0 -fno-common -g3 -gdwarf-4 -Wall -c -fmessage-length=0 -fno-builtin 
-ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fmerge-constants -fmacro-prefix-map=../src/= 
-mcpu=cortex-m3 -mthumb -fstack-usage -MMD -MP 
-MFsrc/cr_cpp_config.d 
-MTsrc/cr_cpp_config.o 
-MTsrc/cr_cpp_config.d 
-o src/cr_cpp_config.o 
../src/cr_cpp_config.cpp

step2


// cr_startup_lpc175x_6x.cpp => cr_startup_lpc175x_6x.oarm-none-eabi-c++ 
-DDEBUG -D__CODE_RED -D__NEWLIB__ -DCORE_M3 -DCPP_NO_HEAP -D__LPC17XX__ -O0 
-fno-common -g3 -gdwarf-4 -Wall -c -fmessage-length=0 -fno-builtin -ffunction-sections 
-fdata-sections -fno-rtti -fno-exceptions -fmerge-constants -fmacro-prefix-map=../src/= 
-mcpu=cortex-m3 -mthumb -fstack-usage -MMD -MP 
-MFsrc/cr_startup_lpc175x_6x.d 
-MTsrc/cr_startup_lpc175x_6x.o 
-MTsrc/cr_startup_lpc175x_6x.d 
-o src/cr_startup_lpc175x_6x.o 
../src/cr_startup_lpc175x_6x.cpp

step3

// crp.c => crp.oarm-none-eabi-gcc 
-std=gnu11 -DDEBUG -D__CODE_RED -D__NEWLIB__ -DCORE_M3 -DCPP_NO_HEAP -D__LPC17XX__ -O0 
-fno-common -g3 -gdwarf-4 -Wall -c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections -fmerge-constants -fmacro-prefix-map=../src/= 
-mcpu=cortex-m3 -mthumb -fstack-usage -MMD -MP 
-MFsrc/crp.d 
-MTsrc/crp.o 
-MTsrc/crp.d 
-o src/crp.o 
../src/crp.c

step4

test3.cpp => test3.oarm-none-eabi-c++ 
-DDEBUG -D__CODE_RED -D__NEWLIB__ -DCORE_M3 -DCPP_NO_HEAP -D__LPC17XX__ -O0 
-fno-common -g3 -gdwarf-4 -Wall -c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fmerge-constants -fmacro-prefix-map=../src/= 
-mcpu=cortex-m3 -mthumb -fstack-usage -MMD -MP 
-MFsrc/test3.d 
-MTsrc/test3.o 
-MTsrc/test3.d 
-o src/test3.o 
../src/test3.cpp

step5

// link (.o) as test3.axf
// this o's set : test3_Debug.ld + cr_cpp_config.o + r_startup_lpc175x_6x.o + test3.oarm-none-eabi-c++ 
-nostdlib -Xlinker -Map=test3.map -Xlinker --cref -Xlinker --gc-sections -Xlinker -print-memory-usage -mcpu=cortex-m3 -mthumb 
-T test3_Debug.ld 
-o test3.axf 
./src/cr_cpp_config.o 
./src/cr_startup_lpc175x_6x.o 
./src/crp.o ./src/test3.o

step6

显示编译出的elf(axf)的信息给程序员看

arm-none-eabi-size test3.axf

备注

可以看出,MCUXpresso的控制台窗口显示出来的编译命令,完全是日志重定向出来的,并不清晰。
自己用调试工具抓出来的arm-gcc命令都是单独的,比日志显示出的命令清晰的多。

从编译命令的参数能看出,由MCUXpresso编译出来的固件工程,明显加了一些配合NXP家的LinkServer调试用的一些参数(e.g. -Xlinker, -D__CODE_RED), 这些NXP家特有的编译参数,在开源的arm-gcc makefile工程的参数中,并没有加。

备注

下一步,就可以根据这6条整理好的编译命令,做一个makefile出来。
做2个实验:

  1. 用MCUXpresso环境的arm-gcc工具链编译一下,试试用MCUXpresso导入makefile工程,编译完,是否可以在板载的调试器单步调试?(预期是可以的单步调试的,可以比较用bindiff比较一下,只要编译出的函数的汇编实现是100%相同的,hash不同不要紧)。
  2. 用ARM官方的arm-gcc工具链编译一下,试试用MCUXpresso导入makefile工程,编译完,是否可以在板载的调试器单步调试?

如果用ARM官方的arm-gcc工具链编译出来的elf, 在MCUXpresso导入makefile工程后,不能通过硬件调试器单步调试。那么就可以放弃将开源工程迁移到MCUXpresso的念头(说明NXP家的arm-gcc和ARM官方的arm-gcc工具链不兼容,那就不叫arm-gcc工具链了,而是NXP家的私有工具链,即使exe的名字和arm-gcc工具链中的exe名字相同,那也不是arm-gcc工具链了).

END

http://www.dtcms.com/a/495634.html

相关文章:

  • 基于MATLAB的多棵树分类器(随机森林)
  • 瑞芯微RK3588平台FFmpeg硬件编解码移植及性能测试实战攻略
  • 外贸做企业什么网站wordpress在线计算程序
  • 开发个网站开票名称是什么网站的策划分析
  • swift不同的语言环境使用不同的AppName,CFBundleDisplayName
  • php建站程序合肥网站建设讯息
  • 创建网站需要准备哪些资料广汉网站建设ghxhwl
  • SD comfy:教程1
  • 第三十六篇|东方国际学院的教育数据建模实践:首都圈日本语学校的费用结构、生源分布与治理参数分析
  • 保障数据采集稳定性:设计针对淘宝 API 的熔断、降级与重试机制
  • 物流公司网站方案wordpress 文章链接
  • 题解:P14063 [PO Final 2022] 海滩 / Badstrand
  • 虎扑的网站是用什么技术做的短视频推广
  • 潍坊 网站六安网站排名优化电话
  • 编程猫官方网站济南 网站推广
  • macOS 常用快捷键
  • @JsonProperty 注解详解
  • 【系统分析师】高分论文:原型法及其在信息系统开发中的应用
  • 民治做网站的公司网店代运营哪里好
  • 网站视频背景怎么做网站开发人员职能
  • 【Next】配置环境变量
  • 机器学习十大经典算法解析与对比
  • 铜仁搜狗推广企业seo推广的绝密诀窍曝光
  • 两部门明确:治理价格无序竞争,报价竞标不得低于成本
  • 进行材料水蒸气吸附稳定性测试的比表面及孔径分析仪推荐
  • 西安网站制作西安搜推宝网络seo专员的工作内容
  • 蓝潮网站建设成都市制作企业网站
  • 博客安全攻防演练:从实战视角构建全方位防护体系
  • 应⽤层⾃定义协议与序列化
  • MySQL 逗号分隔的字符串查询的集中方式