尝试在 Windows 7 中构建nanomsg 项目时出现错误:
cmake ..
-- Building for: NMake Makefiles
-- The C compiler identification is GNU 4.7.1
-- Check for working C compiler: C:/Program Files (x86)/CodeBlocks/MinGW/bin/gcc.exe
CMake Error: Generator: execution of make failed. Make command was: "nmake" "/NOLOGO" "cmTC_5d837\fast"
-- Check for working C compiler: C:/Program Files (x86)/CodeBlocks/MinGW/bin/gcc.exe -- broken
CMake Error at C:/Program Files (x86)/cmake-3.9.4-win64-x64/share/cmake-3.9/Modules/CMakeTestCCompiler.cmake:51 (message):
The C compiler "C:/Program Files (x86)/CodeBlocks/MinGW/bin/gcc.exe" is not
able to compile a simple test program.
It fails with …
Run Code Online (Sandbox Code Playgroud) 我有 STM32F404 板,我正在尝试刷新它。我正在关注本教程。
在项目Makefile 中
$(PROJ_NAME).elf: $(SRCS)
$(CC) $(CFLAGS) $^ -o $@
$(OBJCOPY) -O ihex $(PROJ_NAME).elf $(PROJ_NAME).hex
$(OBJCOPY) -O binary $(PROJ_NAME).elf $(PROJ_NAME).bin
burn: proj
$(STLINK)/st-flash write $(PROJ_NAME).bin 0x8000000
Run Code Online (Sandbox Code Playgroud)
bin 文件是使用生成的OBJCOPY
,然后使用 Make 目标进行刷写burn
我的问题:
问题 1:OBJCOPY=arm-none-eabi-objcopy
在这种情况下有什么作用。我打开了那个人,但我并没有完全理解,谁能简单解释一下?
问题 2:闪烁 bin 文件给出了预期的结果(LED 闪烁)但是闪烁 elf 文件时 LED 没有闪烁,$(STLINK)/st-flash write $(PROJ_NAME).elf 0x8000000
为什么?
我正在尝试了解 zImage 和 uImage 之间的区别。
在我的理解中,它uImage
是通过运行mkimage
获得的Image
,因此它添加了一个 U-Boot 包装器(我不知道它究竟包含什么),其中包含一个标头以及加载地址和入口点,可能还有我的“额外信息”不知道。
另一方面,它zImage
是压缩的Image
,它不包含加载地址和入口点(我认为,如果我错了,请纠正我),但 U-Boot 也可以使用bootz
.
在这种情况下,为什么使用 auImage
而不是 a zImage
?
我很想知道 zImage 和 uImage 的格式是什么,你能推荐一些参考吗?
我正在使用 IAR Workbench,但很难刷新我得到的 STM32F407VG:
致命错误 ST-Link 未找到 MCU 设备。
当我转到项目选项 Debugger > ST-Link > Reset > connect during reset 并尝试再次下载时,我得到:
addr = 0x00000016
下载进度条保持阻塞后,警告堆栈指针设置为不正确的对齐堆栈。
通过在选项菜单中导航,我发现可以调整 CPU 频率,实际上它是 72 MHz,默认是 72 MHz,我将其更改为 168 MHz,即 CPU 频率,但问题仍然存在。
您能否建议我一些解决方案来调试/解决问题。
编辑
我已经使用 STM32 ST-Link Utility 并且我成功连接到板子,但是我的 IDE 的问题还没有解决。
从target / linux / ar71xx / image / Makefile
KERNEL := kernel-bin | patch-cmdline | lzma | uImage lzma
Run Code Online (Sandbox Code Playgroud)
您能否帮助我理解这一行的含义,并提供有关如何|
在Makefile中使用符号管道的示例
我想取消定义并重新定义 __cplusplus 宏,但是编译错误:__cplusplus was not declared in this scope
#define TEMP_VERSION __cplusplus // temporary macro to hold the __cplusplus containt
#undef __cplusplus
#define __cplusplus TEMP_VERSION // redefine __cplusplus
#define AA 111
#undef AA
#define AA 111
int main()
{
cout << "__cplusplus = "<<__cplusplus<<endl; // It doesn't work
cout << "AA = "<<AA<<endl; // It works
return 0;
}
Run Code Online (Sandbox Code Playgroud)
__cplusplus
与AA
我知道这真的很难看,但是我取消定义宏的原因是我正在使用第三方软件,他们误用了#ifdef __cplusplus
,我的意思是 的内容#ifdef __cplusplus ... #endif
是错误的。因此,我没有更改他们的软件,而是选择执行以下操作
#define TEMP_VERSION __cplusplus
#undef __cplusplus …
Run Code Online (Sandbox Code Playgroud) 我实际上是在一个大项目中.我理解代码的第一步是搜索main
函数,以便我对架构有一个愿景.
我发现的是有不止一个主要功能.确实,它们位于不同的文件夹中,但我不明白这个应用程序是如何成功构建的.我所知道的是链接器需要一个main
函数(入口点).
我相信很难理解应用程序的构建过程,所以我问,因为你们当中有些人遇到过这个问题.
1 - 我是否应该有理论背景来理解这一点?如果是这样,请建议我的文章,书籍,你想要什么.
2 - 我们什么时候必须main
在一个应用程序中使用多个功能?
我想知道如果 Makefile 中有 2 个具有相同名称的目标会发生什么:
根据This question,有 2 个具有相同名称的目标会引发警告。
但是,我不明白 openwrt 中的这个 Makefile 是如何工作的:
在include/package.mk
:
define Build/DefaultTargets
$(if $(QUILT),$(Build/Quilt))
$(if $(USE_SOURCE_DIR)$(USE_GIT_TREE),,$(if $(strip $(PKG_SOURCE_URL)),$(call Download,default)))
$(call Build/Autoclean)
download:
$(foreach hook,$(Hooks/Download),
$(call $(hook))$(sep)
)
Run Code Online (Sandbox Code Playgroud)
注意这里Download
第 3 行中的函数调用和download
第 6 行中目标的定义。
由于具有看看函数的定义Download
中include/download.mk
:
define Download
$(eval $(Download/Defaults))
$(eval $(Download/$(1)))
$(foreach FIELD,URL FILE $(Validate/$(call dl_method,$(URL),$(PROTO))),
ifeq ($($(FIELD)),)
$$(error Download/$(1) is missing the $(FIELD) field.)
endif
)
$(foreach dep,$(DOWNLOAD_RDEP),
$(dep): $(DL_DIR)/$(FILE)
)
download: $(DL_DIR)/$(FILE)
Run Code Online (Sandbox Code Playgroud)
我看到 …