/****移植ucosii到LPC1788****/
步骤一:下载ucosii2.86源码
步骤二:建立工程,添加源码到工程
步骤三:添加Flash.ini 到工程
选项卡的Debug项,Initialization File 增加Flash.ini文件
选项卡的Linker项,Scatter File 添加flash.scat文件
步骤四:添加如下文件到工程
\cmsis
init.s
verctors.s
system_LPC177x_8x.c
system_LPC177x_8x.h
LPC177x_8x.h
Flash.ini
flash.scat
\drives
lpc177x_8x_clkpwr.c
lpc177x_8x_systick.c
\bsp
bsp.c
bsp.h
\app
main.c
app_cfg.h
os_cfg.h
\uCOSII_cpu
cpu_a.asm
cpu_c.c
os_cpu_a.asm
os_cpu_c.c
cpu.h
os_cpu_c.c
\uCOSII
...
步骤五:添加路径,编译即可。会有一个告警,不用理会。
注:使用的环境是:V4.14.4.0
编者:张永辉 2013年5月30日
;******************************************************************************
; SCATTER LOADING DESCRIPTION
; ARM
; KEIL's uVision3
; (RealView Microprocessor Developer Kit)
; Filename : STM32_Flash.scat
;******************************************************************************
LR_IROM1 0x00000000 0x00080000 ;; Load region
{
ER_IROM1 0x00000000 0x00080000
{
vectors.o (VECT, +First)
init.o (INIT)
* (+RO)
}
RW_IRAM1 0x10000000 0x00010000
{
* (+RW,+ZI)
} ;; The following declarations select the "two region model" ;
;; A default __user_initial_stackheap() will be used ;
ARM_LIB_HEAP 0x1000f700 EMPTY 0x00000400 {}
ARM_LIB_STACK 0x1000ff00 EMPTY -0x00000400 {}
}
/******************************************************************************/
/* RAM.INI: RAM Initialization File */
/* 文件: Flash.ini
/******************************************************************************/
// <<< Use Configuration Wizard in Context Menu >>> //
/******************************************************************************/
/* This file is part of the uVision/ARM development tools. */
/* Copyright (c) 2005-2008 Keil Software. All rights reserved. */
/* This software may only be used under the terms of a valid, current, */
/* end user licence from KEIL for a compatible version of KEIL software */
/* development tools. Nothing else gives you the right to use this software. */
/******************************************************************************/
FUNC void Setup (void) {
SP = _RDWORD(0x00000000); // Setup Stack Pointer
PC = _RDWORD(0x00000004); // Setup Program Counter
_WDWORD(0xE000ED08, 0x00000000); // Setup Vector Table Offset Register
}
LOAD IFlash\ucos_lpc1788.axf INCREMENTAL // Download
Setup(); // Setup for Running
;******************************************************************************
; INTERRUPT VECTORS
; ARM
; KEIL's uVision3
; Filename : vectors.s
;******************************************************************************
PRESERVE8
AREA VECT, CODE, READONLY ; Name this block of code ;
THUMB
ENTRY
;******************************************************************************
; IMPORTS
;******************************************************************************
IMPORT OS_CPU_SysTickHandler
IMPORT OS_CPU_PendSVHandler
IMPORT WDT_IRQHandler ; 16: WatchDog
IMPORT TIMER0_IRQHandler ; 17: Timer0
IMPORT TIMER1_IRQHandler ; 18: Timer1
IMPORT TIMER2_IRQHandler ; 19: Timer2
IMPORT TIMER3_IRQHandler ; 20: Timer3
IMPORT UART0_IRQHandler ; 21: UART0
IMPORT UART1_IRQHandler ; 22: UART1
IMPORT UART2_IRQHandler ; 23: UART2
IMPORT UART3_IRQHandler ; 24: UART3
IMPORT PWM1_IRQHandler ; 25: PWM1
IMPORT I2C0_IRQHandler ; 26: I2C0
IMPORT I2C1_IRQHandler ; 27: I2C1
IMPORT I2C2_IRQHandler ; 28: I2C2
IMPORT SPI_IRQHandler ; 29: SPI
IMPORT SSP0_IRQHandler ; 30: SSP0
IMPORT SSP1_IRQHandler ; 31: SSP1
IMPORT PLL0_IRQHandler ; 32: PLL0 Lock (Main PLL)
IMPORT RTC_IRQHandler ; 33: Real Time Clock
IMPORT EINT0_IRQHandler ; 34: External Interrupt 0
IMPORT EINT1_IRQHandler ; 35: External Interrupt 1
IMPORT EINT2_IRQHandler ; 36: External Interrupt 2
IMPORT EINT3_IRQHandler ; 37: External Interrupt 3
IMPORT ADC_IRQHandler ; 38: A/D Converter
IMPORT BOD_IRQHandler ; 39: Brown-Out Detect
IMPORT USB_IRQHandler ; 40: USB
IMPORT CAN_IRQHandler ; 41: CAN
IMPORT DMA_IRQHandler ; 42: General Purpose DMA
IMPORT I2S_IRQHandler ; 43: I2S
IMPORT ENET_IRQHandler ; 44: Ethernet
IMPORT RIT_IRQHandler ; 45: Repetitive Interrupt Timer
IMPORT MCPWM_IRQHandler ; 46: Motor Control PWM
IMPORT QEI_IRQHandler ; 47: Quadrature Encoder Interface
IMPORT PLL1_IRQHandler ; 48: PLL1 Lock (USB PLL)
IMPORT USBActivity_IRQHandler ; 49: USB Activity interrupt to wakeup
IMPORT CANActivity_IRQHandler ; 50: CAN Activity interrupt to wakeup
IMPORT UART4_IRQHandler ; 51: UART4
IMPORT SSP2_IRQHandler ; 52: SSP2
IMPORT LCD_IRQHandler ; 53: LCD
IMPORT GPIO_IRQHandler ; 54: GPIO
IMPORT PWM0_IRQHandler ; 55: PWM0
IMPORT EEPROM_IRQHandler ; 56: EEPROM
IMPORT ResetHndlr
; Import stack limit from scatter-loading file ;
IMPORT ||Image$$ARM_LIB_STACK$$ZI$$Limit||
;******************************************************************************
; INITIALIZE EXCEPTION VECTORS
;******************************************************************************
Vectors
DCD ||Image$$ARM_LIB_STACK$$ZI$$Limit|| ; 0, SP start value.
DCD ResetHndlr ; 1, PC start value.
DCD App_NMI_ISR ; 2, NMI
DCD App_Fault_ISR ; 3, Hard Fault
DCD App_MemFault_ISR ; 4, Memory Management
DCD App_BusFault_ISR ; 5, Bus Fault
DCD App_UsageFault_ISR ; 6, Usage Fault
DCD 0 ; 7, Reserved
DCD 0 ; 8, Reserved
DCD 0 ; 9, Reserved
DCD 0 ; 10, Reserved
DCD App_Spurious_ISR ; 11, SVCall
DCD App_Spurious_ISR ; 12, Debug Monitor
DCD App_Spurious_ISR ; 13, Reserved
DCD OS_CPU_PendSVHandler ; 14, PendSV Handler
DCD OS_CPU_SysTickHandler ; 15, uC/OS-II Tick ISR Handler
; External Interrupts
DCD WDT_IRQHandler ; 16: Watchdog Timer
DCD TIMER0_IRQHandler ; 17: Timer0
DCD TIMER1_IRQHandler ; 18: Timer1
DCD TIMER2_IRQHandler ; 19: Timer2
DCD TIMER3_IRQHandler ; 20: Timer3
DCD UART0_IRQHandler ; 21: UART0
DCD UART1_IRQHandler ; 22: UART1
DCD UART2_IRQHandler ; 23: UART2
DCD UART3_IRQHandler ; 24: UART3
DCD PWM1_IRQHandler ; 25: PWM1
DCD I2C0_IRQHandler ; 26: I2C0
DCD I2C1_IRQHandler ; 27: I2C1
DCD I2C2_IRQHandler ; 28: I2C2
DCD SPI_IRQHandler ; 29: SPI
DCD SSP0_IRQHandler ; 30: SSP0
DCD SSP1_IRQHandler ; 31: SSP1
DCD PLL0_IRQHandler ; 32: PLL0 Lock (Main PLL)
DCD RTC_IRQHandler ; 33: Real Time Clock
DCD EINT0_IRQHandler ; 34: External Interrupt 0
DCD EINT1_IRQHandler ; 35: External Interrupt 1
DCD EINT2_IRQHandler ; 36: External Interrupt 2
DCD EINT3_IRQHandler ; 37: External Interrupt 3
DCD ADC_IRQHandler ; 38: A/D Converter
DCD BOD_IRQHandler ; 39: Brown-Out Detect
DCD USB_IRQHandler ; 40: USB
DCD CAN_IRQHandler ; 41: CAN
DCD DMA_IRQHandler ; 42: General Purpose DMA
DCD I2S_IRQHandler ; 43: I2S
DCD ENET_IRQHandler ; 44: Ethernet
DCD RIT_IRQHandler ; 45: Repetitive Interrupt Timer
DCD MCPWM_IRQHandler ; 46: Motor Control PWM
DCD QEI_IRQHandler ; 47: Quadrature Encoder Interface
DCD PLL1_IRQHandler ; 48: PLL1 Lock (USB PLL)
DCD USBActivity_IRQHandler ; 49: USB Activity interrupt to wakeup
DCD CANActivity_IRQHandler ; 50: CAN Activity interrupt to wakeup
DCD UART4_IRQHandler ; 51: UART4
DCD SSP2_IRQHandler ; 52: SSP2
DCD LCD_IRQHandler ; 53: LCD
DCD GPIO_IRQHandler ; 54: GPIO
DCD PWM0_IRQHandler ; 55: PWM0
DCD EEPROM_IRQHandler ; 56: EEPROM
;******************************************************************************
; DEFAULT HANDLERS
;******************************************************************************
App_NMI_ISR B App_NMI_ISR
App_Fault_ISR B App_Fault_ISR
App_MemFault_ISR B App_MemFault_ISR
App_BusFault_ISR B App_BusFault_ISR
App_UsageFault_ISR B App_UsageFault_ISR
App_Spurious_ISR B App_Spurious_ISR
ALIGN
END