MDK程序无法运行
来源:互联网 发布:广东省发票打印软件 编辑:程序博客网 时间:2024/05/16 19:25
继续我第一个MDKV5.15程序。程序的功能是用printf输出一个字符串,使用STM32F103RC芯片,V3.5.0版本的固件库,串口1输出。
#include "stm32f10x.h"#include <stdio.h>USART_InitTypeDef USART_InitStructure;GPIO_InitTypeDef GPIO_InitStructure;#define PUTCHAR_PROTOTYPE int fputc(int ch, FILE *f)int main(void){ /*!< At this stage the microcontroller clock setting is already configured, this is done through SystemInit() function which is called from startup file (startup_stm32f10x_xx.s) before to branch to application main. To reconfigure the default setting of SystemInit() function, refer to system_stm32f10x.c file */ /* USARTx configured as follow: - BaudRate = 115200 baud - Word Length = 8 Bits - One Stop Bit - No parity - Hardware flow control disabled (RTS and CTS signals) - Receive and transmit enabled */ USART_InitStructure.USART_BaudRate = 115200; USART_InitStructure.USART_WordLength = USART_WordLength_8b; USART_InitStructure.USART_StopBits = USART_StopBits_1; USART_InitStructure.USART_Parity = USART_Parity_No; USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None; USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx; /* Enable GPIO clock */ RCC_APB2PeriphClockCmd( RCC_APB2Periph_GPIOA | RCC_APB2Periph_USART1, ENABLE); /* Configure USART Tx as alternate function push-pull */ GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_Init(GPIOA, &GPIO_InitStructure); /* Configure USART Rx as input floating */ GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING; GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10; GPIO_Init(GPIOA, &GPIO_InitStructure); /* USART configuration */ USART_Init( USART1, &USART_InitStructure); /* Enable USART */ USART_Cmd( USART1, ENABLE); /* Output a message on Hyperterminal using printf function */ printf("\n\rHello world\n\r"); while (1) { }}/** * @brief Retargets the C library printf function to the USART. * @param None * @retval None */PUTCHAR_PROTOTYPE{ /* Place your implementation of fputc here */ /* e.g. write a character to the USART */ USART_SendData(USART1, (uint8_t) ch); /* Loop until the end of transmission */ while (USART_GetFlagStatus(USART1, USART_FLAG_TC) == RESET) {} return ch;}
代码写出来后,在Debug选项页勾选了“Run to main()”,但是在运行时发现根本运行不到main(),连第一个函数“SystemInit()”都不执行。排除硬件问题,发现又是软件配置问题:需要在“Target”配置页面选中“Use MicoLIB”。
0 0
- MDK程序无法运行
- 解决mdk生成bin烧录lpc1343无法运行问题
- KEIL-MDK无法下载程序到芯片的问题
- 使用Keil MDK运行第一个STM32程序
- 使用Keil MDK运行第一个STM32程序
- 使用Keil MDK运行第一个STM32程序
- 使用Keil MDK运行第一个STM32程序
- 使用Keil MDK运行第一个STM32程序
- vb程序无法运行
- asp程序无法运行处理
- GEA无法运行Python 程序
- Debug程序无法运行解决
- 如果无法运行十六位程序
- error:js程序无法运行
- jdk无法运行javac程序
- AndroidStudio无法运行java程序
- 使用supervivi+DNW下载MDK环境下2440裸机程序到SDRAM中运行
- IIS6下无法正常运行ASP程序
- 单例模式的优缺点
- 百度翻译api 网页应用
- COLORREF 和RGBQUAD的区别
- RMQ 之 ST算法的使用 【总结】 【附带求固定区间长度的一维技巧】
- HashSet如何保证元素的唯一性-跟踪源码解析
- MDK程序无法运行
- struts2 + ajaxfileupload.js 多图上传
- 【Lua】【1】Lua游戏脚本语言入门(转载)
- HDU 4417 Super Mario
- ffmpeg 制作水印方法
- 用qt实现的一个地理数据浏览器
- memset使用注意事项
- js格式文件中获取JSP变量的方法
- iOS 8 新特性介绍