本帖最后由 TL-LED 于 2023-9-26 17:02 编辑
看到网上有个chibios系统,支持STM32开发板,发现没有支持STM32F723这个型号,下面移植到这款开发板上运行。
一、chibios系统下载
下载地址:http://www.chibios.org/dokuwiki/doku.php
chibios有几种产品分类,我这里下开发工具chibistudio软件
使用windows环境,下载相应的版本
软件使用手册:https://www.playembedded.org/blog/category/articles/chibios/how-tos/
下载的软件包使用7Z软件解压到C盘
点击快捷方式,直接运行软件
复制已有的STM32开发板,创建STM32F723板
二、程序
2.1、修改硬件端口
修改LED灯,按键输入端口
修改调试串口端口
其他端口未调试,没有修改。
2.2、main.c
#include "ch.h"
#include "hal.h"
#include "rt_test_root.h"
#include "oslib_test_root.h"
/*
* This is a periodic thread that does absolutely nothing except flashing
* a LED.
*/
static THD_WORKING_AREA(waThread1, 128);
static THD_FUNCTION(Thread1, arg) {
(void)arg;
chRegSetThreadName("blinker");
while (true) {
palSetLine(LINE_LED5);
chThdSleepMilliseconds(100);
palClearLine(LINE_LED5);
chThdSleepMilliseconds(100);
palSetLine(LINE_LED6);
chThdSleepMilliseconds(100);
palClearLine(LINE_LED6);
chThdSleepMilliseconds(100);
}
}
/*
* Application entry point.
*/
int main(void) {
/*
* System initializations.
* - HAL initialization, this also initializes the configured device drivers
* and performs the board-specific initializations.
* - Kernel initialization, the main() function becomes a thread and the
* RTOS is active.
*/
halInit();
chSysInit();
/*
* ARD_D13 is programmed as output (board LED).
*/
palSetLine(LINE_LED6);
palSetLineMode(LINE_LED6, PAL_MODE_OUTPUT_PUSHPULL);
/*
* Activates the serial driver 1 using the driver default configuration.
*/
sdStart(&SD6, NULL);
/*
* Creates the example thread.
*/
chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO+1, Thread1, NULL);
/*
* Normal main() thread activity, in this demo it does nothing except
* sleeping in a loop and check the button state.
*/
while (true) {
if (palReadLine(LINE_BUTTON_USER)) {
test_execute((BaseSequentialStream *)&SD6, &rt_test_suite);
test_execute((BaseSequentialStream *)&SD6, &oslib_test_suite);
}
chThdSleepMilliseconds(500);
}
}
三、程序运行
将编译生成的ch.hex文件下载到开发板运行
按下B1按键,串口输出,运行视频如下:
chibios