用Eclipse在Windows中编译ARM

用Eclipse在Windows中编译ARM,c,gcc,arm,C,Gcc,Arm,我想为cortex-M0处理器编写C程序。我使用64位window machine和Eclipse。我在网上发现了很多东西,我很困惑: 1.MinGW 2.ARM GCC windows编译器(可在计算机高级系统中设置,路径变量) 3.来自Eclipse市场的ARM GNU编译器 其中,哪种编译器可以用于ARM,我可以在命令行上输出我的结果。i、 我可以在控制台上编译程序并生成结果吗 当我尝试使用命令arm none eabi gcc-o-tesres-test.c编译hello程序时,得到的结

我想为cortex-M0处理器编写C程序。我使用64位window machine和Eclipse。我在网上发现了很多东西,我很困惑: 1.MinGW 2.ARM GCC windows编译器(可在计算机高级系统中设置,路径变量) 3.来自Eclipse市场的ARM GNU编译器

其中,哪种编译器可以用于ARM,我可以在命令行上输出我的结果。i、 我可以在控制台上编译程序并生成结果吗

当我尝试使用命令arm none eabi gcc-o-tesres-test.c编译hello程序时,得到的结果如下

c:/program files (x86)/gnu tools arm embedded/6 2017-q1-update/bin/../lib/gcc/ar
m-none-eabi/6.3.1/../../../../arm-none-eabi/lib\libc.a(lib_a-exit.o): In functio
n `exit':
exit.c:(.text.exit+0x2c): undefined reference to `_exit'
c:/program files (x86)/gnu tools arm embedded/6 2017-q1-update/bin/../lib/gcc/ar
m-none-eabi/6.3.1/../../../../arm-none-eabi/lib\libc.a(lib_a-sbrkr.o): In functi
on `_sbrk_r':
sbrkr.c:(.text._sbrk_r+0x18): undefined reference to `_sbrk'
c:/program files (x86)/gnu tools arm embedded/6 2017-q1-update/bin/../lib/gcc/ar
m-none-eabi/6.3.1/../../../../arm-none-eabi/lib\libc.a(lib_a-writer.o): In funct
ion `_write_r':
writer.c:(.text._write_r+0x24): undefined reference to `_write'
c:/program files (x86)/gnu tools arm embedded/6 2017-q1-update/bin/../lib/gcc/ar
m-none-eabi/6.3.1/../../../../arm-none-eabi/lib\libc.a(lib_a-closer.o): In funct
ion `_close_r':
closer.c:(.text._close_r+0x18): undefined reference to `_close'
c:/program files (x86)/gnu tools arm embedded/6 2017-q1-update/bin/../lib/gcc/ar
m-none-eabi/6.3.1/../../../../arm-none-eabi/lib\libc.a(lib_a-fstatr.o): In funct
ion `_fstat_r':
fstatr.c:(.text._fstat_r+0x20): undefined reference to `_fstat'
c:/program files (x86)/gnu tools arm embedded/6 2017-q1-update/bin/../lib/gcc/ar
m-none-eabi/6.3.1/../../../../arm-none-eabi/lib\libc.a(lib_a-isattyr.o): In func
tion `_isatty_r':
isattyr.c:(.text._isatty_r+0x18): undefined reference to `_isatty'
c:/program files (x86)/gnu tools arm embedded/6 2017-q1-update/bin/../lib/gcc/ar
m-none-eabi/6.3.1/../../../../arm-none-eabi/lib\libc.a(lib_a-lseekr.o): In funct
ion `_lseek_r':
lseekr.c:(.text._lseek_r+0x24): undefined reference to `_lseek'
c:/program files (x86)/gnu tools arm embedded/6 2017-q1-update/bin/../lib/gcc/ar
m-none-eabi/6.3.1/../../../../arm-none-eabi/lib\libc.a(lib_a-readr.o): In functi
on `_read_r':
readr.c:(.text._read_r+0x24): undefined reference to `_read'
collect2.exe: error: ld returned 1 exit status

在Windows for M0下,我一直在使用IAR Embedded Workbench,这对我来说是一次愉快而流畅的体验。但据我记忆所及,它需要许可证。


也许您应该在这个列表中寻找免费选项。

您可以使用来自Eclipse marketplace的ARM GNU编译器。安装后,您可以使用正确的项目类型创建新的C/C++项目- e、 g.
Executable/stm32f0xc/C++项目
,如果这是您希望瞄准的芯片系列。确保向导中的跟踪输出未设置为
None(无跟踪输出)
。然后,您可以使用
trace\u printf
通过ST-LINK写入主机控制台,如hello world示例所示

您可能还必须安装和配置OpenOCD以捕获该输出并将其显示在Eclipse的控制台中。在Eclipse中,您只需设置一个外部工具
Run>externaltools>externaltools配置
。指定openocd.exe的位置,设置工作目录,并在参数中通过使用适当的配置文件指定正在使用的devkit,例如
-f board\stm32f072discovery.cfg


然后构建、运行OpenOCD并调试。

您正在编译哪个CM0设备?ARM-GCC可以很好地工作。实际上,我的疑问是,我必须使用哪种组合。我还没有在处理器上编译,我只是在尝试设置环境。我希望在控制台上输出我的结果。你们说的是什么组合?我的意思是,我通常设置eclipse,我从市场上下载了eclipse ARM编译器。我想,这对于编译程序和flash来说已经足够了。我想要控制台上的输出,这可能吗?在PC上编译CMSIS或ARM ABI之类的东西没有任何意义。你必须跳过这些文件。总的来说,您将无法编译一个完整的ARM项目。你必须远离所有低级的东西。与问题无关。@tilz0R主题帖子中有很多问题,其中一个是“哪个编译器可以用于ARM”,我提供了一个选项列表,推荐了我有经验的选项。你能不能再详细解释一下我的帖子中哪些内容是不相关的?