当前位置:   article > 正文

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

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

闪灯

  1. /* add user code begin Header */
  2. /**
  3. **************************************************************************
  4. * @file main.c
  5. * @brief main program
  6. **************************************************************************
  7. * Copyright notice & Disclaimer
  8. *
  9. * The software Board Support Package (BSP) that is made available to
  10. * download from Artery official website is the copyrighted work of Artery.
  11. * Artery authorizes customers to use, copy, and distribute the BSP
  12. * software and its related documentation for the purpose of design and
  13. * development in conjunction with Artery microcontrollers. Use of the
  14. * software is governed by this copyright notice and the following disclaimer.
  15. *
  16. * THIS SOFTWARE IS PROVIDED ON "AS IS" BASIS WITHOUT WARRANTIES,
  17. * GUARANTEES OR REPRESENTATIONS OF ANY KIND. ARTERY EXPRESSLY DISCLAIMS,
  18. * TO THE FULLEST EXTENT PERMITTED BY LAW, ALL EXPRESS, IMPLIED OR
  19. * STATUTORY OR OTHER WARRANTIES, GUARANTEES OR REPRESENTATIONS,
  20. * INCLUDING BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
  21. * FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
  22. *
  23. **************************************************************************
  24. */
  25. /* add user code end Header */
  26. /* Includes ------------------------------------------------------------------*/
  27. #include "at32f423_wk_config.h"
  28. /* private includes ----------------------------------------------------------*/
  29. /* add user code begin private includes */
  30. #include "rtthread.h"
  31. /* add user code end private includes */
  32. /* private typedef -----------------------------------------------------------*/
  33. /* add user code begin private typedef */
  34. /* add user code end private typedef */
  35. /* private define ------------------------------------------------------------*/
  36. /* add user code begin private define */
  37. /* add user code end private define */
  38. /* private macro -------------------------------------------------------------*/
  39. /* add user code begin private macro */
  40. /* add user code end private macro */
  41. /* private variables ---------------------------------------------------------*/
  42. /* add user code begin private variables */
  43. /* add user code end private variables */
  44. /* private function prototypes --------------------------------------------*/
  45. /* add user code begin function prototypes */
  46. /* add user code end function prototypes */
  47. /* private user code ---------------------------------------------------------*/
  48. /* add user code begin 0 */
  49. /* add user code end 0 */
  50. /**
  51. * @brief take some delay for waiting power stable, delay is about 60ms with frequency 8MHz.
  52. * @param none
  53. * @retval none
  54. */
  55. static void wk_wait_for_power_stable(void)
  56. {
  57. volatile uint32_t delay = 0;
  58. for(delay = 0; delay < 50000; delay++);
  59. }
  60. /**
  61. * @brief main function.
  62. * @param none
  63. * @retval none
  64. */
  65. int main(void)
  66. {
  67. /* add user code begin 1 */
  68. /* add user code end 1 */
  69. /* add a necessary delay to ensure that Vdd is higher than the operating
  70. voltage of battery powered domain (2.57V) when the battery powered
  71. domain is powered on for the first time and being operated. */
  72. //wk_wait_for_power_stable();
  73. ///* system clock config. */
  74. //wk_system_clock_config();
  75. ///* config periph clock. */
  76. //wk_periph_clock_config();
  77. ///* nvic config. */
  78. //wk_nvic_config();
  79. ///* init gpio function. */
  80. //wk_gpio_config();
  81. /* add user code begin 2 */
  82. /* add user code end 2 */
  83. while(1)
  84. {
  85. /* add user code begin 3 */
  86. rt_thread_mdelay(500);
  87. gpio_bits_reset(RUNLED_GPIO_PORT,RUNLED_PIN);
  88. rt_thread_mdelay(500);
  89. gpio_bits_set(RUNLED_GPIO_PORT,RUNLED_PIN);
  90. /* add user code end 3 */
  91. }
  92. }

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/从前慢现在也慢/article/detail/67518
推荐阅读
相关标签
  

闽ICP备14008679号