startup_stm32f10x_hd.S:1: Error: junk at end of line, first unrecognized character is `*‘

stm32的makefile编译时发生错误:

startup_stm32f10x_hd.S: Assembler messages:
startup_stm32f10x_hd.S:1: Error: junk at end of line, first unrecognized character is `*'
startup_stm32f10x_hd.S:2: Error: junk at end of line, first unrecognized character is `*'
startup_stm32f10x_hd.S:3: Error: junk at end of line, first unrecognized character is `*'
startup_stm32f10x_hd.S:4: Error: junk at end of line, first unrecognized character is `*'
startup_stm32f10x_hd.S:5: Error: junk at end of line, first unrecognized character is `*'
startup_stm32f10x_hd.S:6: Error: junk at end of line, first unrecognized character is `*'
startup_stm32f10x_hd.S:7: Error: junk at end of line, first unrecognized character is `*'
startup_stm32f10x_hd.S:8: Error: junk at end of line, first unrecognized character is `*'
startup_stm32f10x_hd.S:9: Error: junk at end of line, first unrecognized character is `*'
startup_stm32f10x_hd.S:10: Error: junk at end of line, first unrecognized character is `*'
startup_stm32f10x_hd.S:11: Error: junk at end of line, first unrecognized character is `*'
startup_stm32f10x_hd.S:12: Error: junk at end of line, first unrecognized character is `*'
startup_stm32f10x_hd.S:13: Error: junk at end of line, first unrecognized character is `*'
startup_stm32f10x_hd.S:14: Error: junk at end of line, first unrecognized character is `*'
startup_stm32f10x_hd.S:15: Error: junk at end of line, first unrecognized character is `*'
startup_stm32f10x_hd.S:16: Error: junk at end of line, first unrecognized character is `*'
startup_stm32f10x_hd.S:17: Error: junk at end of line, first unrecognized character is `*'
startup_stm32f10x_hd.S:18: Error: junk at end of line, first unrecognized character is `*'
startup_stm32f10x_hd.S:19: Error: junk at end of line, first unrecognized character is `*'
startup_stm32f10x_hd.S:20: Error: junk at end of line, first unrecognized character is `*'
startup_stm32f10x_hd.S:21: Error: bad instruction `the PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS'
startup_stm32f10x_hd.S:22: Error: bad instruction `with CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.'
startup_stm32f10x_hd.S:23: Error: bad instruction `as A RESULT,STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,'
startup_stm32f10x_hd.S:24: Error: bad instruction `indirect OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE'
startup_stm32f10x_hd.S:25: Error: bad instruction `content OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING'
startup_stm32f10x_hd.S:26: Error: bad instruction `information CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.'
startup_stm32f10x_hd.S:27: Error: junk at end of line, first unrecognized character is `*'
startup_stm32f10x_hd.S:29: Error: bad instruction `amount of memory(in bytes)allocated for Stack'
startup_stm32f10x_hd.S:30: Error: bad instruction `tailor this value to your application needs'

原因是所用startup_stm32f10x_hd.S是专门用与keil上的,不能用于gcc,需要另外寻找适用于gcc版本的启动文件,我是在stm32cubeide项目中找的启动文件,但还有问题:

/home/ztd/Desktop/share/test/linux/tools/gcc-arm-none-eabi-10.3-2021.10-x86_64-linux/gcc-arm-none-eabi-10.3-2021.10/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld: cannot open linker script file stm32_flash.ld: No such file or directory

缺少stm32_flash.ld文件:将stm32cubeide项目中的STM32F103ZETX_FLASH.ld文件复制到自己的项目下并改名为stm32_flash.ld

还有问题:

/home/ztd/Desktop/share/test/stm32/test/startup_stm32f103zetx.s:98: undefined reference to `SystemInit'
collect2: error: ld returned 1 exit status

.s文件中找不到SystemInit:项目中缺少system_stm32f10x.c,system_stm32f10x.h,加入就好了

  • 2
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

爪爪鸡啦

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值