|
1 | | -## board info: |
| 1 | +# STM32F40x 板级支持包 |
2 | 2 |
|
3 | | - STM32F4 discovery |
4 | | - http://www.st.com/internet/evalboard/product/252419.jsp |
| 3 | +## 1. 简介 |
5 | 4 |
|
6 | | -## note: |
| 5 | +STM32F40x 是由意法半导体推出的Cortex-M4内核的高性能单片机 |
| 6 | +包括如下硬件特性: |
7 | 7 |
|
8 | | -in drivers/stm32f4xx_conf.h |
| 8 | +| 硬件 | 描述 | |
| 9 | +| -- | -- | |
| 10 | +|芯片型号| STM32F40x全系列 | |
| 11 | +|CPU| Cortex-M4 | |
| 12 | +|主频| 84MHz-208MHz | |
9 | 13 |
|
10 | | -```c |
11 | | - /* Redefine the HSE value; it's equal to 8 MHz on the STM32F4-DISCOVERY Kit */ |
12 | | - efine HSE_VALUE ((uint32_t)8000000) |
| 14 | +## 2. 编译说明 |
| 15 | + |
| 16 | + |
| 17 | +| 环境 | 说明 | |
| 18 | +| ------------ | ------------------------------------------------------------ | |
| 19 | +| PC操作系统 | Linux/MacOS/Windows | |
| 20 | +| 编译器 | arm-none-eabi-gcc version 6.3.1 20170620 (release)/armcc/iar | |
| 21 | +| 构建工具 | scons/mdk5/iar | |
| 22 | +| 依赖软件环境 | Env工具/(MDK或IAR或arm-none-eabi-gcc)/git/调试器驱动 | |
| 23 | + |
| 24 | +1) 下载源码 |
| 25 | + |
| 26 | +```bash |
| 27 | + git clone https://github.com/RT-Thread/rt-thread.git |
| 28 | +``` |
| 29 | + |
| 30 | +2) 配置工程并准备env |
| 31 | + |
| 32 | +(Linux/Mac) |
| 33 | + |
| 34 | +```bash |
| 35 | + cd rt-thread/bsp/stm32f40x |
| 36 | + scons --menuconfig |
| 37 | + source ~/.env/env.sh |
| 38 | + pkgs --upgrade |
| 39 | +``` |
| 40 | + |
| 41 | +(Windows) |
| 42 | + |
| 43 | +>在[RT-Thread官网][1]下载ENV工具包 |
| 44 | +
|
| 45 | +3) 配置芯片型号 |
| 46 | + |
| 47 | +(Linux/Mac) |
| 48 | + |
| 49 | +```bash |
| 50 | + scons --menuconfig |
| 51 | +``` |
| 52 | + |
| 53 | +(Windows(ENV环境中)) |
| 54 | + |
| 55 | +```bash |
| 56 | + menuconfig |
| 57 | +``` |
| 58 | + |
| 59 | +在menuconfig页面配置并选择对应的芯片型号,若开发环境为MDK/IAR,则需要生成工程 |
| 60 | + |
| 61 | +4) 生成工程(Mac/Linux下请跳过此步骤) |
| 62 | + |
| 63 | +(Windows IAR) |
| 64 | + |
| 65 | +```bash |
| 66 | + SET RTT_CC=iar |
| 67 | + scons --target=iar -s |
13 | 68 | ``` |
14 | | - |
15 | | - **================= IAR WARNING =================** |
16 | | - |
17 | | -After use `scons --target=iar -s` command to product IAR project, you have to add iar link file manually. |
18 | 69 |
|
19 | | -IAR IDE steps: |
20 | | -1. Project-->Options-->Linker |
21 | | -2. Config-->Linker Configuration file |
22 | | -3. select `Override Default`, then select `bsp/stm32f40x/stm32f40x_flash.icf` |
23 | | -4. rebuild project |
| 70 | +(Windows MDK5) |
| 71 | + |
| 72 | +```bash |
| 73 | + scons --target=mdk5 -s |
| 74 | +``` |
| 75 | + |
| 76 | +(Windows MDK4) |
| 77 | + |
| 78 | +```bash |
| 79 | + scons --target=mdk4 -s |
| 80 | +``` |
| 81 | + |
| 82 | +5) 编译 |
| 83 | + |
| 84 | +使用MDK或IAR请参见对应教程 |
| 85 | + |
| 86 | +(Windows arm-none-eabi-gcc) |
| 87 | +使用以下指令设置gcc路径 |
| 88 | + |
| 89 | +```bash |
| 90 | + SET RTT_EXEC_PATH=[GCC路径] |
| 91 | +``` |
| 92 | + |
| 93 | +(Linux/Mac arm-none-eabi-gcc) |
| 94 | +使用以下指令设置gcc路径 |
| 95 | + |
| 96 | +```bash |
| 97 | + export RTT_EXEC_PATH=[GCC路径] |
| 98 | +``` |
| 99 | + |
| 100 | +编译(WindowsLinux/Mac arm-none-eabi-gcc) |
| 101 | + |
| 102 | +```bash |
| 103 | + scons -j4 |
| 104 | +``` |
| 105 | + |
| 106 | +出现下列信息即为编译成功 |
| 107 | + |
| 108 | +```bash |
| 109 | + LINK rtthread-stm32f4xx.elf |
| 110 | + arm-none-eabi-objcopy -O binary rtthread-stm32f4xx.elf rtthread.bin |
| 111 | + arm-none-eabi-size rtthread-stm32f4xx.elf |
| 112 | + text data bss dec hex filename |
| 113 | + 41596 356 1456 43408 a990 rtthread-stm32f4xx.elf |
| 114 | + scons: done building targets. |
| 115 | +``` |
| 116 | + |
| 117 | + |
| 118 | +如果编译正确无误,会产生rtthread-stm23f4xx.elf、rtthread.bin文件。其中rtthread.bin为二进制固件 |
| 119 | + |
| 120 | +## 3. 烧写及执行 |
| 121 | + |
| 122 | +烧写可以使用仿真器 ISP等多种方式 此处不再赘述 |
| 123 | + |
| 124 | +### 3.1 运行结果 |
| 125 | + |
| 126 | +如果编译 & 烧写无误,会在串口2*上看到RT-Thread的启动logo信息: |
| 127 | + |
| 128 | +```bash |
| 129 | + \ | / |
| 130 | +- RT - Thread Operating System |
| 131 | + / | \ 3.0.4 build May 15 2018 |
| 132 | + 2006 - 2018 Copyright by rt-thread team |
| 133 | +msh /> |
| 134 | +``` |
| 135 | + |
| 136 | +*默认串口 |
| 137 | + |
| 138 | + |
| 139 | +## 4. 驱动支持情况及计划 |
| 140 | + |
| 141 | +| 驱动 | 支持情况 | 备注 | |
| 142 | +| ------- | :------: | :-----------: | |
| 143 | +| UART | 支持 | UART1/2/3/4/5 | |
| 144 | +| GPIO | 支持 | / | |
| 145 | +| hwtimer | 支持 | / | |
| 146 | +| RTC | 支持 | / | |
| 147 | +| eth | 支持 | LAN8720A | |
| 148 | + |
| 149 | +### 4.1 IO在板级支持包中的映射情况 |
| 150 | + |
| 151 | +| IO号 | 板级包中的定义 | |
| 152 | +| -- | -- | |
| 153 | +| PB6 | USART1 TX | |
| 154 | +| PB7 | USART1 RX | |
| 155 | +| PA2 | USART2 TX | |
| 156 | +| PA3 | USART2 RX | |
| 157 | +| PD8 | USART3 TX | |
| 158 | +| PD9 | USART3 RX | |
| 159 | +| PC10 | UART4 TX | |
| 160 | +| PC11 | UART4 RX | |
| 161 | +| PC12 | UART5 TX | |
| 162 | +| PD2 | UART5 RX | |
| 163 | + |
| 164 | +## 5. menuconfig Bsp菜单详解 |
| 165 | + |
| 166 | +| 选项 | 解释 | |
| 167 | +| -- | -- | |
| 168 | +| Enable UART1 (PB6/7) | 开启串口1,串口1的设备名为"uart1" | |
| 169 | +| Enable UART2 (PA2/3) | 开启串口2,串口1的设备名为"uart2" | |
| 170 | +| Enable UART3 (PD8/9) | 开启串口3,串口1的设备名为"uart3" | |
| 171 | +| Enable UART4 (PC10/11) | 开启串口4,串口1的设备名为"uart4" | |
| 172 | +| Enable UART5 (PC12/PD2) | 开启串口5,串口1的设备名为"uart5" | |
| 173 | + |
| 174 | +*部分选项需要在RT-Thread组件菜单中开启对应的设备框架才能显示。 |
| 175 | + |
| 176 | +## 6. 联系人信息 |
24 | 177 |
|
25 | | -**TODO** |
| 178 | +维护人: |
| 179 | +[uestczyh222 ][4] < [[email protected]][5] > |
26 | 180 |
|
27 | | -auto add *.icf by scons script |
| 181 | + [1]: https://www.rt-thread.org/page/download.html |
| 182 | + [4]: https://github.com/uestczyh222 |
| 183 | + |
0 commit comments