SyntaxHighlighter

2013年7月30日星期二

Port uCOS to SMT32F103C8

Port µC/OS-II V2.90 to SMT32F103C8

1. Download files

    Download official µC/OS-II V2.86 port for STM32F103RB from Micrium website.
    Download official µC/OS-II V2.90 source code from Micrium website.
    Download official SMT32F103C8 standard peripherals firmware library V3.50 from ST website.

2. Prepare folder and files.

  2.1 Create project_root folder as $ROOT.
  2.2 Create $ROOT\APP $ROOT\BSP $ROOT\CMSIS $ROOT\FWlib $ROOT\Project $ROOT\uCOS-II $ROOT\Output
  2.3 Copy $STM32F10x_StdPeriph_Lib_V3.5.0\Libraries\STM32F10x_StdPeriph_Driver\inc,src $ROOT\FWlib
        Copy  $STM32F10x_StdPeriph_Lib_V3.5.0\Libraries\CMSIS\CM3\CoreSupport\* $ROOT\CMSIS
        Copy $STM32F10x_StdPeriph_Lib_V3.5.0\Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x\*.h/c $ROOT\CMSIS
        Copy $STM32F10x_StdPeriph_Lib_V3.5.0\Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x\startup $ROOT\CMSIS\startup
  2.4 Copy $Micrium\Software\uCOS-II\Source to $ROOT/uCOS-II(V2.90)\Source\*.*(except ucos_ii.c) $ROOT\uCOS-II\Source
        Copy $Micrium\Software\uCOS-II\Source to $ROOT/uCOS-II(V2.86)\Ports\*.*(except os_dbg.c) $ROOT\uCOS-II\Ports
  2.5 Copy $STM32F10x_StdPeriph_Lib_V3.5.0\Project\STM32F10x_StdPeriph_Template\*.h/c $ROOT\APP
  2.6 Copy $Micrium\Software\uCOS-II\Source to $ROOT/uCOS-II(V2.90)\Source\os_cfg.h $ROOT\APP
        Copy Copy $Micrium\Software\uCOS-II\Source to $ROOT/uCOS-II(V2.90)\Source\os_dbg.c $ROOT\uCOS-II\Ports
  2.7 Create your BSP files in $ROOT\BSP
  2.8 Create app_cfg.h in $ROOT\APP

3. Create uVision project file in $ROOT\Project

  Add groups and add files
  Define: STM32F10X_MD, USE_STDPERIPH_DRIVER
  Include: ..\CMSIS;..\FWlib\inc;..\uCOS-II\Ports;..\uCOS-II\Source;..\BSP;..\APP

4. Modify files

os_cpu.h

#if OS_CRITICAL_METHOD == 3
OS_CPU_SR  OS_CPU_SR_Save(void);
void       OS_CPU_SR_Restore(OS_CPU_SR cpu_sr);
#endif

void       OSCtxSw(void);
void       OSIntCtxSw(void);
void       OSStartHighRdy(void);

// Interrupt handler
void       PendSV_Handler(void);
void       SysTick_Handler(void);

// system tick initializer
void       OS_CPU_SysTickInit(void);
#endif

os_cpu_a.asm

1. replace all GLOBAL to EXPORT
2. rename OS_CPU_PendSVHandler to PendSV_Handler
;********************************************************************************************************
;                                      CODE GENERATION DIRECTIVES
;********************************************************************************************************

;        RSEG CODE:CODE:NOROOT(2)
    AREA |.text|, CODE, READONLY, ALIGN=2
    THUMB
    REQUIRE8
    PRESERVE8

os_cpu_c.c

1. rename OS_CPU_SysTickHandler to SysTick_Handler
void  OS_CPU_SysTickInit (void)
{
    SysTick_Config(SystemCoreClock/OS_TICKS_PER_SEC);
}

stm32f10x_it.h/c

delete PendSV_Handler and SysTick_Handler

Write app_cfg.h os_cfg.h main.c stm32f10x_conf.h as your need.

---------------------------------END----------------------------

没有评论:

发表评论