本帖最后由 brother0952 于 2020-11-21 23:40 编辑
申请板子的时候,写了要移植rt-thread,弄了一半,发现这位大佬已经完成了。。。。我补充一点细节吧
向大佬致敬 https://bbs.21ic.com/icview-3045236-1-1.html。
一、环境:
autochip的官网 http://www.autochips.com/jk/MCU1/info_225.aspx?pid=531&typeid=225 下载 AutoChips.AC781x_DFP.1.1.0.pack,见下图
安装keil的rt-thread 支持包,见下图
二 建工程:
选择芯片 AC7811QBGE。
RTE 加载 rt-thread
三改文件:
board.c 顶部添加
- #include "system_ac78xx.h"
board.c 的 rt_hw_board_init 改为
- void rt_hw_board_init()
- {
- /* System Clock Update */
- //SystemCoreClockUpdate();
-
- /* System Tick Configuration */
- //_SysTick_Config(SystemCoreClock / RT_TICK_PER_SECOND);
- _SysTick_Config(SYSCLK_FREQ / RT_TICK_PER_SECOND);
- /* Call components board initial (use INIT_BOARD_EXPORT()) */
- #ifdef RT_USING_COMPONENTS_INIT
- rt_components_board_init();
- #endif
-
- #if defined(RT_USING_CONSOLE) && defined(RT_USING_DEVICE)
- rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
- #endif
-
- #if defined(RT_USING_USER_MAIN) && defined(RT_USING_HEAP)
- rt_system_heap_init(rt_heap_begin_get(), rt_heap_end_get());
- #endif
- }
添加main.c 文件,加入到工程中- #include "ac78xx.h"
- #include "ac78xx_debugout.h"
- #include <rtthread.h>
- #include "ac78xx_gpio.h"
- #define LED2 (GPIOB_OUT(9))
- #define LED3 (GPIOB_OUT(10))
-
- #define LED2_ON do{LED2 = 1;}while(0)
- #define LED2_OFF do{LED2 = 0;}while(0)
- #define LED2_TOGGLE do{LED2 = !LED2;}while(0)
-
- #define LED3_ON do{LED3 = 1;}while(0)
- #define LED3_OFF do{LED3 = 0;}while(0)
- #define LED3_TOGGLE do{LED3 = !LED3;}while(0)
- #define LED3_PIN (GPIO_PB10)
- typedef enum
- {
- GPIO_INPUT = 0,
- GPIO_OUTPUT = 1
- }GPIO_Dir_TypeDef;
- void GPIO_InitHardwr(void)
- {
- //GPIO_SetDir(LED2_PIN, GPIO_OUTPUT);
- GPIO_SetDir(LED3_PIN, GPIO_OUTPUT);
-
-
- LED2_OFF;
- LED3_OFF;
- }
- int main(void)
- {
- InitDebug();
- GPIO_InitHardwr();
- while(1)
- {
- rt_thread_mdelay(500);
- LED3_TOGGLE;
- printf("this is man func\r\n");
- }
- }
四运行:
附件:
my_rtt.zip
(57.6 KB, 下载次数: 14)
五后记:
国产芯片里面,杰发的文档真心做的不错,非常全。用起来非常舒心。
这个芯片是汽车级的, 民用级<工业级<汽车级<军工级 ,相当牛叉。
希望杰发越做越好,国产替代,迫在眉睫!
|