您的位置 首页 基础

STM32F10x在环境下的开发进程

STM32F10x在EWARM-EV-WEB-520环境下的开发过程(利用H-JTAGSERVER)一、首先下载ARM-based32-bitMCUSTM32F10xxxstandardperiph

STM 32F10x在EWARM-EV-WEB-520环境下的开发进程

(使用H-JTAG SERVER)

一、首要下载ARM-based 32-bit MCU STM32F10xxx standard peripheral library
stm32f10x_stdperiph_lib_v3.0.0.zip
http://www.st.com/stonline/products/support/micro/files/stm32f10x_stdperiph_lib_v3.0.0.zip

二、树立STM32 LCCD工程

1.解压stm32f10x_stdperiph_lib_v3.0.0.zip软件包,把其间的“Libraries”和文件夹复制到“D:workslccd-1.0.0”,在“D:workslccd-1.0.0”下树立“Project”、“Drivers”、“Linker”、“Include”和“Source”空文件夹,在“D:workslccd-1.0.0Project”下树立“Stm32f103”空文件夹,把压缩包的“ProjectTemplate”下的C文件复制到“Source”和H文件复制到“Include”,把“ProjectTemplateEWARMv5”下的一切ICF文件复制到“Linker”;

2.在EWARM菜单中“Project”->“Create New Project”翻开“Create New Project”窗口,点击“OK”翻开“另存为”窗口,挑选项目工程存储途径“D:workslccd-1.0.0ProjectStm32f103”填写项目文件名“lccd.ewp”,在菜单中“File”->“Save All”翻开“Save Workspace As”窗口,填写工作环境文件名“lccd.eww”;
3.在EWARM的左边“Workspace”窗口下面的“Files”空白部分右击鼠标,挑选“Add”->“Add Group”呈现““Add Group – lccd”窗口,在“Group name”中填上“CMSIS”,相同办法树立“USER”“BOOT”“DRV”“INC”“LIB”等文件组后点击“Save All”快捷键;
4.在EWARM的左边“Workspace”窗口下面的“CMSIS”上右击鼠标,挑选“Add”->“Add Files”呈现“Add Files – CMSIS”窗口,挑选翻开“D:workslccd-1.0.0LibrariesCMSISCoreCM3”文件夹下的“core_cm3.c”和“system_stm32f10x.c”文件;
5.在EWARM的左边“Workspace”窗口下面的“BOOT”上右击鼠标,挑选“Add”->“Add Files”呈现“Add Files – BOOT”窗口,挑选翻开“D:workslccd-1.0.0LibrariesCMSISCoreCM3startupiar”文件夹下的“startup_stm32f10x_md.s”文件;
6.在EWARM的左边“Workspace”窗口下面的“LIB”上右击鼠标,挑选“Add”->“Add Files”呈现“Add Files – LIB”窗口,挑选翻开“D:workslccd-1.0.0LibrariesSTM32F10x_StdPeriph_Driversrc”文件夹下的“stm32f10x_gpio.c”等一切C文件;
7.在EWARM的左边“Workspace”窗口下面的“INC”上右击鼠标,挑选“Add”->“Add Files”呈现“Add Files – INC”窗口,挑选翻开“D:workslccd-1.0.0Include”文件夹下的一切H文件;
8.在EWARM的左边“Workspace”窗口下面的“USER”上右击鼠标,挑选“Add”->“Add Files”呈现“Add Files – USER”窗口,挑选翻开“D:workslccd-1.0.0Source”文件夹下的一切C文件,点击“Save All”快捷键;

三、装备STM32 LCCD工程

在EWARM的左边“Workspace”窗口下面的“Files”的“lccd – Debug”左击鼠标,挑选“Project”->“Options”呈现“Options for node “lccd””窗口;

1.在左边“Category:”中挑选上“General Options”,在“Target”->“Processor Variant”->“Device”中挑选“ST STM32F10xx8”,
在“Library Configuration”->“Library”中挑选“FULL”;
2.在左边“Category:”中挑选上“C/C Complier”,在“Preprocessor”->“Additional include directories:”中填上下面几行:
$PROJ_DIR$….Include
$PROJ_DIR$….LibrariesCMSISCoreCM3
$PROJ_DIR$….LibrariesSTM32F10x_StdPeriph_Driverinc在“Preprocessor”->“Definesymbols:”中填上下面几行:
USE_STDPERIPH_DRIVER
STM32F10X_MD
USE_STM3210B_
3.在左边“Category:”中挑选上“Output Converter”,在“Output”中勾选“Generate addition output”并在“Output format:”中挑选“binary”,在“Output”->“Output file”中勾选“override default”并填写上方针码文件名:lccd_debug_1.0.0.bin;

