AT32F423-RTOS 建立过程(二) [SES&rtthread3.1.5]

将rt-thread 文件夹copy到工程路径中

在工程中添加文件夹

添加文件

开始F7

#error Please uncomment the line <#include "finsh_config.h"> in the rtconfig.h

 Output/Debug/Obj/AT32F423_SES_Rtthread_Nano_GCC/context_gcc.o: in function `HardFault_Handler':

 Output/Debug/Obj/AT32F423_SES_Rtthread_Nano_GCC/context_gcc.o: in function `PendSV_Handler':

我直接在工程中移除at32f423_int.c 文件,因为有几个中断函数和rtthread冲突了

然后,打开AT32F423_SES_Rtthread_Nano_GCC\WorkBench\libraries\cmsis\cm4\device_support\startup\gcc\startup_at32f423.s,找到  bl main 这一行,把main改为entry

F7,继续找问题

咱们把main函数中初始化部分的函数放这里进行初始化。记得把头文件写上#include "at32f423_wk_config.h"

F7

闪灯

/* add user code begin Header */
/**
  **************************************************************************
  * @file     main.c
  * @brief    main program
  **************************************************************************
  *                       Copyright notice & Disclaimer
  *
  * The software Board Support Package (BSP) that is made available to
  * download from Artery official website is the copyrighted work of Artery.
  * Artery authorizes customers to use, copy, and distribute the BSP
  * software and its related documentation for the purpose of design and
  * development in conjunction with Artery microcontrollers. Use of the
  * software is governed by this copyright notice and the following disclaimer.
  *
  * THIS SOFTWARE IS PROVIDED ON "AS IS" BASIS WITHOUT WARRANTIES,
  * GUARANTEES OR REPRESENTATIONS OF ANY KIND. ARTERY EXPRESSLY DISCLAIMS,
  * TO THE FULLEST EXTENT PERMITTED BY LAW, ALL EXPRESS, IMPLIED OR
  * STATUTORY OR OTHER WARRANTIES, GUARANTEES OR REPRESENTATIONS,
  * INCLUDING BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
  *
  **************************************************************************
  */
/* add user code end Header */

/* Includes ------------------------------------------------------------------*/
#include "at32f423_wk_config.h"

/* private includes ----------------------------------------------------------*/
/* add user code begin private includes */
#include "rtthread.h"
/* add user code end private includes */

/* private typedef -----------------------------------------------------------*/
/* add user code begin private typedef */

/* add user code end private typedef */

/* private define ------------------------------------------------------------*/
/* add user code begin private define */

/* add user code end private define */

/* private macro -------------------------------------------------------------*/
/* add user code begin private macro */

/* add user code end private macro */

/* private variables ---------------------------------------------------------*/
/* add user code begin private variables */

/* add user code end private variables */

/* private function prototypes --------------------------------------------*/
/* add user code begin function prototypes */

/* add user code end function prototypes */

/* private user code ---------------------------------------------------------*/
/* add user code begin 0 */

/* add user code end 0 */


/**
  * @brief  take some delay for waiting power stable, delay is about 60ms with frequency 8MHz.
  * @param  none
  * @retval none
  */
static void wk_wait_for_power_stable(void)
{
  volatile uint32_t delay = 0;
  for(delay = 0; delay < 50000; delay++);
}

/**
  * @brief main function.
  * @param  none
  * @retval none
  */
int main(void)
{
  /* add user code begin 1 */

  /* add user code end 1 */

  /* add a necessary delay to ensure that Vdd is higher than the operating
     voltage of battery powered domain (2.57V) when the battery powered 
     domain is powered on for the first time and being operated. */
  //wk_wait_for_power_stable();
  
  ///* system clock config. */
  //wk_system_clock_config();

  ///* config periph clock. */
  //wk_periph_clock_config();

  ///* nvic config. */
  //wk_nvic_config();

  ///* init gpio function. */
  //wk_gpio_config();

  /* add user code begin 2 */

  /* add user code end 2 */

  while(1)
  {
    /* add user code begin 3 */
rt_thread_mdelay(500);
gpio_bits_reset(RUNLED_GPIO_PORT,RUNLED_PIN);
rt_thread_mdelay(500);
gpio_bits_set(RUNLED_GPIO_PORT,RUNLED_PIN);
    /* add user code end 3 */
  }
}

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值