简体   繁体   English

使用Eclipse在Windows中编译ARM

[英]Compiling ARM in Windows with Eclipse

I would like to make C program for the cortex - M0 processor. 我想为皮质制作C程序-M0处理器。 I work with 64-bit window machine and Eclipse. 我使用64位窗口机器和Eclipse。 I found many things on internet and I am confused: 1.MinGW 2.ARM GCC compiler for windows (which can be set in the advanced system in computer, the PATH variable) 3. ARM GNU compiler from Eclipse market 我在Internet上发现了很多东西,但我感到困惑:1.MinGW 2.用于Windows的ARM GCC编译器(可以在计算机的高级系统中设置PATH变量)3.来自Eclipse市场的ARM GNU编译器

Among all this , Which compiler can be used for ARM and can I output my results on command line. 在这之中,哪一个编译器可以用于ARM,我可以在命令行上输出结果。 ie Can I compile the program and produce results on the console ? 即我可以编译程序并在控制台上产生结果吗?

This result below is what I get when I try to compile a hello program using the command: arm-none-eabi-gcc -o -tesres -test.c 下面的结果是当我尝试使用以下命令编译hello程序时得到的结果:arm-none-eabi-gcc -o -tesres -test.c

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

You can use the ARM GNU compiler from Eclipse marketplace. 您可以从Eclipse市场使用ARM GNU编译器。 When this is installed, you can Create a new C/C++ project with the correct Project type - eg Executable/STM32F0xx C/C++ project if that's the series of chip you wish to target. 安装此程序后,您可以使用正确的项目类型创建一个新的C / C ++项目-例如, Executable/STM32F0xx C/C++ project如果这是您希望定位的芯片系列。 Make sure Trace output in the wizard is NOT set to None (no trace output) . 确保向导中的None (no trace output)设置为None (no trace output) You can then use trace_printf to write to host console via ST-LINK, as the hello-world example will show. 然后,您可以使用trace_printf通过ST-LINK写入主机控制台,如hello-world示例所示。

You may also have to install and configure OpenOCD to capture that output and display it in Eclipse's console. 您可能还必须安装和配置OpenOCD才能捕获该输出并将其显示在Eclipse的控制台中。 In Eclipse, you just set up an external tool Run > External tools > External tools configuration . 在Eclipse中,您只需设置外部工具Run > External tools > External tools configuration Specify the location of openocd.exe, set the working directory and, in Arguments, specify which devkit you're using by using the appropriate config file, eg -f board\\stm32f072discovery.cfg . 指定openocd.exe的位置,设置工作目录,然后在Arguments中使用适当的配置文件(例如-f board\\stm32f072discovery.cfg指定要使用的-f board\\stm32f072discovery.cfg

Then build, run OpenOCD and debug. 然后构建,运行OpenOCD并进行调试。

Under Windows for M0 I've been using IAR Embedded Workbench , which was a nice and smooth experience for me. 在Windows M0下,我一直在使用IAR Embedded Workbench ,这对我来说是一种很好的体验。 But as far as I remember it needed a license. 但据我记得,它需要许可证。 https://en.wikipedia.org/wiki/List_of_ARM_Cortex-M_development_tools https://zh.wikipedia.org/wiki/清单_ARM_Cortex-M_development_tools

Maybe you should look for free options in this list. 也许您应该在此列表中寻找免费选项。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM