如何在使用“ makefile”中使用“ armclang”时捕获印刷的屏幕日志并输出到日志文件中? 我正在尝试将印刷的屏幕日志捕获到Makefile中的Armclang时。 makefile: 全部:startup_armclang startup_armasm main_armclang startup_armclang: armclang -targe ...

问题描述 投票:0回答:1

all: startup_armclang startup_armasm main_armclang startup_armclang: armclang --target=arm-arm-none-eabi -march=armv7-r -DBL1 _DRAM_JUMP -E -x assembler-with-cpp ./startup.s > temp.s startup_armasm: armasm --diag_style=gnu --brief_diagnostics -g --debug --keep --cpu=Cortex-R5 -I. -I./System -o startup.o temp.s rm -f temp.s main_armclang: armclang -c --target=arm-arm-none-eabi -marm -march=armv7-r -mcpu=cortex-r5 -g1 --debug -O0 -fno-function-sections -fno-data-sections -mfloat-abi=soft -mfpu=none -I. -I./System Main.c -o Main.o -MMD -MF Main.d

我尝试了:

$>使全部>log
make:警告:File

Makefile

将来有修改时间4.1e+02 s Armclang:警告:避免指定体系结构(-March)和处理器(-MCPU),因为指定两者都有可能引起冲突。编译器从处理器中渗透正确的体系结构。 [ - wunused-command-line-argument] Main.C:605:56:警告:表达结果未使用[-wunused-value] ptbootinfo-> timage.mctrmode, ~~~~~~~~~~~~~~~~~~~~~~~^~~~ Main.C:606:56:警告:表达结果未使用[-wunused-value] ptbootinfo-> timage.minstbuff, ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~ Main.C:607:84:警告:表达结果未使用[-wunused-value] ptbootinfo-> timage.mflashaddr [coreType] [imgtype], ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Main.C:608:37:警告:表达结果未使用[-wunused-value] (uint8 *)(ptbootinfo-> theader [coreType] [imgtype]), ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Main.C:609:55:错误:无关的')'';'' bl_img_header_size); ^ Main.C:609:37:警告:表达结果未使用[-wunused-value]
  1. ,但仅记录为以下日志:

    armclang --target=arm-arm-none-eabi -march=armv7-r -DBL1 _DRAM_JUMP -E -x assembler-with-cpp ./startup.s > ./temp.s
    armasm --diag_style=gnu --brief_diagnostics -g --debug -keep --cpu=Cortex-R5 -I . -I./System -o ./startup.o temp.s
    rm -f temp.s
    armclang -c --target=arm-arm-none-eabi -marm -march=armv7-r -mcpu=cortex-r5 -g1 --debug -O0 --fno-function-sections --fno-data-sections -mfloat-abi=soft -mfpu=none -I . -I./System Main.c -o Main.o -MMD -MF Main.d
    

  2. $>使所有2>&1 |发球日志 但是,这将错误消息作为“模棱两可的输出重定向”。

对于类似的问题,您应该指定外壳
正在使用并用该外壳的名称标记问题。
认为您正在使用
    csh
  1. tcsh
壳,如果您是后者 可能运行freebsd.
makefile armclang
1个回答
0
投票
我必须交付一个小型C项目,用GNU Makefile建造,我有 将

#error Whoops

引入源文件之一。我的默认外壳 是:

$ echo $SHELL
/bin/bash
我破坏的项目(未能构建)如下:

$ make cc -c -o bar_init.o bar_init.c cc -c -o default_opt_init.o default_opt_init.c cc -c -o foo_init.o foo_init.c cc -c -o init.o init.c cc -c -o main.o main.c main.c:3:2: error: #error Whoops 3 | #error Whoops | ^~~~~ make: *** [<builtin>: main.o] Error 1

我可以在仍将其发送到控制台的同时记录标准输出和标准 以您尝试的方式:

$ make 2>&1 | tee log
cc    -c -o bar_init.o bar_init.c
cc    -c -o default_opt_init.o default_opt_init.c
cc    -c -o foo_init.o foo_init.c
cc    -c -o init.o init.c
cc    -c -o main.o main.c
main.c:3:2: error: #error Whoops
    3 | #error Whoops
      |  ^~~~~
make: *** [<builtin>: main.o] Error 1

$ cat log
cc    -c -o bar_init.o bar_init.c
cc    -c -o default_opt_init.o default_opt_init.c
cc    -c -o foo_init.o foo_init.c
cc    -c -o init.o init.c
cc    -c -o main.o main.c
main.c:3:2: error: #error Whoops
    3 | #error Whoops
      |  ^~~~~
make: *** [<builtin>: main.o] Error 1

因此在
bash

中起作用。我也有

tcsh
壳:

$ tcsh > make clean rm -f prog *.o > make 2>&1 | tee log Ambiguous output redirect. > make 2 > & 1 |

当您看到的时,shell重定向语法在
tcsh

bash
中并不相同。 (并且错误
Ambiguous output redirect
从未通过

bash
发出)。

[t]csh

重定向设施不如
bash
方便。到
实现您需要做的事情:
[t]csh
	

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.