stm32 - 你推荐 CooCox for Stm32f4 discovery kit 吗?

标签 stm32 coocox

我是 ARM 处理器的新手,我最近购买了 STM32F4 探索套件。你建议我开始使用 CooCoz 或其他 IDE 进行编程吗? 对不起英语,干得好。

最佳答案

是的,它很容易使用。

下载ST-LINK utility , CoIDE和 gcc-arm-embedded toolchain .

安装并配置 CooCox。在“Project -> Select Toolchain Path”中选择工具链目录,默认为“C:\Program Files\GNU Tools ARM Embedded\4.8 2013q4\bin”

创建新项目,选择 stm32f407vg 芯片,然后从存储库中选择 M4 CMSIS Core、CMSIS BOOT、RCC、GPIO。所有需要的文件都将添加到项目树中。

在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);
    }
}

选择“Project -> Rebuild”和“Flash -> Program Download”,蓝色 LED 将开始闪烁。

关于stm32 - 你推荐 CooCox for Stm32f4 discovery kit 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21074244/

相关文章:

c - STM32f4xx标准外设库说明

c - 使用 UART 检查从 SPH0645 Mic I2S 协议(protocol)接收的数据

c - STM32F103 Timer2不中断

c - "Undefined reference to"不知道为什么?

c - stm32 c,将原型(prototype)导出到项目的其余部分

c - 将 A71CH 与 I2C 连接

c - stm32函数在 "Standard Library"