我用的是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 个解决方案
你都代码怎么 copy 的, 代码里都分号, 是不是不是英文, 是中文的分号。
你的代码怎么 copy 的, 代码里的分号, 是不是不是英文, 是中文的分号。
你这个不是GNU ARM 风格的汇编吧,是无法用gcc编译的
你把汇编文件名的后缀从*.s改成*.S试试,我就是这样编译通过的。
同问,我纠结这个问题好久了,这次铁了心要弄好它,再不行就自己写个启动文件,反正源码也不长,哈哈。我看了很多资料,好像都没有使用官方的启动文件。
你要使用 gcc_ride7 文件夹内的 startup_stm32f10x_xx.s, arm/iar文件夹内是不行的
STM32F10x High Density Devices vector table for MDK-ARM
你这是 arm 文件夹内的吧
大家好,我最近在捣鼓STM32, GPIOD>CRL&=0XFFFFF0FF; GPIOD->CRL|=0X00000300;比如说这两句是对PD2的一些设置,但是如果我要设置PD3呢?应该怎样写啊?也就是说我没有理解这两个0XFFFFF0FF,0X00000300的意思。希望你能帮助我解决这个困惑谢谢!!!期待你们的回复。