[mw_shl_code=c,true]NVIC_INT_CTRL EQU 0xE000ED04 ; Interrupt control state register.
NVIC_SYSPRI14 EQU 0xE000ED22 ; System priority register (priority 14).
NVIC_PENDSV_PRI EQU 0xFF ; PendSV priority value (lowest).
NVIC_PENDSVSET EQU 0x10000000 ; Value to trigger PendSV exception.
EXPORT TEST
TEST
LDR R0, =NVIC_INT_CTRL ; Trigger the PendSV exception (causes context switch)
LDR R1, =NVIC_PENDSVSET
STR R1, [R0]
BX LR
NOP
END[/mw_shl_code]
这是我写的汇编文件,格式上应该没有什么错误吧.
然后我又定义一个huibian.h文件
[mw_shl_code=c,true]#ifndef _HUIBIAN_H_
#define _HUIBIAN_H_
void TEST(void);
#endif[/mw_shl_code]
然后在main.c中调用huibian.h文件.
[mw_shl_code=c,true]#include "stm32f10x.h"
#include "usart.h"
#include <stdio.h>
#include "huibian.h"
int main(void)
{
USART1_init();
printf(" adsf");
TEST();
while (1)
{
}
}[/mw_shl_code]
程序并不是想实现什么,只是想尝试一下汇编和c语言一起变成.但是编译出错.
我把.asm文件包含在文件路径里了(就像.h文件那样).也添加到工程里了(就像.c文件那样).可是还是出错.
哪里出错了?还是我加载汇编文件的方法根本不对?求教(我用的是keil4).谢谢.
|