热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

交叉编译arm-none-eabi-gcc编译汇编文件(startup_stm32f10x_hd.S)遇到的问题

我用的是CodeSourcery的交叉编译工具arm-none-eabi-gcc编译一个汇编文件(官方的Stm32的启动文件)startup_stm32f10x_hd.S,错误信息表明它连汇编中的注释
我用的是CodeSourcery的交叉编译工具arm-none-eabi-gcc编译一个汇编文件(官方的Stm32的启动文件)startup_stm32f10x_hd.S,错误信息表明它连汇编中的注释都不认识,不知道是怎么回事,我是在makefile中编译的.错误信息如下,makefile的相关部分在后面列出,startup_stm32f10x_hd.S也在后面列出,请求各位帮助,谢谢
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
编译信息:
make[1]: Entering directory `/home/abing/Yunio/GROUND/GProj/stm32lib/CMSIS/DeviceSupport'
arm-none-eabi-gcc -c -mthumb -mcpu=cortex-m3 -mthumb-interwork -I. -x assembler-with-cpp  -Wa,-adhlns=startup_stm32f10x_hd.lst,-ggdb  startup_stm32f10x_hd.S -o startup_stm32f10x_hd.o
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:31: Error: junk at end of line, first unrecognized character is `<'
startup_stm32f10x_hd.S:32: Error: junk at end of line, first unrecognized character is `<'
startup_stm32f10x_hd.S:33: Error: junk at end of line, first unrecognized character is `<'
startup_stm32f10x_hd.S:35: Error: bad instruction `stack_size EQU 0x00001000'
startup_stm32f10x_hd.S:37: Error: bad instruction `area STACK,NOINIT,READWRITE,ALIGN=3'
startup_stm32f10x_hd.S:38: Error: bad instruction `stack_mem SPACE Stack_Size'
startup_stm32f10x_hd.S:39: Error: bad instruction `__initial_sp'
startup_stm32f10x_hd.S:41: Error: bad instruction `__initial_sp EQU 0x20000000+Stack_Size'
startup_stm32f10x_hd.S:41: Error: bad instruction `stack used for SystemInit&SystemInit_ExtMemCtl'
startup_stm32f10x_hd.S:43: Error: junk at end of line, first unrecognized character is `<'
startup_stm32f10x_hd.S:44: Error: junk at end of line, first unrecognized character is `<'
startup_stm32f10x_hd.S:45: Error: junk at end of line, first unrecognized character is `<'
startup_stm32f10x_hd.S:47: Error: bad instruction `heap_size EQU 0x00000200'
startup_stm32f10x_hd.S:49: Error: bad instruction `area HEAP,NOINIT,READWRITE,ALIGN=3'
startup_stm32f10x_hd.S:50: Error: bad instruction `__heap_base'
startup_stm32f10x_hd.S:51: Error: bad instruction `heap_mem SPACE Heap_Size'
startup_stm32f10x_hd.S:52: Error: bad instruction `__heap_limit'
startup_stm32f10x_hd.S:54: Error: bad instruction `preserve8'
startup_stm32f10x_hd.S:55: Error: bad instruction `thumb'
startup_stm32f10x_hd.S:57: Error: bad instruction `import OS_CPU_SysTickHandler'
startup_stm32f10x_hd.S:58: Error: bad instruction `import OS_CPU_PendSVHandler'
...(因发贴有字数限制,我删除了一部分信息)
startup_stm32f10x_hd.S:329: Error: bad instruction `dma2_channel4_5_irqhandler'
startup_stm32f10x_hd.S:332: Error: bad instruction `endp'
startup_stm32f10x_hd.S:334: Error: bad instruction `align'
startup_stm32f10x_hd.S:336: Error: junk at end of line, first unrecognized character is `*'
startup_stm32f10x_hd.S:337: Error: bad instruction `user Stack and Heap initialization'
startup_stm32f10x_hd.S:338: Error: junk at end of line, first unrecognized character is `*'
startup_stm32f10x_hd.S:339: Error: bad instruction `__microlib'
startup_stm32f10x_hd.S:341: Error: bad instruction `export __initial_sp'
startup_stm32f10x_hd.S:342: Error: bad instruction `export __heap_base'
startup_stm32f10x_hd.S:343: Error: bad instruction `export __heap_limit'
startup_stm32f10x_hd.S:345: Error: bad instruction `else'
startup_stm32f10x_hd.S:347: Error: bad instruction `import __use_two_region_memory'
startup_stm32f10x_hd.S:348: Error: bad instruction `export __user_initial_stackheap'
startup_stm32f10x_hd.S:350: Error: bad instruction `__user_initial_stackheap'
startup_stm32f10x_hd.S:353: Error: constant expression expected -- `ldr R1,=(Stack_Mem+Stack_Size)'
startup_stm32f10x_hd.S:354: Error: constant expression expected -- `ldr R2,=(Heap_Mem+Heap_Size)'
startup_stm32f10x_hd.S:358: Error: bad instruction `align'
startup_stm32f10x_hd.S:360: Error: bad instruction `endif'
startup_stm32f10x_hd.S:362: Error: bad instruction `end'
startup_stm32f10x_hd.S:364: Error: junk at end of line, first unrecognized character is `*'
make[1]: *** [startup_stm32f10x_hd.o] Error 1
make[1]: Leaving directory `/home/abing/Yunio/GROUND/GProj/stm32lib/CMSIS/DeviceSupport'
make: *** [stm32lib/CMSIS/DeviceSupport] Error 2
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
makefile中相关部分:

CROSS_COMPILE = arm-none-eabi-
CC        = $(CROSS_COMPILE)gcc

DEBUG= gdb

# Assembler flags
ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:.S=.lst),-g$(DEBUG)
ALL_ASFLAGS = -mcpu=cortex-m3 -mthumb-interwork -I. -x assembler-with-cpp $(ASFLAGS)

$(obj)%.o:        %.S
        $(CC) -c -mthumb $(ALL_ASFLAGS)  $< -o $@
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
startup_stm32f10x_hd.S中的一部分内容:

1;******************** (C) COPYRIGHT 2010 STMicroelectronics ********************
2;* File Name          : startup_stm32f10x_hd.s
3;* Author             : MCD Application Team
4;* Version            : V3.4.0
5;* Date               : 10/15/2010
6;* Description        : STM32F10x High Density Devices vector table for MDK-ARM
7;*                      toolchain.
8;*                      This module performs:
9;*                      - Set the initial SP
10;*                      - Set the initial PC == Reset_Handler
11;*                      - Set the vector table entries with the exceptions ISR address
12;*                      - Configure the clock system and also configure the external
13;*                        SRAM mounted on STM3210E-EVAL board to be used as data
14;*                        memory (optional, to be enabled by user)
15;*                      - Branches to __main in the C library (which eventually
16;*                        calls main()).
17;*                      After Reset the CortexM3 processor is in Thread mode,
18;*                      priority is Privileged, and the Stack is set to Main.
19;* <<< Use Configuration Wizard in Context Menu >>>   
20;*******************************************************************************
21; THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
22; WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
23; AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
24; INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
25; CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
26; INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
27;*******************************************************************************
28
29; Amount of memory (in bytes) allocated for Stack
30; Tailor this value to your application needs
31;  Stack Configuration
32;    Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
33; 

34
35Stack_Size      EQU     0x00001000
36
37               AREA    STACK, NOINIT, READWRITE, ALIGN=3
38Stack_Mem       SPACE   Stack_Size
39;__initial_sp
40
41__initial_sp    EQU    0x20000000 +Stack_Size                 ; stack used for SystemInit & SystemInit_ExtMemCtl

9 个解决方案

#1


你都代码怎么 copy 的, 代码里都分号, 是不是不是英文, 是中文的分号。

#2


你的代码怎么 copy 的, 代码里的分号, 是不是不是英文, 是中文的分号。 

#3


你这个不是GNU ARM 风格的汇编吧,是无法用gcc编译的

#4


你把汇编文件名的后缀从*.s改成*.S试试,我就是这样编译通过的。

#5


同问,我纠结这个问题好久了,这次铁了心要弄好它,再不行就自己写个启动文件,反正源码也不长,哈哈。我看了很多资料,好像都没有使用官方的启动文件。

#6


你要使用 gcc_ride7 文件夹内的 startup_stm32f10x_xx.s, arm/iar文件夹内是不行的

#7


STM32F10x High Density Devices vector table for MDK-ARM

你这是 arm 文件夹内的吧

#8


大家好,我最近在捣鼓STM32, GPIOD>CRL&=0XFFFFF0FF; GPIOD->CRL|=0X00000300;比如说这两句是对PD2的一些设置,但是如果我要设置PD3呢?应该怎样写啊?也就是说我没有理解这两个0XFFFFF0FF,0X00000300的意思。希望你能帮助我解决这个困惑谢谢!!!期待你们的回复。

#9


小白表示看不懂,最近在看STM32F103,不知道这样水的话会不会被删

推荐阅读
  • 先看官方文档TheJavaTutorialshavebeenwrittenforJDK8.Examplesandpracticesdescribedinthispagedontta ... [详细]
  • Python爬虫中使用正则表达式的方法和注意事项
    本文介绍了在Python爬虫中使用正则表达式的方法和注意事项。首先解释了爬虫的四个主要步骤,并强调了正则表达式在数据处理中的重要性。然后详细介绍了正则表达式的概念和用法,包括检索、替换和过滤文本的功能。同时提到了re模块是Python内置的用于处理正则表达式的模块,并给出了使用正则表达式时需要注意的特殊字符转义和原始字符串的用法。通过本文的学习,读者可以掌握在Python爬虫中使用正则表达式的技巧和方法。 ... [详细]
  • 超级简单加解密工具的方案和功能
    本文介绍了一个超级简单的加解密工具的方案和功能。该工具可以读取文件头,并根据特定长度进行加密,加密后将加密部分写入源文件。同时,该工具也支持解密操作。加密和解密过程是可逆的。本文还提到了一些相关的功能和使用方法,并给出了Python代码示例。 ... [详细]
  • 本文介绍了利用ARMA模型对平稳非白噪声序列进行建模的步骤及代码实现。首先对观察值序列进行样本自相关系数和样本偏自相关系数的计算,然后根据这些系数的性质选择适当的ARMA模型进行拟合,并估计模型中的位置参数。接着进行模型的有效性检验,如果不通过则重新选择模型再拟合,如果通过则进行模型优化。最后利用拟合模型预测序列的未来走势。文章还介绍了绘制时序图、平稳性检验、白噪声检验、确定ARMA阶数和预测未来走势的代码实现。 ... [详细]
  • Mono为何能跨平台
    概念JIT编译(JITcompilation),运行时需要代码时,将Microsoft中间语言(MSIL)转换为机器码的编译。CLR(CommonLa ... [详细]
  • 本文由编程笔记#小编为大家整理,主要介绍了logistic回归(线性和非线性)相关的知识,包括线性logistic回归的代码和数据集的分布情况。希望对你有一定的参考价值。 ... [详细]
  • 开发笔记:加密&json&StringIO模块&BytesIO模块
    篇首语:本文由编程笔记#小编为大家整理,主要介绍了加密&json&StringIO模块&BytesIO模块相关的知识,希望对你有一定的参考价值。一、加密加密 ... [详细]
  • [大整数乘法] java代码实现
    本文介绍了使用java代码实现大整数乘法的过程,同时也涉及到大整数加法和大整数减法的计算方法。通过分治算法来提高计算效率,并对算法的时间复杂度进行了研究。详细代码实现请参考文章链接。 ... [详细]
  • 本文介绍了在处理不规则数据时如何使用Python自动提取文本中的时间日期,包括使用dateutil.parser模块统一日期字符串格式和使用datefinder模块提取日期。同时,还介绍了一段使用正则表达式的代码,可以支持中文日期和一些特殊的时间识别,例如'2012年12月12日'、'3小时前'、'在2012/12/13哈哈'等。 ... [详细]
  • IOS开发之短信发送与拨打电话的方法详解
    本文详细介绍了在IOS开发中实现短信发送和拨打电话的两种方式,一种是使用系统底层发送,虽然无法自定义短信内容和返回原应用,但是简单方便;另一种是使用第三方框架发送,需要导入MessageUI头文件,并遵守MFMessageComposeViewControllerDelegate协议,可以实现自定义短信内容和返回原应用的功能。 ... [详细]
  • 合并列值-合并为一列问题需求:createtabletab(Aint,Bint,Cint)inserttabselect1,2,3unionallsel ... [详细]
  • 本文详细介绍了使用C#实现Word模版打印的方案。包括添加COM引用、新建Word操作类、开启Word进程、加载模版文件等步骤。通过该方案可以实现C#对Word文档的打印功能。 ... [详细]
  • 本文概述了JNI的原理以及常用方法。JNI提供了一种Java字节码调用C/C++的解决方案,但引用类型不能直接在Native层使用,需要进行类型转化。多维数组(包括二维数组)都是引用类型,需要使用jobjectArray类型来存取其值。此外,由于Java支持函数重载,根据函数名无法找到对应的JNI函数,因此介绍了JNI函数签名信息的解决方案。 ... [详细]
  • JVM:33 如何查看JVM的Full GC日志
    1.示例代码packagecom.webcode;publicclassDemo4{publicstaticvoidmain(String[]args){byte[]arr ... [详细]
  • 原文地址http://balau82.wordpress.com/2010/02/28/hello-world-for-bare-metal-arm-using-qemu/最开始时 ... [详细]
author-avatar
早晚虚文_114
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有