时空自由民. 2024-07-24 18:14 采纳率: 0%
浏览 43

linux上使用arm-none-eabi-gcc 编译器编译.s汇编文件就提示错误

img

wls@wls-virtual-machine:~/wls/linux_stm32f103_gcc_makefile/led/Start$ arm-none-eabi-gcc -c -o 1.o startup_stm32f10x_md.s
startup_stm32f10x_md.s: Assembler messages:
startup_stm32f10x_md.s:1: Error: junk at end of line, first unrecognized character is *' startup_stm32f10x_md.s:2: Error: junk at end of line, first unrecognized character is '
startup_stm32f10x_md.s:3: Error: junk at end of line, first unrecognized character is *' startup_stm32f10x_md.s:4: Error: junk at end of line, first unrecognized character is
'
startup_stm32f10x_md.s:5: Error: junk at end of line, first unrecognized character is *' startup_stm32f10x_md.s:6: Error: junk at end of line, first unrecognized character is '
startup_stm32f10x_md.s:7: Error: junk at end of line, first unrecognized character is *' startup_stm32f10x_md.s:8: Error: junk at end of line, first unrecognized character is
'
startup_stm32f10x_md.s:9: Error: junk at end of line, first unrecognized character is *' startup_stm32f10x_md.s:10: Error: junk at end of line, first unrecognized character is '
startup_stm32f10x_md.s:11: Error: junk at end of line, first unrecognized character is *' startup_stm32f10x_md.s:12: Error: junk at end of line, first unrecognized character is
'
startup_stm32f10x_md.s:13: Error: junk at end of line, first unrecognized character is *' startup_stm32f10x_md.s:14: Error: junk at end of line, first unrecognized character is '
startup_stm32f10x_md.s:15: Error: junk at end of line, first unrecognized character is *' startup_stm32f10x_md.s:16: Error: junk at end of line, first unrecognized character is
'
startup_stm32f10x_md.s:17: Error: junk at end of line, first unrecognized character is *' startup_stm32f10x_md.s:18: Error: junk at end of line, first unrecognized character is *'
startup_stm32f10x_md.s:19: Error: bad instruction the PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS' startup_stm32f10x_md.s:20: Error: bad instruction with CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.'
startup_stm32f10x_md.s:21: Error: bad instruction as A RESULT,STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,' startup_stm32f10x_md.s:22: Error: bad instruction indirect OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE'
startup_stm32f10x_md.s:23: Error: bad instruction content OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING' startup_stm32f10x_md.s:24: Error: bad instruction information CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.'
startup_stm32f10x_md.s:25: Error: junk at end of line, first unrecognized character is *' startup_stm32f10x_md.s:27: Error: bad instruction amount of memory(in bytes)allocated for Stack'
startup_stm32f10x_md.s:28: Error: bad instruction tailor this value to your application needs' startup_stm32f10x_md.s:29: Error: junk at end of line, first unrecognized character is <'
startup_stm32f10x_md.s:30: Error: junk at end of line, first unrecognized character is <' startup_stm32f10x_md.s:31: Error: junk at end of line, first unrecognized character is <'
startup_stm32f10x_md.s:33: Error: bad instruction stack_size EQU 0x00000400' startup_stm32f10x_md.s:35: Error: bad instruction area STACK,NOINIT,READWRITE,ALIGN=3'
startup_stm32f10x_md.s:36: Error: bad instruction stack_mem SPACE Stack_Size' startup_stm32f10x_md.s:37: Error: bad instruction __initial_sp '
startup_stm32f10x_md.s:40: Error: junk at end of line, first unrecognized character is <' startup_stm32f10x_md.s:41: Error: junk at end of line, first unrecognized character is <'
startup_stm32f10x_md.s:42: Error: junk at end of line, first unrecognized character is <' startup_stm32f10x_md.s:44: Error: bad instruction heap_size EQU 0x00000200'
startup_stm32f10x_md.s:46: Error: bad instruction area HEAP,NOINIT,READWRITE,ALIGN=3' startup_stm32f10x_md.s:47: Error: bad instruction __heap_base '
startup_stm32f10x_md.s:48: Error: bad instruction heap_mem SPACE Heap_Size' startup_stm32f10x_md.s:49: Error: bad instruction __heap_limit '
startup_stm32f10x_md.s:51: Error: bad instruction preserve8 ' startup_stm32f10x_md.s:52: Error: bad instruction thumb '
startup_stm32f10x_md.s:55: Error: bad instruction vector Table Mapped to Address 0 at Reset' startup_stm32f10x_md.s:56: Error: bad instruction area RESET,DATA,READONLY'
startup_stm32f10x_md.s:57: Error: bad instruction export __Vectors' startup_stm32f10x_md.s:58: Error: bad instruction export __Vectors_End'
startup_stm32f10x_md.s:59: Error: bad instruction export __Vectors_Size' startup_stm32f10x_md.s:61: Error: bad instruction __vectors DCD __initial_sp'
startup_stm32f10x_md.s:61: Error: bad instruction top of Stack' startup_stm32f10x_md.s:62: Error: bad instruction dcd Reset_Handler'
startup_stm32f10x_md.s:62: Error: bad instruction `reset Handler'


这个错误反馈看着像是arm-none-eabi-gcc 编译器 看不懂汇编代码的感觉

  • 写回答

4条回答 默认 最新

  • 专家-赤兔[在线] 全栈领域优质创作者 2024-07-24 18:14
    关注

    引自免费微信小程序:皆我百晓生

    这个问题是由于arm-none-eabi-gcc编译器未能正确解析并执行startup_stm32f10x_md.s中的汇编指令导致的。在分析了错误信息后,我们发现错误出现在startup_stm32f10x_md.s文件的第3行和第11行。

    在这些行,startup_stm32f10x_md.s文件包含了一些错误的指令,例如junk at end of line和未定义的指令(如bad instruction)。这表明startup_stm32f10x_md.s文件可能没有正确的语法结构来支持这些指令。

    要解决这个问题,我们需要修改startup_stm32f10x_md.s文件以正确地编译和执行指令。具体来说,我们需要确保所有指令都是有效的,并且它们之间有足够的空白来分隔它们。

    以下是修复后的startup_stm32f10x_md.s文件示例:

    /* This is a sample STM32F10X microcontroller assembly file */
    #define __vectors DCD
    #include "startup_stm32f10x_md.h"
    
    void reset_handler(void) {
        // reset code here
    }
    
    

    在这个修复后的版本中,我们已经添加了一个新的宏__vectors,它将用于存储汇编指令表。我们还添加了一个函数reset_handler,其中包含了正确的初始化代码。此外,我们删除了之前错误的指令。

    接下来,我们将使用arm-none-eabi-gcc编译器重新构建startup_stm32f10x_md.s文件:

    arm-none-eabi-gcc -c -o 1.o startup_stm32f10x_md.s
    

    然后,我们可以再次检查错误信息,看看是否仍然存在。如果不存在,那么我们就成功解决了这个问题。

    评论 编辑记录

报告相同问题?

问题事件

  • 创建了问题 7月24日

悬赏问题

  • ¥15 做个有关计算的小程序
  • ¥15 MPI读取tif文件无法正常给各进程分配路径
  • ¥15 如何用MATLAB实现以下三个公式(有相互嵌套)
  • ¥30 关于#算法#的问题:运用EViews第九版本进行一系列计量经济学的时间数列数据回归分析预测问题 求各位帮我解答一下
  • ¥15 setInterval 页面闪烁,怎么解决
  • ¥15 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题
  • ¥15 如何用Python爬取各高校教师公开的教育和工作经历
  • ¥15 TLE9879QXA40 电机驱动
  • ¥20 对于工程问题的非线性数学模型进行线性化