stm32跑不到main函数

来源:互联网 发布:淘宝账号申请 编辑:程序博客网 时间:2024/06/05 19:02
Reset_Handler    PROC
                 EXPORT  Reset_Handler             [WEAK]
     IMPORT  __main
     IMPORT  SystemInit
                 LDR     R0, =SystemInit
                 BLX     R0
                 LDR     R0, =__main
                 BX      R0
                 ENDP
运行到“BX      R0”这里就不执行了。








原因找到了,特发此转过来~ 


因printf()之类的函数,使用了半主机模式。使用微库的话,不会使用半主机模式,所以就没有问题。  
添加下面代码,就可以使用标准库了:  
#pragma import(__use_no_semihosting)  
_sys_exit(int x)  
{  
x = x;  
}  
struct __FILE  
{  
int handle;  
/* Whatever you require here. If the only file you are using is */  
/* standard output using printf() for debugging, no file handling */  
/* is required. */  
};  
/* FILE is typedef’ d in stdio.h. */  
FILE __stdout; 




这个问题可以在"RealView? 编译工具库和浮点支持指南"书中找到。。