2021-09-11 10:51:08 索煒達電子 902
項目編號:E1030
文件大?。?..8M
源碼說明:帶中文注釋
開發(fā)環(huán)境:uCOS/III
簡要概述:
我是學玩寄存器的, 這兩天學習UCOSIII, 但是沒有寄存器版本的UCOSIII源碼, 很尷尬,于是想移植一份寄存器版本的。按照正點原子視頻里的方法, 我成功移植了UCOS2, 但是對于UCOS3時, 卻遇到了stm32f10x_conf.h未發(fā)現(xiàn)的問題。以下為解決方法。
1, 準備一份UCOS3擴展例程和跑馬燈實驗寄存器例程
2,拷貝擴展例程里的 “UCOSIII” 至跑馬燈實驗里
3,對比著兩個例程, 然后啥啥啥, (這步不知道叫啥, 上圖)
4, 對比著兩個例程,添加路徑
5, 之后編譯一下, 然后就出現(xiàn)了bsp.c 里的stm32f10x_conf.h不存在的問題, 現(xiàn)在把它注釋掉, 出現(xiàn)了下圖中的編譯結果
RCC_ClocksTypeDef未定義, RCC_GetClocksFreq()未定義, 我們只要將這兩個東西的定義部分加入進去, 問題就解決了
1 首先, 對UCOS3源碼RCC_ClocksTypeDef go to definition , 復制定義部分至bsp.h 。 注意uint8之類的得替換成原始形式unsigned int
2 同樣操作, 復制RCC_GetClocksFreq()定義部分至bsp.h (挺長的一段程序)。 編譯一下, 又爆了很多錯
錯誤大致分三類
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源碼里整個復制到bsp.h里就行。
5,最后的APBAHBPrescTable[], 同樣操作, 注意___I 和uint8 需要替換
6, 編譯 ,0 err, 0 warning
7 替換tes.c , 把main函數(shù)里有關庫函數(shù)的操作換成寄存器的, 將sys.c里 SYSTEM_SUPPORT_OS 置 1 ;下載程序,
目錄│文件列表:
└ UCOS2&3移植F103寄存器
├ UCOSIII移植F103ZET6寄存器測試
│ │ 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