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

cheng_bingyuan cheng_bingyuan 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
我用的是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; <h> Stack Configuration
32; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
33; </h>
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
...全文

相关推荐

eclipseSourceryG编译调试STM32[归纳].pdf

eclipseSourceryG编译调试STM32[归纳].pdf

xhr131452007

VSCode+GCC+OpenOCD搭建GD32F103CBT6开发环境全攻略

嵌入式开发中,MCU选型与工具链的搭配直接影响开发效率和项目可维护性。基于ARM Cortex-M3内核的GD32系列芯片,凭借其出色的性价比和供应链稳定性,成为许多产品替代进口芯片的热门选择。同时,以VSCode、GCC与OpenOCD组成的开源工具链,正在逐渐改变传统嵌入式开发依赖Keil/IAR等封闭IDE的现状——其轻量、跨平台、易于版本管理和自动化构建的特点,尤其适合团队协作与持续集成场景。从芯片选型、交叉编译器配置,到Makefile编写、链接脚本设计,再到OpenOCD烧录与Cortex-De

csid_502

led.zip_stm32f103zet6 led

使用stm32f103zet6做出的led跑马灯实验,可以成功运行。

weixin_42653672

Arduino STM32

Arduino STM32。硬件文件支持STM32系列开发板,适用于Arduino IDE 1.8.x版本,包括LeafLabs Maple及其他通用STM32F103系列开发板。

yiersansiwu123d

嵌入式原理实战:交叉编译、GPIO中断与RTOS调度全解析

嵌入式系统开发涉及从底层硬件到软件调度的完整技术链路,其核心概念包括交叉编译、寄存器操作、中断管理以及实时操作系统调度。交叉编译是嵌入式开发的基石,它解决了在不同架构之间生成可执行代码的问题,是理解嵌入式工程构建流程的起点。在此基础上,GPIO控制、时钟树配置和中断响应构成了硬件驱动的关键环节,直接影响外设行为的准确性与实时性。而RTOS的引入,则通过任务优先级与同步机制,有效提升了复杂系统的资源利用率和响应性能。这些技术广泛应用于物联网设备、工业控制、智能硬件等领域,是嵌入式软件工程师与驱动开发工程师必备

行影旅行
评论 9
收藏 已收藏
分享
返回顶部
cheng_bingyuan
Linux/Unix社区 23,224 成员 74,535 内容