热门标签 | 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,不知道这样水的话会不会被删

推荐阅读
  • Metasploit攻击渗透实践
    本文介绍了Metasploit攻击渗透实践的内容和要求,包括主动攻击、针对浏览器和客户端的攻击,以及成功应用辅助模块的实践过程。其中涉及使用Hydra在不知道密码的情况下攻击metsploit2靶机获取密码,以及攻击浏览器中的tomcat服务的具体步骤。同时还讲解了爆破密码的方法和设置攻击目标主机的相关参数。 ... [详细]
  • sklearn数据集库中的常用数据集类型介绍
    本文介绍了sklearn数据集库中常用的数据集类型,包括玩具数据集和样本生成器。其中详细介绍了波士顿房价数据集,包含了波士顿506处房屋的13种不同特征以及房屋价格,适用于回归任务。 ... [详细]
  • Go GUIlxn/walk 学习3.菜单栏和工具栏的具体实现
    本文介绍了使用Go语言的GUI库lxn/walk实现菜单栏和工具栏的具体方法,包括消息窗口的产生、文件放置动作响应和提示框的应用。部分代码来自上一篇博客和lxn/walk官方示例。文章提供了学习GUI开发的实际案例和代码示例。 ... [详细]
  • 本文介绍了如何使用Express App提供静态文件,同时提到了一些不需要使用的文件,如package.json和/.ssh/known_hosts,并解释了为什么app.get('*')无法捕获所有请求以及为什么app.use(express.static(__dirname))可能会提供不需要的文件。 ... [详细]
  • 先看官方文档TheJavaTutorialshavebeenwrittenforJDK8.Examplesandpracticesdescribedinthispagedontta ... [详细]
  • Gitlab接入公司内部单点登录的安装和配置教程
    本文介绍了如何将公司内部的Gitlab系统接入单点登录服务,并提供了安装和配置的详细教程。通过使用oauth2协议,将原有的各子系统的独立登录统一迁移至单点登录。文章包括Gitlab的安装环境、版本号、编辑配置文件的步骤,并解决了在迁移过程中可能遇到的问题。 ... [详细]
  • 微软评估和规划(MAP)的工具包介绍及应用实验手册
    本文介绍了微软评估和规划(MAP)的工具包,该工具包是一个无代理工具,旨在简化和精简通过网络范围内的自动发现和评估IT基础设施在多个方案规划进程。工具包支持库存和使用用于SQL Server和Windows Server迁移评估,以及评估服务器的信息最广泛使用微软的技术。此外,工具包还提供了服务器虚拟化方案,以帮助识别未被充分利用的资源和硬件需要成功巩固服务器使用微软的Hyper - V技术规格。 ... [详细]
  • node.jsrequire和ES6导入导出的区别原 ... [详细]
  • Spring框架《一》简介
    Spring框架《一》1.Spring概述1.1简介1.2Spring模板二、IOC容器和Bean1.IOC和DI简介2.三种通过类型获取bean3.给bean的属性赋值3.1依赖 ... [详细]
  • 【重识云原生】第四章云网络4.8.3.2节——Open vSwitch工作原理详解
    2OpenvSwitch架构2.1OVS整体架构ovs-vswitchd:守护程序,实现交换功能,和Linux内核兼容模块一起,实现基于流的交换flow-basedswitchin ... [详细]
  • 本文介绍了在Go语言中可见性与scope的规则,包括在函数内外声明的可见性、命名规范和命名风格,以及变量声明和短变量声明的语法。同时,还介绍了变量的生命周期,包括包级别变量和局部变量的生命周期,以及变量在堆和栈上分配的规则和逃逸分析的概念。 ... [详细]
  • 本文详细介绍了在Linux虚拟化部署中进行VLAN配置的方法。首先要确认Linux系统内核是否已经支持VLAN功能,然后配置物理网卡、子网卡和虚拟VLAN网卡的关系。接着介绍了在Linux配置VLAN Trunk的步骤,包括将物理网卡添加到VLAN、检查添加的VLAN虚拟网卡信息以及重启网络服务等。最后,通过验证连通性来确认配置是否成功。 ... [详细]
  • imx6ull开发板驱动MT7601U无线网卡的方法和步骤详解
    本文详细介绍了在imx6ull开发板上驱动MT7601U无线网卡的方法和步骤。首先介绍了开发环境和硬件平台,然后说明了MT7601U驱动已经集成在linux内核的linux-4.x.x/drivers/net/wireless/mediatek/mt7601u文件中。接着介绍了移植mt7601u驱动的过程,包括编译内核和配置设备驱动。最后,列举了关键词和相关信息供读者参考。 ... [详细]
  • 本文详细介绍了MySQL表分区的创建、增加和删除方法,包括查看分区数据量和全库数据量的方法。欢迎大家阅读并给予点评。 ... [详细]
  • VueCLI多页分目录打包的步骤记录
    本文介绍了使用VueCLI进行多页分目录打包的步骤,包括页面目录结构、安装依赖、获取Vue CLI需要的多页对象等内容。同时还提供了自定义不同模块页面标题的方法。 ... [详细]
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社区 版权所有