简体   繁体   English

您是否建议使用CooCox for Stm32f4发现套件?

[英]Do you suggest CooCox for Stm32f4 discovery kit?

I'm new with ARM processors, i recently bought STM32F4 Discovery Kit. 我是ARM处理器的新手,我最近购买了STM32F4 Discovery Kit。 Do you suggest me to begin proggraming with CooCoz or another IDE? 您是否建议我开始使用CooCoz或其他IDE进行编程? Sorry for English, Good work. 对不起英语,辛苦了。

Yes, it is easy to use. 是的,它很容易使用。

Download ST-LINK utility , CoIDE and gcc-arm-embedded toolchain . 下载ST-LINK实用程序CoIDE和gcc-arm嵌入式工具链

Install it and configure CooCox. 安装并配置CooCox。 In "Project -> Select Toolchain Path" select directory with toolchain, by default "C:\\Program Files\\GNU Tools ARM Embedded\\4.8 2013q4\\bin" 在“项目->选择工具链路径”中,选择带有工具链的目录,默认情况下为“ C:\\ Program Files \\ GNU Tools ARM Embedded \\ 4.8 2013q4 \\ bin”

Create new project, select stm32f407vg chip, then from repository select M4 CMSIS Core, CMSIS BOOT, RCC, GPIO. 创建新项目,选择stm32f407vg芯片,然后从存储库中选择M4 CMSIS Core,CMSIS BOOT,RCC,GPIO。 All needed files will be added to project tree. 所有需要的文件将被添加到项目树中。

Add code to main.c file 将代码添加到main.c文件

//basic headers
#include "stm32f4xx.h"
#include "stm32f4xx_gpio.h"
#include "stm32f4xx_rcc.h"

// delay function
void Soft_Delay(volatile uint32_t number)
{
        while(number--);
}

int main(void)
{
    //Peripherial clock setup
    RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOD, ENABLE);


    //Port setup
    GPIO_InitTypeDef  ledinit;  

    ledinit.GPIO_Mode = GPIO_Mode_OUT;  
    ledinit.GPIO_OType = GPIO_OType_PP;  
    ledinit.GPIO_PuPd = GPIO_PuPd_NOPULL; 
    ledinit.GPIO_Speed = GPIO_Speed_2MHz;  
    ledinit.GPIO_Pin = GPIO_Pin_15; //

    GPIO_Init(GPIOD, &ledinit); 


    while(1)
    {
        // Led On
        GPIO_SetBits(GPIOD, GPIO_Pin_15);


        // Pause
        Soft_Delay(0x000FFFFF);

        // Led Off
        GPIO_ResetBits(GPIOD, GPIO_Pin_15);

        // PAuse
        Soft_Delay(0x000FFFFF);
    }
}

Select "Project -> Rebuild" and "Flash -> Program Download", blue led will start blink. 选择“项目->重建”和“闪存->程序下载”,蓝色LED将开始闪烁。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM