ARM:arm-none-eabi-gcc无法识别汇编程序

时间:2015-10-23 08:28:44

标签: assembly arm stm32 cortex-m3

通过Makefile编译项目会产生一整套错误。

D:\projects\UVS-JK(132x64)>mingw32-make
arm-none-eabi-gcc -mcpu=cortex-m4 -std=c99 -mthumb -mlittle-endian -mfpu=fpv4-sp
-d16 -mfloat-abi=hard -mthumb-interwork    -Os  -DUSE_STDPERIPH_DRIVER -DSTM32F1
0X -DMANGUSTA_DISCOVERY -DUSE_USB_OTG_FS -DHSE_VALUE=8000000 -I./inc -I./.\libra
ries\CMSIS\CM3\CoreSupport -I./ -I./inc/   -Wl,-T,stm32_flash.ld src/main.c uc16
01s/uc1601s.c startup/startup_stm32f10x_cl.s -o demo.elf

startup/startup_stm32f10x_cl.s: Assembler messages:
startup/startup_stm32f10x_cl.s:1: Error: junk at end of line, first unrecognized
 character is `*'
startup/startup_stm32f10x_cl.s:2: Error: junk at end of line, first unrecognized
 character is `*'
startup/startup_stm32f10x_cl.s:3: Error: junk at end of line, first unrecognized
 character is `*'
startup/startup_stm32f10x_cl.s:4: Error: junk at end of line, first unrecognized
 character is `*'
startup/startup_stm32f10x_cl.s:5: Error: junk at end of line, first unrecognized
 character is `*'
startup/startup_stm32f10x_cl.s:6: Error: junk at end of line, first unrecognized
 character is `*'
startup/startup_stm32f10x_cl.s:7: Error: junk at end of line, first unrecognized
 character is `*'
startup/startup_stm32f10x_cl.s:8: Error: junk at end of line, first unrecognized
 character is `*'
startup/startup_stm32f10x_cl.s:9: Error: junk at end of line, first unrecognized
 character is `*'
startup/startup_stm32f10x_cl.s:10: Error: junk at end of line, first unrecognize
d character is `*'
startup/startup_stm32f10x_cl.s:11: Error: junk at end of line, first unrecognize
d character is `*'
startup/startup_stm32f10x_cl.s:12: Error: junk at end of line, first unrecognize
d character is `*'
startup/startup_stm32f10x_cl.s:13: Error: junk at end of line, first unrecognize
d character is `*'
startup/startup_stm32f10x_cl.s:14: Error: junk at end of line, first unrecognize
d character is `*'
startup/startup_stm32f10x_cl.s:15: Error: junk at end of line, first unrecognize
d character is `*'
startup/startup_stm32f10x_cl.s:16: Error: junk at end of line, first unrecognize
d character is `*'
startup/startup_stm32f10x_cl.s:17: Error: junk at end of line, first unrecognize
d character is `*'
startup/startup_stm32f10x_cl.s:18: Error: junk at end of line, first unrecognize
d character is `*'
startup/startup_stm32f10x_cl.s:19: Error: junk at end of line, first unrecognize
d character is `*'
startup/startup_stm32f10x_cl.s:20: Error: junk at end of line, first unrecognize
d character is `*'
startup/startup_stm32f10x_cl.s:21: Error: junk at end of line, first unrecognize
d character is `*'
startup/startup_stm32f10x_cl.s:22: Error: junk at end of line, first unrecognize
d character is `*'
startup/startup_stm32f10x_cl.s:23: Error: junk at end of line, first unrecognize
d character is `*'
startup/startup_stm32f10x_cl.s:26: Error: bad instruction `the modules in this f
ile are included in the libraries,and may be replaced'
startup/startup_stm32f10x_cl.s:27: Error: bad instruction `by any user-defined m
odules that define the PUBLIC symbol _program_start or'
startup/startup_stm32f10x_cl.s:28: Error: bad instruction `a user defined start
symbol.'
startup/startup_stm32f10x_cl.s:29: Error: bad instruction `to override the cstar
tup defined in the library,simply add your modified'
startup/startup_stm32f10x_cl.s:30: Error: bad instruction `version to the workbe
nch project.'
startup/startup_stm32f10x_cl.s:32: Error: bad instruction `the vector table is n
ormally located at address 0.'
startup/startup_stm32f10x_cl.s:33: Error: bad instruction `when debugging in RAM
,it can be located in RAM,aligned to at least 2^6.'
startup/startup_stm32f10x_cl.s:34: Error: bad instruction `the name "__vector_ta
ble"has special meaning for C-SPY:'
startup/startup_stm32f10x_cl.s:35: Error: condition required -- `it is where the
 SP start value is found,and the NVIC vector'
