2021-09-11 10:51:08 索煒達(dá)電子 908
項(xiàng)目編號(hào):E1030
文件大?。?..8M
源碼說(shuō)明:帶中文注釋
開(kāi)發(fā)環(huán)境:uCOS/III
簡(jiǎn)要概述:
我是學(xué)玩寄存器的, 這兩天學(xué)習(xí)UCOSIII, 但是沒(méi)有寄存器版本的UCOSIII源碼, 很尷尬,于是想移植一份寄存器版本的。按照正點(diǎn)原子視頻里的方法, 我成功移植了UCOS2, 但是對(duì)于UCOS3時(shí), 卻遇到了stm32f10x_conf.h未發(fā)現(xiàn)的問(wèn)題。以下為解決方法。
1, 準(zhǔn)備一份UCOS3擴(kuò)展例程和跑馬燈實(shí)驗(yàn)寄存器例程
2,拷貝擴(kuò)展例程里的 “UCOSIII” 至跑馬燈實(shí)驗(yàn)里
3,對(duì)比著兩個(gè)例程, 然后啥啥啥, (這步不知道叫啥, 上圖)
4, 對(duì)比著兩個(gè)例程,添加路徑
5, 之后編譯一下, 然后就出現(xiàn)了bsp.c 里的stm32f10x_conf.h不存在的問(wèn)題, 現(xiàn)在把它注釋掉, 出現(xiàn)了下圖中的編譯結(jié)果
RCC_ClocksTypeDef未定義, RCC_GetClocksFreq()未定義, 我們只要將這兩個(gè)東西的定義部分加入進(jìn)去, 問(wèn)題就解決了
1 首先, 對(duì)UCOS3源碼RCC_ClocksTypeDef go to definition , 復(fù)制定義部分至bsp.h 。 注意uint8之類的得替換成原始形式unsigned int
2 同樣操作, 復(fù)制RCC_GetClocksFreq()定義部分至bsp.h (挺長(zhǎng)的一段程序)。 編譯一下, 又爆了很多錯(cuò)
錯(cuò)誤大致分三類
RCC
CFGR_SW_Mask, CFGR_HPRE_Set_Mask...........
APBAHBPrescTable[16]........
3, 不慌, 先看rcc , RCC定義于stm32f10x.h里, 把它include就好了 。就是在#include <bsp.h>下面加上#include <stm32f10x.h>, 不附圖了。
4, CFGR_SW_Mask 都是一些地址定義,從UCOS源碼里整個(gè)復(fù)制到bsp.h里就行。
5,最后的APBAHBPrescTable[], 同樣操作, 注意___I 和uint8 需要替換
6, 編譯 ,0 err, 0 warning
7 替換tes.c , 把main函數(shù)里有關(guān)庫(kù)函數(shù)的操作換成寄存器的, 將sys.c里 SYSTEM_SUPPORT_OS 置 1 ;下載程序,
目錄│文件列表:
└ UCOS2&3移植F103寄存器
├ UCOSIII移植F103ZET6寄存器測(cè)試
│ │ keilkill.bat
│ │ README.TXT
│ ├ FWLIB
│ │ └ STM32F10x_FWLib
│ │ ├ inc
│ │ │ │ misc.h
│ │ │ │ stm32f10x_adc.h
│ │ │ │ stm32f10x_bkp.h
│ │ │ │ stm32f10x_can.h
│ │ │ │ stm32f10x_cec.h
│ │ │ │ stm32f10x_crc.h
│ │ │ │ stm32f10x_dac.h
│ │ │ │ stm32f10x_dbgmcu.h
│ │ │ │ stm32f10x_dma.h
│ │ │ │ stm32f10x_exti.h
│ │ │ │ stm32f10x_flash.h
│ │ │ │ stm32f10x_fsmc.h
│ │ │ │ stm32f10x_gpio.h
│ │ │ │ stm32f10x_i2c.h
│ │ │ │ stm32f10x_iwdg.h
│ │ │ │ stm32f10x_pwr.h
│ │ │ │ stm32f10x_rcc.h
│ │ │ │ stm32f10x_rtc.h
│ │ │ │ stm32f10x_sdio.h
│ │ │ │ stm32f10x_spi.h
│ │ │ │ stm32f10x_tim.h
│ │ │ │ stm32f10x_usart.h
│ │ │ └ stm32f10x_wwdg.h
│ │ └ src
│ │ │ misc.c
│ │ │ stm32f10x_adc.c
│ │ │ stm32f10x_bkp.c
│ │ │ stm32f10x_can.c
│ │ │ stm32f10x_cec.c
│ │ │ stm32f10x_crc.c
│ │ │ stm32f10x_dac.c
│ │ │ stm32f10x_dbgmcu.c
│ │ │ stm32f10x_dma.c
│ │ │ stm32f10x_exti.c
│ │ │ stm32f10x_flash.c
│ │ │ stm32f10x_fsmc.c
│ │ │ stm32f10x_gpio.c
│ │ │ stm32f10x_i2c.c
│ │ │ stm32f10x_iwdg.c
│ │ │ stm32f10x_pwr.c
│ │ │ stm32f10x_rcc.c
│ │ │ stm32f10x_rtc.c
│ │ │ stm32f10x_sdio.c
│ │ │ stm32f10x_spi.c
│ │ │ stm32f10x_tim.c
│ │ │ stm32f10x_usart.c
│ │ └ stm32f10x_wwdg.c
│ ├ HARDWARE
│ │ └ LED
│ │ │ led.c
│ │ └ led.h
│ ├ OBJ
│ │ │ bsp.crf
│ │ │ bsp.d
│ │ │ bsp.o
│ │ │ cpu_a.d
│ │ │ cpu_a.lst
│ │ │ cpu_a.o
│ │ │ cpu_c.crf
│ │ │ cpu_c.d
│ │ │ cpu_c.o
│ │ │ cpu_core.crf
│ │ │ cpu_core.d
│ │ │ cpu_core.o
│ │ │ delay.crf
│ │ │ delay.d
│ │ │ delay.o
│ │ │ led.crf
│ │ │ led.d
│ │ │ led.o
│ │ │ lib_ascii.crf
│ │ │ lib_ascii.d
│ │ │ lib_ascii.o
│ │ │ lib_math.crf
│ │ │ lib_math.d
│ │ │ lib_math.o
│ │ │ lib_mem.crf
│ │ │ lib_mem.d
│ │ │ lib_mem.o
│ │ │ lib_mem_a.d
│ │ │ lib_mem_a.lst
│ │ │ lib_mem_a.o
│ │ │ lib_str.crf
│ │ │ lib_str.d
│ │ │ lib_str.o
│ │ │ misc.crf
│ │ │ misc.d
│ │ │ misc.o
│ │ │ os_app_hooks.crf
│ │ │ os_app_hooks.d
│ │ │ os_app_hooks.o