你的浏览器版本过低,可能导致网站不能正常访问!
为了你能正常使用网站功能,请使用这些浏览器。

STM32F723运行chibios系统

[复制链接]
TLLED 发布时间:2023-9-27 08:42

移植chibios系统到STM32F723开发板。

一、软件下载

1.1、chibios官网地址:

http://www.chibios.org/dokuwiki/doku.php

1.2、chibistudio开发软件

下载地址:https://nchc.dl.sourceforge.net/project/chibios/ChibiStudio%20Windows/ChibiStudio_Windows_2023-02.7z

将下载的软件解压到C盘

st001.png

点击Chibi_studio GCC图标即可打开软件

二、打开工程

2.1、打开工程

st002.png

这里面有的STM32开发型号的,可以直接打开运行,没有的型号,就需要自己创建功能。

2.2、STM32F723工程

已有的工程项目中没有找到STM32F723型号的开发板,就需要自己创建相应的型号,可以在已有型号比较接近的开发中,复制再修改。打开创建的STM32F723的工程。

st003.png

2.3、根据开发板硬件的接口,修改要测试端口。

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

2.4、编译项目

编译完成后,会生成ch.hex文件,可以烧写到开发板运行

st004.png

三、程序运行

烧写到开发板后,复位开发板运行

LD5和LD6轮询点亮。

按下按键B1,串口输出

st005.png

收藏 评论2 发布时间:2023-9-27 08:42

举报

2个回答
STMCU-管管 回答时间:2023-9-27 14:32:57
不错的分享
. g: X. W6 {1 R0 L
STMCU-管管 回答时间:2023-9-27 14:33:07

再接再厉

关于意法半导体
我们是谁
投资者关系
意法半导体可持续发展举措
创新和工艺
招聘信息
联系我们
联系ST分支机构
寻找销售人员和分销渠道
社区
媒体中心
活动与培训
隐私策略
隐私策略
Cookies管理
行使您的权利
关注我们
st-img 微信公众号
st-img 手机版