4.在左边“Category:”中挑选上“Linker”,在“Config”->“Linker configuration file”中勾选“override default”,在下面填上:“$PROJ_DIR$….Linkerstm32f10x_flash.icf”(假如要在sram中仿真应填“$PROJ_DIR$….Linkerstm32f10x_sram.icf”),在“List”中勾选“Generate linker map file”;

5.在左边“Category:”中挑选上“Debugger”,在“Setup”->“Driver”中挑选“RDI”,在“Download”勾挑选“Use flash loader”;(假如要在sram中仿真,则不勾选“Use flash loader”)

6.在左边“Category:”中挑选上“RDI”,在“Manufacturer RDI driver”中挑选“C:Program FilesH-JTAGH-JTAG.dll”完结设置,单击OK。

(若挑选release形式,则在EWARM的左边“Workspace”窗口下挑选“Release”,然后可以对“lccd – Release”左击鼠标,挑选“Project”->“Options”呈现“Options for node “lccd””窗口,做相似上面“lccd_Debug”的装备,留意不挑选调试信息及方针友文件名为lccd_release_1.0.0.bin;)

四、调试STM32 LCCD工程

1.在EWARM菜单中“Project”->“Make”翻开编译工程指令;
2.在EWARM菜单中“Project”->“Download and Debug”翻开下载调试指令;
3.在EWARM菜单中“Debug”->“Go”翻开全速运转指令;
4.其它调试指令请自行测验;

五、修正STM32 LCCD工程

1.移植USART的PRINTF使用
A.把D:workslccd-1.0.0Includestm32f10x_conf.h的第46行的注释翻开;
B.把D:workslccd-1.0.0ProjectExamplesUSARTPrintfplatform_config.h复制到D:workslccd-1.0.0Include目录;
C.把D:workslccd-1.0.0ProjectExamplesUSARTPrintfmain.c复制到D:workslccd-1.0.0Source;
D.编译调试即可以在UART1看到115200 8N1的字符“USART Printf Example: retarget the C library printf function to the USART”
2.收拾USART的PRINTF使用

A.挑选Workspace”窗口下的“DRV”用“Project”->“Add Files”把“D:workslccd-1.0.0Driversuart.c”添加到工程;
D:workslccd-1.0.0Driversuart.c的源码如下:

#include “stm32f10x.h”
#include “stdio.h”
#include “platform_config.h”

void UART_Configuration(void);

void UART_Configuration(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
USART_InitTypeDef USART_InitStructure;

#if defined USE_USART2 && defined USE_STM3210B_

RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE);

GPIO_PinRemapConfig(GPIO_Remap_USART2, ENABLE);
#endif
GPIO_InitStructure.GPIO_Pin = GPIO_TxPin;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
GPIO_Init(GPIOx, &GPIO_InitStructure);


GPIO_InitStructure.GPIO_Pin = GPIO_RxPin;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
GPIO_Init(GPIOx, &GPIO_InitStructure);

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;

USART_Init(USARTx, &USART_InitStructure);

USART_Cmd(USARTx, ENABLE);

}

int fputc(int ch, FILE *f)
{

USART_SendData(USARTx, (uint8_t) ch);


while(USART_GetFlagStatus(USARTx, USART_FLAG_TXE) == RESET)
{
}

return ch;
}

int fgetc(FILE *f)
{

while ( USART_GetFlagStatus(USARTx, USART_FLAG_RXNE) == RESET);
return (uint8_t)USARTx->DR;
}
B,修正D:workslccd-1.0.0Sourcemain.c的int main(void)如下:
int main(void)
{

RCC_Configuration();


UART_Configuration();


printf(“”);
printf(“*** LCCD V1.0 Build byyuanxihua@21cn.comon (“__DATE__ ” – ” __TIME__ “)”);
printf(“*** LCCD V1.0 Rebooting …”);

while (1)
{
}
}

声明:本文内容来自网络转载或用户投稿,文章版权归原作者和原出处所有。文中观点,不代表本站立场。若有侵权请联系本站删除(kf@86ic.com)https://www.86ic.net/zhishi/jichu/257870.html

为您推荐

联系我们

联系我们

在线咨询: QQ交谈

邮箱: kf@86ic.com

关注微信
微信扫一扫关注我们

微信扫一扫关注我们

返回顶部