startup/startup_stm32f10x_cl.s:36: Error: bad instruction `table register(VTOR)i
s initialized to this address if!=0.'
startup/startup_stm32f10x_cl.s:38: Error: bad instruction `cortex-M version'
startup/startup_stm32f10x_cl.s:41: Error: bad instruction `module ?cstartup'
startup/startup_stm32f10x_cl.s:43: Error: bad instruction `forward declaration o
f sections.'
startup/startup_stm32f10x_cl.s:44: Error: bad instruction `section CSTACK:DATA:N
OROOT(3)'
startup/startup_stm32f10x_cl.s:46: Error: bad instruction `section .intvec:CODE:
NOROOT(2)'
startup/startup_stm32f10x_cl.s:48: Error: bad instruction `extern __iar_program_
start'
startup/startup_stm32f10x_cl.s:49: Error: bad instruction `extern SystemInit'
startup/startup_stm32f10x_cl.s:50: Error: bad instruction `public __vector_table
'
startup/startup_stm32f10x_cl.s:52: Error: bad instruction `data'
startup/startup_stm32f10x_cl.s:53: Error: bad instruction `__vector_table'
startup/startup_stm32f10x_cl.s:54: Error: bad instruction `dcd sfe(CSTACK)'
startup/startup_stm32f10x_cl.s:55: Error: bad instruction `dcd Reset_Handler'
startup/startup_stm32f10x_cl.s:55: Error: bad instruction `reset Handler'
startup/startup_stm32f10x_cl.s:56: Error: bad instruction `dcd NMI_Handler'
startup/startup_stm32f10x_cl.s:56: Error: bad instruction `nmi Handler'
startup/startup_stm32f10x_cl.s:57: Error: bad instruction `dcd HardFault_Handler
'
startup/startup_stm32f10x_cl.s:57: Error: bad instruction `hard Fault Handler'
startup/startup_stm32f10x_cl.s:58: Error: bad instruction `dcd MemManage_Handler
'
startup/startup_stm32f10x_cl.s:58: Error: bad instruction `mpu Fault Handler'
startup/startup_stm32f10x_cl.s:59: Error: bad instruction `dcd BusFault_Handler'

startup/startup_stm32f10x_cl.s:59: Error: bad instruction `bus Fault Handler'
startup/startup_stm32f10x_cl.s:60: Error: bad instruction `dcd UsageFault_Handle
r'
startup/startup_stm32f10x_cl.s:60: Error: bad instruction `usage Fault Handler'
startup/startup_stm32f10x_cl.s:61: Error: bad instruction `dcd 0'
startup/startup_stm32f10x_cl.s:61: Error: bad instruction `reserved'
startup/startup_stm32f10x_cl.s:62: Error: bad instruction `dcd 0'
startup/startup_stm32f10x_cl.s:62: Error: bad instruction `reserved'
startup/startup_stm32f10x_cl.s:63: Error: bad instruction `dcd 0'
startup/startup_stm32f10x_cl.s:63: Error: bad instruction `reserved'
startup/startup_stm32f10x_cl.s:64: Error: bad instruction `dcd 0'
startup/startup_stm32f10x_cl.s:64: Error: bad instruction `reserved'
startup/startup_stm32f10x_cl.s:65: Error: bad instruction `dcd SVC_Handler'
startup/startup_stm32f10x_cl.s:65: Error: bad instruction `svcall Handler'
startup/startup_stm32f10x_cl.s:66: Error: bad instruction `dcd DebugMon_Handler'

startup/startup_stm32f10x_cl.s:66: Error: bad instruction `debug Monitor Handler
'
startup/startup_stm32f10x_cl.s:67: Error: bad instructiMakefile:53: recipe for t
arget 'demo.elf' failed
mingw32-make: *** [demo.elf] Error 3 

我看到其他线程遇到这种问题,但错误就是单行。在这里我们可以看到总误差。我错过了什么吗?

2 个答案:

答案 0 :(得分:1)

看起来您正在尝试使用与eabi-gcc工具链一起用于其他编译器(在本例中为IAR)的启动文件。显然,正如您可能已经发现的那样,它不起作用。您可以使用很少的选项来完成这项工作,其中包括了解启动文件的工作原理以及如何编写启动文件,gcc工具链可以正确理解它以查找已用于gcc工具链的启动文件。

也许,为了让事情顺利进行,我认为你应该从最简单的选项开始,在其中找到一个与gcc工具链一起使用的启动文件。

为此,我建议从here下载/安装Atollic True Studio,并使用其中一个启动文件作为目标。但是,Atollic是基于gnu的工具链,并且可以为您自己的目的提取启动文件。这些启动文件可以与任何基于gcc的工具链一起使用,在您的情况下是eabi。对于某些库,ST也提供这些启动文件,因此不要使用iar,而是使用其中一个基于gcc的文件。

答案 1 :(得分:-1)

STM32 Std Periphiral Library包具有不同版本的startup_stm32f10x_cl.s文件。