ARM: arm-none-eabi-gcc can't recognize assembl

2019-08-09 07:29发布

Compiling the project through Makefile gives full set of errors.

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 

I saw other threads with this kind of problem, but errors there was just in single lines. Here we can see total error. Have i missed something?

2条回答
戒情不戒烟
2楼-- · 2019-08-09 07:55

STM32 Std Periphiral Library package has different versions of startup_stm32f10x_cl.s file.

查看更多
迷人小祖宗
3楼-- · 2019-08-09 08:00

Looks like you are trying to use a startup file that is meant to be used with some other compiler (in this case IAR) with eabi-gcc tool-chain. Obviously, as you may have already found out, it will not work. There are few options for you to make this work, in which includes to learn how the startup file works and how you write a startup file that can be correctly understood by a gcc toolchain to find a startup file that has been already used for gcc toolchain.

Perhaps, to get the things going, I think you should start with the easiest option, in which find a startup file that works with gcc toolchain.

For this, I would recommend to download/install Atollic True Studio from here and use one of their startup files for your target. Atollic is a gnu based toolchain, however, and startup files may be extracted for your own purpose. Those startup files can be used with any gcc based toolchain, in your case eabi. With some libraries, ST also provides these startup files, so do not use the iar one, but use one of those gcc based ones.

查看更多
登录 后发表回答