STM32工程中出现 error: A1163E: Unknown opcode R0, , expecting opcode or Macro错误分析及处理
最近测试以前的一个程序,一般都是打开以前写的程序修改参数直接测试
但是发现以前的编译后出现错误。
奇怪了,以前的出现都是调试好了的啊,一般都是没有错误的,迅速找问题
跳转到错误代码行
代码区域
1 Heap_Size EQU 0x00000000 2 3 AREA HEAP, NOINIT, READWRITE, ALIGN=3 4 __heap_base 5 Heap_Mem SPACE Heap_Size 6 __heap_limit 7 8 PRESERVE8 9 THUMB ;指定为THUMB代码集 10 11 12 ; Vector Table Mapped to Address 0 at Reset 13 AREA RESET, DATA, READONLY ;伪指令指定一下数据将放到程序存储区的开始。 14 EXPORT __Vectors 15 EXPORT __Vectors_End 16 EXPORT __Vectors_Size 17 18 __Vectors DCD __initial_spTop ; Top of Stack 栈首地址值(注意:CM3的栈指针是递减的) 19 DCD Reset_Handler ; Reset Handler 复位函数的入口地址 20 DCD NMI_Handler ; NMI Handler 以下为响应的中断函数入口地址 21 DCD HardFault_Handler ; Hard Fault Handler 22 DCD MemManage_Handler ; MPU Fault Handler 23 DCD BusFault_Handler ; Bus Fault Handler 24 DCD UsageFault_Handler ; Usage Fault Handler 25 DCD 0 ; Reserved 26 DCD 0 ; Reserved 27 DCD 0 ; Reserved 28 DCD 0 ; Reserved 29 DCD SVC_Handler ; SVCall Handler 30 DCD DebugMon_Handler ; Debug Monitor Handler 31 DCD 0 ; Reserved 32 DCD PendSV_Handler ; PendSV Handler 33 DCD SysTick_Handler ; SysTick Handler 34 35 ; External Interrupts 以下为STM32定义的中断入口地址也是CM3定义的外部中断(非CM3内核中断)入口地址 36 DCD WWDG_IRQHandler ; Window Watchdog 37 DCD PVD_IRQHandler ; PVD through EXTI Line detect 38 DCD TAMPER_IRQHandler ; Tamper 39 DCD RTC_IRQHandler ; RTC 40 DCD FLASH_IRQHandler ; Flash 41 DCD RCC_IRQHandler ; RCC 42 DCD EXTI0_IRQHandler ; EXTI Line 0 43 DCD EXTI1_IRQHandler ; EXTI Line 1 44 DCD EXTI2_IRQHandler ; EXTI Line 2 45 DCD EXTI3_IRQHandler ; EXTI Line 3 46 DCD EXTI4_IRQHandler ; EXTI Line 4 47 DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1 48 DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2 49 DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3 50 DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4 51 DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5 52 DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6 53 DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7 54 DCD ADC1_2_IRQHandler ; ADC1 & ADC2 55 DCD USB_HP_CAN1_TX_IRQHandler ; USB High Priority or CAN1 TX 56 DCD USB_LP_CAN1_RX0_IRQHandler ; USB Low Priority or CAN1 RX0 57 DCD CAN1_RX1_IRQHandler ; CAN1 RX1 58 DCD CAN1_SCE_IRQHandler ; CAN1 SCE 59 DCD EXTI9_5_IRQHandler ; EXTI Line 9..5 60 DCD TIM1_BRK_IRQHandler ; TIM1 Break 61 DCD TIM1_UP_IRQHandler ; TIM1 Update 62 DCD TIM1_TRG_COM_IRQHandler ; TIM1 Trigger and Commutation 63 DCD TIM1_CC_IRQHandler ; TIM1 Capture Compare 64 DCD TIM2_IRQHandler ; TIM2 65 DCD TIM3_IRQHandler ; TIM3 66 DCD TIM4_IRQHandler ; TIM4 67 DCD I2C1_EV_IRQHandler ; I2C1 Event 68 DCD I2C1_ER_IRQHandler ; I2C1 Error 69 DCD I2C2_EV_IRQHandler ; I2C2 Event 70 DCD I2C2_ER_IRQHandler ; I2C2 Error 71 DCD SPI1_IRQHandler ; SPI1 72 DCD SPI2_IRQHandler ; SPI2 73 DCD USART1_IRQHandler ; USART1 74 DCD USART2_IRQHandler ; USART2 75 DCD USART3_IRQHandler ; USART3 76 DCD EXTI15_10_IRQHandler ; EXTI Line 15..10 77 DCD RTCAlarm_IRQHandler ; RTC Alarm through EXTI Line 78 DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend 79 DCD TIM8_BRK_IRQHandler ; TIM8 Break 80 DCD TIM8_UP_IRQHandler ; TIM8 Update 81 DCD TIM8_TRG_COM_IRQHandler ; TIM8 Trigger and Commutation 82 DCD TIM8_CC_IRQHandler ; TIM8 Capture Compare 83 DCD ADC3_IRQHandler ; ADC3 84 DCD FSMC_IRQHandler ; FSMC 85 DCD SDIO_IRQHandler ; SDIO 86 DCD TIM5_IRQHandler ; TIM5 87 DCD SPI3_IRQHandler ; SPI3 88 DCD UART4_IRQHandler ; UART4 89 DCD UART5_IRQHandler ; UART5 90 DCD TIM6_IRQHandler ; TIM6 91 DCD TIM7_IRQHandler ; TIM7 92 DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1 93 DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2 94 DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3 95 DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5 96 __Vectors_End 97 98 __Vectors_Size EQU __Vectors_End - __Vectors 99 100 AREA |.text|, CODE, READONLY ;定义以下汇编函数将调用C函数 101 102 ; Dummy SystemInit_ExtMemCtl function 103 SystemInit_ExtMemCtl PROC 104 EXPORT SystemInit_ExtMemCtl [WEAK] 105 BX LR 106 ENDP 107 108 ; Reset handler routine 109 Reset_Handler PROC 110 EXPORT Reset_Handler [WEAK] ;这里就是复位函数了 111 IMPORT __main ;这个是定义一个外部的函数方便下边调用。这个函数是编译器自带的C环境运行函数名 112 113 114 LDR R0, = SystemInit_ExtMemCtl ; initialize external memory controller 115 BLX R0 116 117 LDR R1, = __initial_sp ; restore original stack pointer 118 MSR MSP, R1 119 120 LDR R0, =__main ;跳转上边定义的外部函数处执行。这里需要解释一下:这个“__main”函数不是我们在C语言中写的“main”函数。但他在创建了C函数的运行环境后会跳转到我们在C语言中写的“main”函数中去。 121 BX R0 ;这个就是跳转指令了 122 ENDP 123 124 ; Dummy Exception Handlers (infinite loops which can be modified) 以下为中断函数的伪定义,当外部有对应的中断函数时,这里的中断函数不起作用。
作为一名资深码农,还是要具备专业英文阅读的能力.
错误:A1163E:未知操作指令R0,预指令或者宏错误.
也就是说R0未识别,记得以前看过博客好像是说
1.ARM汇编指令不支持顶格写,否则不能识别
2. 声明变量时不要有空格
可能是缩进造成的问题,。
就在前面加了一个空格。OK
0个错误,0个警告,全部重新生成。
The End!
欢迎加入C#群:160441098
嵌入式交流群:227262400
STM32工程中出现 error: A1163E: Unknown opcode R0, , expecting opcode or Macro错误分析及处理,布布扣,bubuko.com
文章来自:http://www.cnblogs.com/1hua1ye/p/3752396.html