最近测试以前的一个程序,一般都是打开以前写的程序修改参数直接测试
但是发现以前的编译后出现错误。
奇怪了,以前的出现都是调试好了的啊,一般都是没有错误的,迅速找问题
跳转到错误代码行
代码区域
Heap_Size EQU 0x00000000 AREA HEAP, NOINIT, READWRITE, ALIGN=
__heap_base
Heap_Mem SPACE Heap_Size
__heap_limit PRESERVE8
THUMB ;指定为THUMB代码集 ; Vector Table Mapped to Address at Reset
AREA RESET, DATA, READONLY ;伪指令指定一下数据将放到程序存储区的开始。
EXPORT __Vectors
EXPORT __Vectors_End
EXPORT __Vectors_Size __Vectors DCD __initial_spTop ; Top of Stack 栈首地址值(注意:CM3的栈指针是递减的)
DCD Reset_Handler ; Reset Handler 复位函数的入口地址
DCD NMI_Handler ; NMI Handler 以下为响应的中断函数入口地址
DCD HardFault_Handler ; Hard Fault Handler
DCD MemManage_Handler ; MPU Fault Handler
DCD BusFault_Handler ; Bus Fault Handler
DCD UsageFault_Handler ; Usage Fault Handler
DCD ; Reserved
DCD ; Reserved
DCD ; Reserved
DCD ; Reserved
DCD SVC_Handler ; SVCall Handler
DCD DebugMon_Handler ; Debug Monitor Handler
DCD ; Reserved
DCD PendSV_Handler ; PendSV Handler
DCD SysTick_Handler ; SysTick Handler ; External Interrupts 以下为STM32定义的中断入口地址也是CM3定义的外部中断(非CM3内核中断)入口地址
DCD WWDG_IRQHandler ; Window Watchdog
DCD PVD_IRQHandler ; PVD through EXTI Line detect
DCD TAMPER_IRQHandler ; Tamper
DCD RTC_IRQHandler ; RTC
DCD FLASH_IRQHandler ; Flash
DCD RCC_IRQHandler ; RCC
DCD EXTI0_IRQHandler ; EXTI Line
DCD EXTI1_IRQHandler ; EXTI Line
DCD EXTI2_IRQHandler ; EXTI Line
DCD EXTI3_IRQHandler ; EXTI Line
DCD EXTI4_IRQHandler ; EXTI Line
DCD DMA1_Channel1_IRQHandler ; DMA1 Channel
DCD DMA1_Channel2_IRQHandler ; DMA1 Channel
DCD DMA1_Channel3_IRQHandler ; DMA1 Channel
DCD DMA1_Channel4_IRQHandler ; DMA1 Channel
DCD DMA1_Channel5_IRQHandler ; DMA1 Channel
DCD DMA1_Channel6_IRQHandler ; DMA1 Channel
DCD DMA1_Channel7_IRQHandler ; DMA1 Channel
DCD ADC1_2_IRQHandler ; ADC1 & ADC2
DCD USB_HP_CAN1_TX_IRQHandler ; USB High Priority or CAN1 TX
DCD USB_LP_CAN1_RX0_IRQHandler ; USB Low Priority or CAN1 RX0
DCD CAN1_RX1_IRQHandler ; CAN1 RX1
DCD CAN1_SCE_IRQHandler ; CAN1 SCE
DCD EXTI9_5_IRQHandler ; EXTI Line ..
DCD TIM1_BRK_IRQHandler ; TIM1 Break
DCD TIM1_UP_IRQHandler ; TIM1 Update
DCD TIM1_TRG_COM_IRQHandler ; TIM1 Trigger and Commutation
DCD TIM1_CC_IRQHandler ; TIM1 Capture Compare
DCD TIM2_IRQHandler ; TIM2
DCD TIM3_IRQHandler ; TIM3
DCD TIM4_IRQHandler ; TIM4
DCD I2C1_EV_IRQHandler ; I2C1 Event
DCD I2C1_ER_IRQHandler ; I2C1 Error
DCD I2C2_EV_IRQHandler ; I2C2 Event
DCD I2C2_ER_IRQHandler ; I2C2 Error
DCD SPI1_IRQHandler ; SPI1
DCD SPI2_IRQHandler ; SPI2
DCD USART1_IRQHandler ; USART1
DCD USART2_IRQHandler ; USART2
DCD USART3_IRQHandler ; USART3
DCD EXTI15_10_IRQHandler ; EXTI Line ..
DCD RTCAlarm_IRQHandler ; RTC Alarm through EXTI Line
DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
DCD TIM8_BRK_IRQHandler ; TIM8 Break
DCD TIM8_UP_IRQHandler ; TIM8 Update
DCD TIM8_TRG_COM_IRQHandler ; TIM8 Trigger and Commutation
DCD TIM8_CC_IRQHandler ; TIM8 Capture Compare
DCD ADC3_IRQHandler ; ADC3
DCD FSMC_IRQHandler ; FSMC
DCD SDIO_IRQHandler ; SDIO
DCD TIM5_IRQHandler ; TIM5
DCD SPI3_IRQHandler ; SPI3
DCD UART4_IRQHandler ; UART4
DCD UART5_IRQHandler ; UART5
DCD TIM6_IRQHandler ; TIM6
DCD TIM7_IRQHandler ; TIM7
DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
__Vectors_End __Vectors_Size EQU __Vectors_End - __Vectors AREA |.text|, CODE, READONLY ;定义以下汇编函数将调用C函数 ; Dummy SystemInit_ExtMemCtl function
SystemInit_ExtMemCtl PROC
EXPORT SystemInit_ExtMemCtl [WEAK]
BX LR
ENDP ; Reset handler routine
Reset_Handler PROC
EXPORT Reset_Handler [WEAK] ;这里就是复位函数了
IMPORT __main ;这个是定义一个外部的函数方便下边调用。这个函数是编译器自带的C环境运行函数名 LDR R0, = SystemInit_ExtMemCtl ; initialize external memory controller
BLX R0 LDR R1, = __initial_sp ; restore original stack pointer
MSR MSP, R1 LDR R0, =__main ;跳转上边定义的外部函数处执行。这里需要解释一下:这个“__main”函数不是我们在C语言中写的“main”函数。但他在创建了C函数的运行环境后会跳转到我们在C语言中写的“main”函数中去。
BX R0 ;这个就是跳转指令了
ENDP ; Dummy Exception Handlers (infinite loops which can be modified) 以下为中断函数的伪定义,当外部有对应的中断函数时,这里的中断函数不起作用。
作为一名资深码农,还是要具备专业英文阅读的能力.
错误:A1163E:未知操作指令R0,预指令或者宏错误.
也就是说R0未识别,记得以前看过博客好像是说
1.ARM汇编指令不支持顶格写,否则不能识别
2. 声明变量时不要有空格
可能是缩进造成的问题,。
就在前面加了一个空格。OK
0个错误,0个警告,全部重新生成。
The End!
欢迎加入C#群:160441098
嵌入式交流群:227262400