/* Main.c file generated by New Project wizard
*
* Created: 周六 7月 11 2020
* Processor: STM32F103C4
* Compiler: GCC for ARM
*/
// Refer to 教程 https://www.bilibili.com/video/BV1Kb411y7BU?p=9
#include <stm32f1xx.h>
//0x4001 0C00
#define GPIOB_MODER *(unsigned int*)(0x40010C00)
#define GPIOB_ODR *(unsigned int*)(0x40010c0c)
#define CLOCKENABLE *(unsigned int*)(0x40021018)
extern int add(int ,int );
int main (void)
{
// Write your code here
CLOCKENABLE |= (1<<3) ;
GPIOB_MODER |= 1 ;
while (1){
GPIOB_ODR &= (~1);//0xfffffffe;
int delay = 0x7ffff;
while( delay -- > 0) ;
GPIOB_ODR |= 1;
delay = 0x7ffff;
while( delay -- > 0) ;
}
;
return 0;
}
STM32 学习资源:
https://www.bilibili.com/video/BV1Kb411y7BU?p=5 ,STM32 介绍
https://blog.csdn.net/weixin_43071664/article/details/104160705 ,介绍使用STM32CubeIDE 编译出Hex,在Proteus中仿真。
STM32CubeIDE编译出的Hex在I:\stm32prj\stm32prj1\STM32F103C4\Debug
https://www.cnblogs.com/sdmpy/p/5081827.html ,关于通过串口下载代码到板子
辽宁大学linux操作系统2020 :https://www.bilibili.com/video/BV1uE411W7pV?p=11