【E1030】uCOS/III移植到F103ZET6寄存器版本成功

2021-09-11 10:51:08      索炜达电子      557     

项目编号:E1030

文件大小:5..8M

源码说明:带中文注释

开发环境:uCOS/III

简要概述:

我是学玩寄存器的, 这两天学习UCOSIII, 但是没有寄存器版本的UCOSIII源码, 很尴尬,于是想移植一份寄存器版本的。按照正点原子视频里的方法, 我成功移植了UCOS2, 但是对于UCOS3时, 却遇到了stm32f10x_conf.h未发现的问题。以下为解决方法。

1, 准备一份UCOS3扩展例程和跑马灯实验寄存器例程

【E1030】uCOS/III移植到F103ZET6寄存器版本成功

2,拷贝扩展例程里的  “UCOSIII”  至跑马灯实验里

【E1030】uCOS/III移植到F103ZET6寄存器版本成功

3,对比着两个例程, 然后啥啥啥, (这步不知道叫啥, 上图)

【E1030】uCOS/III移植到F103ZET6寄存器版本成功

4, 对比着两个例程,添加路径

【E1030】uCOS/III移植到F103ZET6寄存器版本成功

5, 之后编译一下, 然后就出现了bsp.c 里的stm32f10x_conf.h不存在的问题, 现在把它注释掉, 出现了下图中的编译结果

【E1030】uCOS/III移植到F103ZET6寄存器版本成功

RCC_ClocksTypeDef未定义, RCC_GetClocksFreq()未定义, 我们只要将这两个东西的定义部分加入进去, 问题就解决了

1 首先, 对UCOS3源码RCC_ClocksTypeDef go to definition , 复制定义部分至bsp.h 。 注意uint8之类的得替换成原始形式unsigned int

【E1030】uCOS/III移植到F103ZET6寄存器版本成功

2 同样操作, 复制RCC_GetClocksFreq()定义部分至bsp.h (挺长的一段程序)。 编译一下, 又爆了很多错

错误大致分三类      

RCC

CFGR_SW_Mask, CFGR_HPRE_Set_Mask...........

APBAHBPrescTable[16]........

【E1030】uCOS/III移植到F103ZET6寄存器版本成功

3, 不慌, 先看rcc , RCC定义于stm32f10x.h里, 把它include就好了 。就是在#include  <bsp.h>下面加上#include  <stm32f10x.h>, 不附图了。

4, CFGR_SW_Mask 都是一些地址定义,从UCOS源码里整个复制到bsp.h里就行。

【E1030】uCOS/III移植到F103ZET6寄存器版本成功

5,最后的APBAHBPrescTable[], 同样操作, 注意___I 和uint8 需要替换

【E1030】uCOS/III移植到F103ZET6寄存器版本成功

6, 编译 ,0 err, 0 warning

7  替换tes.c , 把main函数里有关库函数的操作换成寄存器的, 将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

TAGuCOS/III
  • 3 次
  • 1 分