拿到这块板子有几天了,发现上面的网口是焊着的,比之前的nucleo-f411好多了。这下可以玩玩网口,官方自带的是freertos和mbed,本着支持国产的心态,打算在rt-thread上玩下这块板子,后面时间多的前提下把网络部分给移植上去,看看带宽可以跑到多少?下面先说说rt-thread的移植步骤.
目前,rt-thread已经支持上了stm32f7-discovery的板子了,自然在它的基础上来移植是最合适的,所以将bsp/stm32f7-disco目录给复制出一份,重命名为stm32f767zit6u 以下修改几点地方.
编译工具使用gcc-arm-none-eabi-5_4-2016q2-20160622-win32.exe,下载地址为www.linaro.org
1 rtconfig.py,增加PART_TYPE='stm32f767xx' ,修改CFLAGS为-DSTM32F767xx
2 rtconfig.h 将默认的控制台串口修改到 #define RT_CONSOLE_DEVICE_NAME "uart3" ,注释掉//#define RT_USING_EXT_SDRAM,因为这块板不带外部的sdram,也没有外部的sram
3 drivers/board.h
52 #define STM32_SRAM_SIZE (512 * 1024)
53 #define HEAP_END (0x20000000 + STM32_SRAM_SIZE)
修改sram的尺寸
4 drivers/board.c
61 /* Enable HSE Oscillator and activate PLL with HSE as source */
62 RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
63 RCC_OscInitStruct.HSEState = RCC_HSE_ON;
64 RCC_OscInitStruct.HSIState = RCC_HSI_OFF;
65 RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
66 RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
67 RCC_OscInitStruct.PLL.PLLM = 8;
68 RCC_OscInitStruct.PLL.PLLN = 432;
69 RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
70 RCC_OscInitStruct.PLL.PLLQ = 9;
71 RCC_OscInitStruct.PLL.PLLR = 7;
修改时钟配置
5 drivers/drv_led.c,drv_led.h
19 #define led_on() HAL_GPIO_WritePin(GPIOB, GPIO_PIN_7|GPIO_PIN_0|GPIO_PIN_14, GPIO_PIN_SET)
20 #define led_off() HAL_GPIO_WritePin(GPIOB,GPIO_PIN_7|GPIO_PIN_0|GPIO_PIN_14, GPIO_PIN_RESET)
40 int led_hw_init(void)
41 {
42 GPIO_InitTypeDef GPIO_InitStruct;
43
44 /* GPIO Ports Clock Enable */
45 __HAL_RCC_GPIOB_CLK_ENABLE();
46
47 /* Configure GPIO pin: PI1 (LD1) */
48 GPIO_InitStruct.Pin = GPIO_PIN_7|GPIO_PIN_0|GPIO_PIN_14;
49 GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
50 GPIO_InitStruct.Pull = GPIO_PULLDOWN;
51 GPIO_InitStruct.Speed = GPIO_SPEED_LOW;
52 HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
53 return 0;
54 }
适配到板子上的led管脚
6 drivers/drv_usart.c 主要是配置usart3串口
7 rtthread-stm32f7xx.ld
7 MEMORY
8 {
9 CODE (rx) : ORIGIN = 0x08000000, LENGTH = 2048k /* 2048KB flash */
10 DATA (rw) : ORIGIN = 0x20000000, LENGTH = 512k /* 512K sram */
11 }
8 最后下载最新的STM32Cube_FW_F7_V1.4.0,将里面的Drivers下的目录替换到Libraries下.
都修改完毕后,用命令行在bsp/stm32f767zit6u下执行scons.bat 即生成rtthread.bin,然后烧录到0x08000000地址即可。
以下是一些控制台截图和源码,烧录文件
将文件的.zip 去掉即可解压和烧录
rtthread.7z.001.zip
(4 MB)
rtthread.7z.002.zip
(4 MB)
rtthread.7z.003.zip
(1.96 MB)
rtthread.bin.zip
(85.04 KB)
|