mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-02-08 03:03:07 +08:00
add the lpc43xx bsp support.
This commit is contained in:
93
bsp/lpc43xx/Libraries/CMSIS/Include/arm_common_tables.h
Normal file
93
bsp/lpc43xx/Libraries/CMSIS/Include/arm_common_tables.h
Normal file
@@ -0,0 +1,93 @@
|
||||
/* ----------------------------------------------------------------------
|
||||
* Copyright (C) 2010-2013 ARM Limited. All rights reserved.
|
||||
*
|
||||
* $Date: 17. January 2013
|
||||
* $Revision: V1.4.1
|
||||
*
|
||||
* Project: CMSIS DSP Library
|
||||
* Title: arm_common_tables.h
|
||||
*
|
||||
* Description: This file has extern declaration for common tables like Bitreverse, reciprocal etc which are used across different functions
|
||||
*
|
||||
* Target Processor: Cortex-M4/Cortex-M3
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* - Neither the name of ARM LIMITED nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
* -------------------------------------------------------------------- */
|
||||
|
||||
#ifndef _ARM_COMMON_TABLES_H
|
||||
#define _ARM_COMMON_TABLES_H
|
||||
|
||||
#include "arm_math.h"
|
||||
|
||||
extern const uint16_t armBitRevTable[1024];
|
||||
extern const q15_t armRecipTableQ15[64];
|
||||
extern const q31_t armRecipTableQ31[64];
|
||||
extern const q31_t realCoefAQ31[1024];
|
||||
extern const q31_t realCoefBQ31[1024];
|
||||
extern const float32_t twiddleCoef_16[32];
|
||||
extern const float32_t twiddleCoef_32[64];
|
||||
extern const float32_t twiddleCoef_64[128];
|
||||
extern const float32_t twiddleCoef_128[256];
|
||||
extern const float32_t twiddleCoef_256[512];
|
||||
extern const float32_t twiddleCoef_512[1024];
|
||||
extern const float32_t twiddleCoef_1024[2048];
|
||||
extern const float32_t twiddleCoef_2048[4096];
|
||||
extern const float32_t twiddleCoef_4096[8192];
|
||||
#define twiddleCoef twiddleCoef_4096
|
||||
extern const q31_t twiddleCoefQ31[6144];
|
||||
extern const q15_t twiddleCoefQ15[6144];
|
||||
extern const float32_t twiddleCoef_rfft_32[32];
|
||||
extern const float32_t twiddleCoef_rfft_64[64];
|
||||
extern const float32_t twiddleCoef_rfft_128[128];
|
||||
extern const float32_t twiddleCoef_rfft_256[256];
|
||||
extern const float32_t twiddleCoef_rfft_512[512];
|
||||
extern const float32_t twiddleCoef_rfft_1024[1024];
|
||||
extern const float32_t twiddleCoef_rfft_2048[2048];
|
||||
extern const float32_t twiddleCoef_rfft_4096[4096];
|
||||
|
||||
|
||||
#define ARMBITREVINDEXTABLE__16_TABLE_LENGTH ((uint16_t)20 )
|
||||
#define ARMBITREVINDEXTABLE__32_TABLE_LENGTH ((uint16_t)48 )
|
||||
#define ARMBITREVINDEXTABLE__64_TABLE_LENGTH ((uint16_t)56 )
|
||||
#define ARMBITREVINDEXTABLE_128_TABLE_LENGTH ((uint16_t)208 )
|
||||
#define ARMBITREVINDEXTABLE_256_TABLE_LENGTH ((uint16_t)440 )
|
||||
#define ARMBITREVINDEXTABLE_512_TABLE_LENGTH ((uint16_t)448 )
|
||||
#define ARMBITREVINDEXTABLE1024_TABLE_LENGTH ((uint16_t)1800)
|
||||
#define ARMBITREVINDEXTABLE2048_TABLE_LENGTH ((uint16_t)3808)
|
||||
#define ARMBITREVINDEXTABLE4096_TABLE_LENGTH ((uint16_t)4032)
|
||||
|
||||
extern const uint16_t armBitRevIndexTable16[ARMBITREVINDEXTABLE__16_TABLE_LENGTH];
|
||||
extern const uint16_t armBitRevIndexTable32[ARMBITREVINDEXTABLE__32_TABLE_LENGTH];
|
||||
extern const uint16_t armBitRevIndexTable64[ARMBITREVINDEXTABLE__64_TABLE_LENGTH];
|
||||
extern const uint16_t armBitRevIndexTable128[ARMBITREVINDEXTABLE_128_TABLE_LENGTH];
|
||||
extern const uint16_t armBitRevIndexTable256[ARMBITREVINDEXTABLE_256_TABLE_LENGTH];
|
||||
extern const uint16_t armBitRevIndexTable512[ARMBITREVINDEXTABLE_512_TABLE_LENGTH];
|
||||
extern const uint16_t armBitRevIndexTable1024[ARMBITREVINDEXTABLE1024_TABLE_LENGTH];
|
||||
extern const uint16_t armBitRevIndexTable2048[ARMBITREVINDEXTABLE2048_TABLE_LENGTH];
|
||||
extern const uint16_t armBitRevIndexTable4096[ARMBITREVINDEXTABLE4096_TABLE_LENGTH];
|
||||
|
||||
#endif /* ARM_COMMON_TABLES_H */
|
||||
7306
bsp/lpc43xx/Libraries/CMSIS/Include/arm_math.h
Normal file
7306
bsp/lpc43xx/Libraries/CMSIS/Include/arm_math.h
Normal file
File diff suppressed because it is too large
Load Diff
682
bsp/lpc43xx/Libraries/CMSIS/Include/core_cm0.h
Normal file
682
bsp/lpc43xx/Libraries/CMSIS/Include/core_cm0.h
Normal file
File diff suppressed because it is too large
Load Diff
793
bsp/lpc43xx/Libraries/CMSIS/Include/core_cm0plus.h
Normal file
793
bsp/lpc43xx/Libraries/CMSIS/Include/core_cm0plus.h
Normal file
File diff suppressed because it is too large
Load Diff
1627
bsp/lpc43xx/Libraries/CMSIS/Include/core_cm3.h
Normal file
1627
bsp/lpc43xx/Libraries/CMSIS/Include/core_cm3.h
Normal file
File diff suppressed because it is too large
Load Diff
1772
bsp/lpc43xx/Libraries/CMSIS/Include/core_cm4.h
Normal file
1772
bsp/lpc43xx/Libraries/CMSIS/Include/core_cm4.h
Normal file
File diff suppressed because it is too large
Load Diff
673
bsp/lpc43xx/Libraries/CMSIS/Include/core_cm4_simd.h
Normal file
673
bsp/lpc43xx/Libraries/CMSIS/Include/core_cm4_simd.h
Normal file
File diff suppressed because it is too large
Load Diff
636
bsp/lpc43xx/Libraries/CMSIS/Include/core_cmFunc.h
Normal file
636
bsp/lpc43xx/Libraries/CMSIS/Include/core_cmFunc.h
Normal file
File diff suppressed because it is too large
Load Diff
688
bsp/lpc43xx/Libraries/CMSIS/Include/core_cmInstr.h
Normal file
688
bsp/lpc43xx/Libraries/CMSIS/Include/core_cmInstr.h
Normal file
File diff suppressed because it is too large
Load Diff
813
bsp/lpc43xx/Libraries/CMSIS/Include/core_sc000.h
Normal file
813
bsp/lpc43xx/Libraries/CMSIS/Include/core_sc000.h
Normal file
File diff suppressed because it is too large
Load Diff
1598
bsp/lpc43xx/Libraries/CMSIS/Include/core_sc300.h
Normal file
1598
bsp/lpc43xx/Libraries/CMSIS/Include/core_sc300.h
Normal file
File diff suppressed because it is too large
Load Diff
34895
bsp/lpc43xx/Libraries/Device/NXP/LPC43xx/Include/LPC43xx.h
Normal file
34895
bsp/lpc43xx/Libraries/Device/NXP/LPC43xx/Include/LPC43xx.h
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,33 @@
|
||||
/***********************************************************************
|
||||
* $Id: fpu_enable.h
|
||||
*
|
||||
* Project: LPC43xx
|
||||
*
|
||||
* Description: fpu initialization routine header
|
||||
*
|
||||
* Copyright(C) 2011, NXP Semiconductor
|
||||
* All rights reserved.
|
||||
*
|
||||
***********************************************************************
|
||||
* Software that is described herein is for illustrative purposes only
|
||||
* which provides customers with programming information regarding the
|
||||
* products. This software is supplied "AS IS" without any warranties.
|
||||
* NXP Semiconductors assumes no responsibility or liability for the
|
||||
* use of the software, conveys no license or title under any patent,
|
||||
* copyright, or mask work right to the product. NXP Semiconductors
|
||||
* reserves the right to make changes in the software without
|
||||
* notification. NXP Semiconductors also make no representation or
|
||||
* warranty that such application will be suitable for the specified
|
||||
* use without further testing or modification.
|
||||
**********************************************************************/
|
||||
|
||||
#ifndef __FPU_ENABLE_H
|
||||
#define __FPU_ENABLE_H
|
||||
|
||||
#if defined(__ARMCC_VERSION)
|
||||
void fpuEnable(void) __attribute__ ((section("BOOTSTRAP_CODE")));
|
||||
#else
|
||||
extern void fpuEnable(void);
|
||||
#endif
|
||||
|
||||
#endif /* __FPU_ENABLE_H */
|
||||
29
bsp/lpc43xx/Libraries/Device/NXP/LPC43xx/Include/fpu_init.h
Normal file
29
bsp/lpc43xx/Libraries/Device/NXP/LPC43xx/Include/fpu_init.h
Normal file
@@ -0,0 +1,29 @@
|
||||
/***********************************************************************
|
||||
* $Id: fpu_init.h
|
||||
*
|
||||
* Project: LPC43xx
|
||||
*
|
||||
* Description: fpu initialization routine header
|
||||
*
|
||||
* Copyright(C) 2011, NXP Semiconductor
|
||||
* All rights reserved.
|
||||
*
|
||||
***********************************************************************
|
||||
* Software that is described herein is for illustrative purposes only
|
||||
* which provides customers with programming information regarding the
|
||||
* products. This software is supplied "AS IS" without any warranties.
|
||||
* NXP Semiconductors assumes no responsibility or liability for the
|
||||
* use of the software, conveys no license or title under any patent,
|
||||
* copyright, or mask work right to the product. NXP Semiconductors
|
||||
* reserves the right to make changes in the software without
|
||||
* notification. NXP Semiconductors also make no representation or
|
||||
* warranty that such application will be suitable for the specified
|
||||
* use without further testing or modification.
|
||||
**********************************************************************/
|
||||
|
||||
#ifndef __FPU_INIT_H
|
||||
#define __FPU_INIT_H
|
||||
|
||||
void fpuInit(void);
|
||||
|
||||
#endif /* __FPU_INIT_H */
|
||||
@@ -0,0 +1,50 @@
|
||||
/**********************************************************************
|
||||
* $Id$ system_lpc43xx.h 2011-06-02
|
||||
*//**
|
||||
* @file system_lpc43xx.h
|
||||
* @brief Cortex-M3 Device System Header File for NXP lpc43xx Series.
|
||||
* @version 1.0
|
||||
* @date 02. June. 2011
|
||||
* @author NXP MCU SW Application Team
|
||||
*
|
||||
* Copyright(C) 2011, NXP Semiconductor
|
||||
* All rights reserved.
|
||||
*
|
||||
***********************************************************************
|
||||
* Software that is described herein is for illustrative purposes only
|
||||
* which provides customers with programming information regarding the
|
||||
* products. This software is supplied "AS IS" without any warranties.
|
||||
* NXP Semiconductors assumes no responsibility or liability for the
|
||||
* use of the software, conveys no license or title under any patent,
|
||||
* copyright, or mask work right to the product. NXP Semiconductors
|
||||
* reserves the right to make changes in the software without
|
||||
* notification. NXP Semiconductors also make no representation or
|
||||
* warranty that such application will be suitable for the specified
|
||||
* use without further testing or modification.
|
||||
**********************************************************************/
|
||||
|
||||
#ifndef __SYSTEM_lpc43xx_H
|
||||
#define __SYSTEM_lpc43xx_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */
|
||||
|
||||
/**
|
||||
* Initialize the system
|
||||
*
|
||||
* @param none
|
||||
* @return none
|
||||
*
|
||||
* @brief Setup the microcontroller system.
|
||||
* Initialize the System and update the SystemCoreClock variable.
|
||||
*/
|
||||
extern void SystemInit (void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __SYSTEM_lpc43xx_H */
|
||||
@@ -0,0 +1,339 @@
|
||||
;/***********************************************************************
|
||||
; * $Id: startup_LPC43xx.s 6473 2011-02-16 17:40:54Z nxp27266 $
|
||||
; *
|
||||
; * Project: LPC43xx CMSIS Package
|
||||
; *
|
||||
; * Description: Cortex-M3 Core Device Startup File for the NXP LPC43xx
|
||||
; * Device Series.
|
||||
; *
|
||||
; * Copyright(C) 2011, NXP Semiconductor
|
||||
; * All rights reserved.
|
||||
; *
|
||||
; * modified by KEIL
|
||||
; ***********************************************************************
|
||||
; * Software that is described herein is for illustrative purposes only
|
||||
; * which provides customers with programming information regarding the
|
||||
; * products. This software is supplied "AS IS" without any warranties.
|
||||
; * NXP Semiconductors assumes no responsibility or liability for the
|
||||
; * use of the software, conveys no license or title under any patent,
|
||||
; * copyright, or mask work right to the product. NXP Semiconductors
|
||||
; * reserves the right to make changes in the software without
|
||||
; * notification. NXP Semiconductors also make no representation or
|
||||
; * warranty that such application will be suitable for the specified
|
||||
; * use without further testing or modification.
|
||||
; **********************************************************************/
|
||||
|
||||
; <h> Stack Configuration
|
||||
; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
|
||||
; </h>
|
||||
|
||||
Stack_Size EQU 0x00000400
|
||||
|
||||
AREA STACK, NOINIT, READWRITE, ALIGN=3
|
||||
Stack_Mem SPACE Stack_Size
|
||||
__initial_sp
|
||||
|
||||
|
||||
; <h> Heap Configuration
|
||||
; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
|
||||
; </h>
|
||||
|
||||
Heap_Size EQU 0x00000200
|
||||
|
||||
AREA HEAP, NOINIT, READWRITE, ALIGN=3
|
||||
__heap_base
|
||||
Heap_Mem SPACE Heap_Size
|
||||
__heap_limit
|
||||
|
||||
PRESERVE8
|
||||
THUMB
|
||||
|
||||
; Vector Table Mapped to Address 0 at Reset
|
||||
|
||||
AREA RESET, DATA, READONLY
|
||||
EXPORT __Vectors
|
||||
|
||||
Sign_Value EQU 0x5A5A5A5A
|
||||
|
||||
__Vectors DCD __initial_sp ; 0 Top of Stack
|
||||
DCD Reset_Handler ; 1 Reset Handler
|
||||
DCD NMI_Handler ; 2 NMI Handler
|
||||
DCD HardFault_Handler ; 3 Hard Fault Handler
|
||||
DCD MemManage_Handler ; 4 MPU Fault Handler
|
||||
DCD BusFault_Handler ; 5 Bus Fault Handler
|
||||
DCD UsageFault_Handler ; 6 Usage Fault Handler
|
||||
DCD Sign_Value ; 7 Reserved
|
||||
DCD 0 ; 8 Reserved
|
||||
DCD 0 ; 9 Reserved
|
||||
DCD 0 ; 10 Reserved
|
||||
DCD SVC_Handler ; 11 SVCall Handler
|
||||
DCD DebugMon_Handler ; 12 Debug Monitor Handler
|
||||
DCD 0 ; 13 Reserved
|
||||
DCD PendSV_Handler ; 14 PendSV Handler
|
||||
DCD SysTick_Handler ; 15 SysTick Handler
|
||||
|
||||
; External Interrupts
|
||||
DCD DAC_IRQHandler ; 16 D/A Converter
|
||||
DCD M0CORE_IRQHandler ; 17 M0 Core
|
||||
DCD DMA_IRQHandler ; 18 General Purpose DMA
|
||||
DCD EZH_IRQHandler ; 19 EZH/EDM
|
||||
DCD FLASH_EEPROM_IRQHandler ; 20 Reserved for Typhoon
|
||||
DCD ETH_IRQHandler ; 21 Ethernet
|
||||
DCD SDIO_IRQHandler ; 22 SD/MMC
|
||||
DCD LCD_IRQHandler ; 23 LCD
|
||||
DCD USB0_IRQHandler ; 24 USB0
|
||||
DCD USB1_IRQHandler ; 25 USB1
|
||||
DCD SCT_IRQHandler ; 26 State Configurable Timer
|
||||
DCD RIT_IRQHandler ; 27 Repetitive Interrupt Timer
|
||||
DCD TIMER0_IRQHandler ; 28 Timer0
|
||||
DCD TIMER1_IRQHandler ; 29 Timer1
|
||||
DCD TIMER2_IRQHandler ; 30 Timer2
|
||||
DCD TIMER3_IRQHandler ; 31 Timer3
|
||||
DCD MCPWM_IRQHandler ; 32 Motor Control PWM
|
||||
DCD ADC0_IRQHandler ; 33 A/D Converter 0
|
||||
DCD I2C0_IRQHandler ; 34 I2C0
|
||||
DCD I2C1_IRQHandler ; 35 I2C1
|
||||
DCD SPI_IRQHandler ; 36 SPI
|
||||
DCD ADC1_IRQHandler ; 37 A/D Converter 1
|
||||
DCD SSP0_IRQHandler ; 38 SSP0
|
||||
DCD SSP1_IRQHandler ; 39 SSP1
|
||||
DCD UART0_IRQHandler ; 40 UART0
|
||||
DCD UART1_IRQHandler ; 41 UART1
|
||||
DCD UART2_IRQHandler ; 42 UART2
|
||||
DCD UART3_IRQHandler ; 43 UART3
|
||||
DCD I2S0_IRQHandler ; 44 I2S0
|
||||
DCD I2S1_IRQHandler ; 45 I2S1
|
||||
DCD SPIFI_IRQHandler ; 46 SPI Flash Interface
|
||||
DCD SGPIO_IRQHandler ; 47 SGPIO
|
||||
DCD GPIO0_IRQHandler ; 48 GPIO0
|
||||
DCD GPIO1_IRQHandler ; 49 GPIO1
|
||||
DCD GPIO2_IRQHandler ; 50 GPIO2
|
||||
DCD GPIO3_IRQHandler ; 51 GPIO3
|
||||
DCD GPIO4_IRQHandler ; 52 GPIO4
|
||||
DCD GPIO5_IRQHandler ; 53 GPIO5
|
||||
DCD GPIO6_IRQHandler ; 54 GPIO6
|
||||
DCD GPIO7_IRQHandler ; 55 GPIO7
|
||||
DCD GINT0_IRQHandler ; 56 GINT0
|
||||
DCD GINT1_IRQHandler ; 57 GINT1
|
||||
DCD EVRT_IRQHandler ; 58 Event Router
|
||||
DCD CAN1_IRQHandler ; 59 C_CAN1
|
||||
DCD 0 ; 60 Reserved
|
||||
DCD VADC_IRQHandler ; 61 VADC
|
||||
DCD ATIMER_IRQHandler ; 62 ATIMER
|
||||
DCD RTC_IRQHandler ; 63 RTC
|
||||
DCD 0 ; 64 Reserved
|
||||
DCD WDT_IRQHandler ; 65 WDT
|
||||
DCD M0s_IRQHandler ; 66 M0s
|
||||
DCD CAN0_IRQHandler ; 67 C_CAN0
|
||||
DCD QEI_IRQHandler ; 68 QEI
|
||||
|
||||
|
||||
IF :LNOT::DEF:NO_CRP
|
||||
AREA |.ARM.__at_0x02FC|, CODE, READONLY
|
||||
CRP_Key DCD 0xFFFFFFFF
|
||||
ENDIF
|
||||
|
||||
AREA |.text|, CODE, READONLY
|
||||
|
||||
; Reset Handler
|
||||
|
||||
Reset_Handler PROC
|
||||
EXPORT Reset_Handler [WEAK]
|
||||
IMPORT SystemInit
|
||||
IMPORT __main
|
||||
LDR R0, =SystemInit
|
||||
BLX R0
|
||||
LDR R0, =__main
|
||||
BX R0
|
||||
ENDP
|
||||
|
||||
; Dummy Exception Handlers (infinite loops which can be modified)
|
||||
|
||||
NMI_Handler PROC
|
||||
EXPORT NMI_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
HardFault_Handler\
|
||||
PROC
|
||||
EXPORT HardFault_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
MemManage_Handler\
|
||||
PROC
|
||||
EXPORT MemManage_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
BusFault_Handler\
|
||||
PROC
|
||||
EXPORT BusFault_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
UsageFault_Handler\
|
||||
PROC
|
||||
EXPORT UsageFault_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
SVC_Handler PROC
|
||||
EXPORT SVC_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
DebugMon_Handler\
|
||||
PROC
|
||||
EXPORT DebugMon_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
PendSV_Handler PROC
|
||||
EXPORT PendSV_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
SysTick_Handler PROC
|
||||
EXPORT SysTick_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
|
||||
Default_Handler PROC
|
||||
|
||||
EXPORT DAC_IRQHandler [WEAK]
|
||||
EXPORT M0CORE_IRQHandler [WEAK]
|
||||
EXPORT DMA_IRQHandler [WEAK]
|
||||
EXPORT EZH_IRQHandler [WEAK]
|
||||
EXPORT FLASH_EEPROM_IRQHandler [WEAK]
|
||||
EXPORT ETH_IRQHandler [WEAK]
|
||||
EXPORT SDIO_IRQHandler [WEAK]
|
||||
EXPORT LCD_IRQHandler [WEAK]
|
||||
EXPORT USB0_IRQHandler [WEAK]
|
||||
EXPORT USB1_IRQHandler [WEAK]
|
||||
EXPORT SCT_IRQHandler [WEAK]
|
||||
EXPORT RIT_IRQHandler [WEAK]
|
||||
EXPORT TIMER0_IRQHandler [WEAK]
|
||||
EXPORT TIMER1_IRQHandler [WEAK]
|
||||
EXPORT TIMER2_IRQHandler [WEAK]
|
||||
EXPORT TIMER3_IRQHandler [WEAK]
|
||||
EXPORT MCPWM_IRQHandler [WEAK]
|
||||
EXPORT ADC0_IRQHandler [WEAK]
|
||||
EXPORT I2C0_IRQHandler [WEAK]
|
||||
EXPORT I2C1_IRQHandler [WEAK]
|
||||
EXPORT SPI_IRQHandler [WEAK]
|
||||
EXPORT ADC1_IRQHandler [WEAK]
|
||||
EXPORT SSP0_IRQHandler [WEAK]
|
||||
EXPORT SSP1_IRQHandler [WEAK]
|
||||
EXPORT UART0_IRQHandler [WEAK]
|
||||
EXPORT UART1_IRQHandler [WEAK]
|
||||
EXPORT UART2_IRQHandler [WEAK]
|
||||
EXPORT UART3_IRQHandler [WEAK]
|
||||
EXPORT I2S0_IRQHandler [WEAK]
|
||||
EXPORT I2S1_IRQHandler [WEAK]
|
||||
EXPORT SPIFI_IRQHandler [WEAK]
|
||||
EXPORT SGPIO_IRQHandler [WEAK]
|
||||
EXPORT GPIO0_IRQHandler [WEAK]
|
||||
EXPORT GPIO1_IRQHandler [WEAK]
|
||||
EXPORT GPIO2_IRQHandler [WEAK]
|
||||
EXPORT GPIO3_IRQHandler [WEAK]
|
||||
EXPORT GPIO4_IRQHandler [WEAK]
|
||||
EXPORT GPIO5_IRQHandler [WEAK]
|
||||
EXPORT GPIO6_IRQHandler [WEAK]
|
||||
EXPORT GPIO7_IRQHandler [WEAK]
|
||||
EXPORT GINT0_IRQHandler [WEAK]
|
||||
EXPORT GINT1_IRQHandler [WEAK]
|
||||
EXPORT EVRT_IRQHandler [WEAK]
|
||||
EXPORT CAN1_IRQHandler [WEAK]
|
||||
EXPORT VADC_IRQHandler [WEAK]
|
||||
EXPORT ATIMER_IRQHandler [WEAK]
|
||||
EXPORT RTC_IRQHandler [WEAK]
|
||||
EXPORT WDT_IRQHandler [WEAK]
|
||||
EXPORT M0s_IRQHandler [WEAK]
|
||||
EXPORT CAN0_IRQHandler [WEAK]
|
||||
EXPORT QEI_IRQHandler [WEAK]
|
||||
|
||||
DAC_IRQHandler
|
||||
M0CORE_IRQHandler
|
||||
DMA_IRQHandler
|
||||
EZH_IRQHandler
|
||||
FLASH_EEPROM_IRQHandler
|
||||
ETH_IRQHandler
|
||||
SDIO_IRQHandler
|
||||
LCD_IRQHandler
|
||||
USB0_IRQHandler
|
||||
USB1_IRQHandler
|
||||
SCT_IRQHandler
|
||||
RIT_IRQHandler
|
||||
TIMER0_IRQHandler
|
||||
TIMER1_IRQHandler
|
||||
TIMER2_IRQHandler
|
||||
TIMER3_IRQHandler
|
||||
MCPWM_IRQHandler
|
||||
ADC0_IRQHandler
|
||||
I2C0_IRQHandler
|
||||
I2C1_IRQHandler
|
||||
SPI_IRQHandler
|
||||
ADC1_IRQHandler
|
||||
SSP0_IRQHandler
|
||||
SSP1_IRQHandler
|
||||
UART0_IRQHandler
|
||||
UART1_IRQHandler
|
||||
UART2_IRQHandler
|
||||
UART3_IRQHandler
|
||||
I2S0_IRQHandler
|
||||
I2S1_IRQHandler
|
||||
SPIFI_IRQHandler
|
||||
SGPIO_IRQHandler
|
||||
GPIO0_IRQHandler
|
||||
GPIO1_IRQHandler
|
||||
GPIO2_IRQHandler
|
||||
GPIO3_IRQHandler
|
||||
GPIO4_IRQHandler
|
||||
GPIO5_IRQHandler
|
||||
GPIO6_IRQHandler
|
||||
GPIO7_IRQHandler
|
||||
GINT0_IRQHandler
|
||||
GINT1_IRQHandler
|
||||
EVRT_IRQHandler
|
||||
CAN1_IRQHandler
|
||||
VADC_IRQHandler
|
||||
ATIMER_IRQHandler
|
||||
RTC_IRQHandler
|
||||
WDT_IRQHandler
|
||||
M0s_IRQHandler
|
||||
CAN0_IRQHandler
|
||||
QEI_IRQHandler
|
||||
|
||||
B .
|
||||
|
||||
ENDP
|
||||
|
||||
ALIGN
|
||||
|
||||
; User Initial Stack & Heap
|
||||
|
||||
IF :DEF:__MICROLIB
|
||||
|
||||
EXPORT __initial_sp
|
||||
EXPORT __heap_base
|
||||
EXPORT __heap_limit
|
||||
|
||||
ELSE
|
||||
|
||||
IMPORT __use_two_region_memory
|
||||
EXPORT __user_initial_stackheap
|
||||
__user_initial_stackheap
|
||||
|
||||
LDR R0, = Heap_Mem
|
||||
LDR R1, =(Stack_Mem + Stack_Size)
|
||||
LDR R2, = (Heap_Mem + Heap_Size)
|
||||
LDR R3, = Stack_Mem
|
||||
BX LR
|
||||
|
||||
ALIGN
|
||||
|
||||
ENDIF
|
||||
|
||||
AREA |.text|,CODE, READONLY
|
||||
getPC PROC
|
||||
EXPORT getPC
|
||||
|
||||
MOV R0,LR
|
||||
BX LR
|
||||
|
||||
ENDP
|
||||
|
||||
END
|
||||
@@ -0,0 +1,255 @@
|
||||
;/***********************************************************************
|
||||
; * $Id: startup_LPC43xx_M0.s 6473 2011-02-16 17:40:54Z nxp27266 $
|
||||
; *
|
||||
; * Project: LPC43xx CMSIS Package
|
||||
; *
|
||||
; * Description: Cortex-M0 Core Device Startup File for the NXP LPC43xx
|
||||
; * Device Series.
|
||||
; *
|
||||
; * Copyright(C) 2011, NXP Semiconductor
|
||||
; * All rights reserved.
|
||||
; *
|
||||
; * modified by KEIL
|
||||
; ***********************************************************************
|
||||
; * Software that is described herein is for illustrative purposes only
|
||||
; * which provides customers with programming information regarding the
|
||||
; * products. This software is supplied "AS IS" without any warranties.
|
||||
; * NXP Semiconductors assumes no responsibility or liability for the
|
||||
; * use of the software, conveys no license or title under any patent,
|
||||
; * copyright, or mask work right to the product. NXP Semiconductors
|
||||
; * reserves the right to make changes in the software without
|
||||
; * notification. NXP Semiconductors also make no representation or
|
||||
; * warranty that such application will be suitable for the specified
|
||||
; * use without further testing or modification.
|
||||
; **********************************************************************/
|
||||
|
||||
; <h> Stack Configuration
|
||||
; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
|
||||
; </h>
|
||||
|
||||
Stack_Size EQU 0x00000200
|
||||
|
||||
AREA STACK, NOINIT, READWRITE, ALIGN=3
|
||||
Stack_Mem SPACE Stack_Size
|
||||
__initial_sp
|
||||
|
||||
; <h> Heap Configuration
|
||||
; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
|
||||
; </h>
|
||||
|
||||
Heap_Size EQU 0x00000000
|
||||
|
||||
AREA HEAP, NOINIT, READWRITE, ALIGN=3
|
||||
__heap_base
|
||||
Heap_Mem SPACE Heap_Size
|
||||
__heap_limit
|
||||
|
||||
PRESERVE8
|
||||
THUMB
|
||||
|
||||
; Vector Table Mapped to Address 0 at Reset
|
||||
|
||||
AREA RESET, DATA, READONLY
|
||||
EXPORT __Vectors
|
||||
|
||||
Sign_Value EQU 0x5A5A5A5A
|
||||
|
||||
__Vectors DCD __initial_sp ; 0 Top of Stack
|
||||
DCD Reset_Handler ; 1 Reset Handler
|
||||
DCD NMI_Handler ; 2 NMI Handler
|
||||
DCD HardFault_Handler ; 3 Hard Fault Handler
|
||||
DCD 0 ; 4 Reserved
|
||||
DCD 0 ; 5 Reserved
|
||||
DCD 0 ; 6 Reserved
|
||||
DCD 0 ; 7 Reserved
|
||||
DCD 0 ; 8 Reserved
|
||||
DCD 0 ; 9 Reserved
|
||||
DCD 0 ; 10 Reserved
|
||||
DCD SVC_Handler ; 11 SVCall Handler
|
||||
DCD DebugMon_Handler ; 12 Debug Monitor Handler
|
||||
DCD 0 ; 13 Reserved
|
||||
DCD PendSV_Handler ; 14 PendSV Handler
|
||||
DCD SysTick_Handler ; 15 SysTick Handler
|
||||
|
||||
; External Interrupts
|
||||
DCD RTC_IRQHandler ; 16 RTC
|
||||
DCD M4CORE_IRQHandler ; 17 M4 Core
|
||||
DCD DMA_IRQHandler ; 18 General Purpose DMA
|
||||
DCD 0 ; 19 Reserved
|
||||
DCD FLASHEEPROMAT_IRQHandler ; 20 ORed flash bank A, flash bank B, EEPROM, Atimer
|
||||
DCD ETH_IRQHandler ; 21 Ethernet
|
||||
DCD SDIO_IRQHandler ; 22 SD/MMC
|
||||
DCD LCD_IRQHandler ; 23 LCD
|
||||
DCD USB0_IRQHandler ; 24 USB0
|
||||
DCD USB1_IRQHandler ; 25 USB1
|
||||
DCD SCT_IRQHandler ; 26 State Configurable Timer
|
||||
DCD RIT_OR_WWDT_IRQHandler ; 27 Repetitive Interrupt Timer or WWDT
|
||||
DCD TIMER0_IRQHandler ; 28 Timer0
|
||||
DCD GINT1_IRQHandler ; 29 GPIO global interrupt 1
|
||||
DCD PIN_INT4_IRQHandler ; 30 GPIO pin interrupt 4
|
||||
DCD TIMER3_IRQHandler ; 31 Timer3
|
||||
DCD MCPWM_IRQHandler ; 32 Motor control PWM
|
||||
DCD ADC0_IRQHandler ; 33 ADC0
|
||||
DCD I2C0_OR_I2C1_IRQHandler ; 34 I2C or I2C1
|
||||
DCD SGPIO_IRQHandler ; 35 Serial GPIO
|
||||
DCD SPI_OR_DAC_IRQHandler ; 36 SPI or DAC
|
||||
DCD ADC1_IRQHandler ; 37 ADC1
|
||||
DCD SSP0_OR_SSP1_IRQHandler ; 38 SSP0 or SSP1
|
||||
DCD EVENTROUTER_IRQHandler ; 39 Event router
|
||||
DCD USART0_IRQHandler ; 40 USART0
|
||||
DCD UART1_IRQHandler ; 41 UART1/Modem
|
||||
DCD USART2_OR_C_CAN1_IRQHandler ; 42 USART2 or C CAN1
|
||||
DCD USART3_IRQHandler ; 43 USART3
|
||||
DCD I2S0_OR_I2S1_OR_QEI_IRQHandler ; 44 I2S0 or I2S1 or QEI
|
||||
DCD C_CAN0_IRQHandler ; 45 C CAN0
|
||||
DCD 0 ; 46 Reserved
|
||||
DCD 0 ; 47 Reserved
|
||||
|
||||
AREA |.text|, CODE, READONLY
|
||||
|
||||
; Reset Handler
|
||||
|
||||
Reset_Handler\
|
||||
PROC
|
||||
EXPORT Reset_Handler [WEAK]
|
||||
IMPORT __main
|
||||
LDR R0, =__main
|
||||
BX R0
|
||||
ENDP
|
||||
|
||||
; Dummy Exception Handlers (infinite loops which can be modified)
|
||||
|
||||
NMI_Handler PROC
|
||||
EXPORT NMI_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
|
||||
HardFault_Handler\
|
||||
PROC
|
||||
EXPORT HardFault_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
SVC_Handler PROC
|
||||
EXPORT SVC_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
|
||||
DebugMon_Handler\
|
||||
PROC
|
||||
EXPORT DebugMon_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
|
||||
PendSV_Handler PROC
|
||||
EXPORT PendSV_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
|
||||
SysTick_Handler PROC
|
||||
EXPORT SysTick_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
|
||||
Default_Handler PROC
|
||||
|
||||
EXPORT RTC_IRQHandler [WEAK]
|
||||
EXPORT M4CORE_IRQHandler [WEAK]
|
||||
EXPORT DMA_IRQHandler [WEAK]
|
||||
EXPORT FLASHEEPROMAT_IRQHandler [WEAK]
|
||||
EXPORT ETH_IRQHandler [WEAK]
|
||||
EXPORT SDIO_IRQHandler [WEAK]
|
||||
EXPORT LCD_IRQHandler [WEAK]
|
||||
EXPORT USB0_IRQHandler [WEAK]
|
||||
EXPORT USB1_IRQHandler [WEAK]
|
||||
EXPORT SCT_IRQHandler [WEAK]
|
||||
EXPORT RIT_OR_WWDT_IRQHandler [WEAK]
|
||||
EXPORT TIMER0_IRQHandler [WEAK]
|
||||
EXPORT GINT1_IRQHandler [WEAK]
|
||||
EXPORT PIN_INT4_IRQHandler [WEAK]
|
||||
EXPORT TIMER3_IRQHandler [WEAK]
|
||||
EXPORT MCPWM_IRQHandler [WEAK]
|
||||
EXPORT ADC0_IRQHandler [WEAK]
|
||||
EXPORT I2C0_OR_I2C1_IRQHandler [WEAK]
|
||||
EXPORT SGPIO_IRQHandler [WEAK]
|
||||
EXPORT SPI_OR_DAC_IRQHandler [WEAK]
|
||||
EXPORT ADC1_IRQHandler [WEAK]
|
||||
EXPORT SSP0_OR_SSP1_IRQHandler [WEAK]
|
||||
EXPORT EVENTROUTER_IRQHandler [WEAK]
|
||||
EXPORT USART0_IRQHandler [WEAK]
|
||||
EXPORT UART1_IRQHandler [WEAK]
|
||||
EXPORT USART2_OR_C_CAN1_IRQHandler [WEAK]
|
||||
EXPORT USART3_IRQHandler [WEAK]
|
||||
EXPORT I2S0_OR_I2S1_OR_QEI_IRQHandler [WEAK]
|
||||
EXPORT C_CAN0_IRQHandler [WEAK]
|
||||
|
||||
|
||||
RTC_IRQHandler
|
||||
M4CORE_IRQHandler
|
||||
DMA_IRQHandler
|
||||
FLASHEEPROMAT_IRQHandler
|
||||
ETH_IRQHandler
|
||||
SDIO_IRQHandler
|
||||
LCD_IRQHandler
|
||||
USB0_IRQHandler
|
||||
USB1_IRQHandler
|
||||
SCT_IRQHandler
|
||||
RIT_OR_WWDT_IRQHandler
|
||||
TIMER0_IRQHandler
|
||||
GINT1_IRQHandler
|
||||
PIN_INT4_IRQHandler
|
||||
TIMER3_IRQHandler
|
||||
MCPWM_IRQHandler
|
||||
ADC0_IRQHandler
|
||||
I2C0_OR_I2C1_IRQHandler
|
||||
SGPIO_IRQHandler
|
||||
SPI_OR_DAC_IRQHandler
|
||||
ADC1_IRQHandler
|
||||
SSP0_OR_SSP1_IRQHandler
|
||||
EVENTROUTER_IRQHandler
|
||||
USART0_IRQHandler
|
||||
UART1_IRQHandler
|
||||
USART2_OR_C_CAN1_IRQHandler
|
||||
USART3_IRQHandler
|
||||
I2S0_OR_I2S1_OR_QEI_IRQHandler
|
||||
C_CAN0_IRQHandler
|
||||
|
||||
B .
|
||||
|
||||
ENDP
|
||||
|
||||
ALIGN
|
||||
|
||||
; User Initial Stack & Heap
|
||||
|
||||
IF :DEF:__MICROLIB
|
||||
|
||||
EXPORT __initial_sp
|
||||
EXPORT __heap_base
|
||||
EXPORT __heap_limit
|
||||
|
||||
ELSE
|
||||
|
||||
IMPORT __use_two_region_memory
|
||||
EXPORT __user_initial_stackheap
|
||||
__user_initial_stackheap
|
||||
|
||||
LDR R0, = Heap_Mem
|
||||
LDR R1, =(Stack_Mem + Stack_Size)
|
||||
LDR R2, = (Heap_Mem + Heap_Size)
|
||||
LDR R3, = Stack_Mem
|
||||
BX LR
|
||||
|
||||
ALIGN
|
||||
|
||||
ENDIF
|
||||
|
||||
AREA |.text|,CODE, READONLY
|
||||
getPC PROC
|
||||
EXPORT getPC
|
||||
|
||||
MOV R0,LR
|
||||
BX LR
|
||||
|
||||
ENDP
|
||||
|
||||
END
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,463 @@
|
||||
//*****************************************************************************
|
||||
// LPC43xx (Cortex M0 SUB) Startup code for use with LPCXpresso IDE
|
||||
//
|
||||
// Version : 131115
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Copyright(C) NXP Semiconductors, 2013
|
||||
// All rights reserved.
|
||||
//
|
||||
// Software that is described herein is for illustrative purposes only
|
||||
// which provides customers with programming information regarding the
|
||||
// LPC products. This software is supplied "AS IS" without any warranties of
|
||||
// any kind, and NXP Semiconductors and its licensor disclaim any and
|
||||
// all warranties, express or implied, including all implied warranties of
|
||||
// merchantability, fitness for a particular purpose and non-infringement of
|
||||
// intellectual property rights. NXP Semiconductors assumes no responsibility
|
||||
// or liability for the use of the software, conveys no license or rights under any
|
||||
// patent, copyright, mask work right, or any other intellectual property rights in
|
||||
// or to any products. NXP Semiconductors reserves the right to make changes
|
||||
// in the software without notification. NXP Semiconductors also makes no
|
||||
// representation or warranty that such application will be suitable for the
|
||||
// specified use without further testing or modification.
|
||||
//
|
||||
// Permission to use, copy, modify, and distribute this software and its
|
||||
// documentation is hereby granted, under NXP Semiconductors' and its
|
||||
// licensor's relevant copyrights in the software, without fee, provided that it
|
||||
// is used in conjunction with NXP Semiconductors microcontrollers. This
|
||||
// copyright, permission, and disclaimer notice must appear in all copies of
|
||||
// this code.
|
||||
//*****************************************************************************
|
||||
|
||||
#if defined (__cplusplus)
|
||||
#ifdef __REDLIB__
|
||||
#error Redlib does not support C++
|
||||
#else
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The entry point for the C++ library startup
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern "C" {
|
||||
extern void __libc_init_array(void);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define WEAK __attribute__ ((weak))
|
||||
#define ALIAS(f) __attribute__ ((weak, alias (#f)))
|
||||
|
||||
#if defined (__USE_CMSIS) || defined (__USE_LPCOPEN)
|
||||
void SystemInit(void);
|
||||
#endif
|
||||
|
||||
//*****************************************************************************
|
||||
#if defined (__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Forward declaration of the default handlers. These are aliased.
|
||||
// When the application defines a handler (with the same name), this will
|
||||
// automatically take precedence over these weak definitions
|
||||
//
|
||||
//*****************************************************************************
|
||||
void ResetISR(void);
|
||||
#if defined (__USE_LPCOPEN)
|
||||
WEAK void NMI_Handler(void);
|
||||
WEAK void HardFault_Handler(void);
|
||||
WEAK void SVC_Handler(void);
|
||||
WEAK void PendSV_Handler(void);
|
||||
WEAK void SysTick_Handler(void);
|
||||
WEAK void IntDefaultHandler(void);
|
||||
#else
|
||||
WEAK void M0S_NMI_Handler(void);
|
||||
WEAK void M0S_HardFault_Handler (void);
|
||||
WEAK void M0S_SVC_Handler(void);
|
||||
WEAK void M0S_PendSV_Handler(void);
|
||||
WEAK void M0S_SysTick_Handler(void);
|
||||
WEAK void M0S_IntDefaultHandler(void);
|
||||
#endif
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Forward declaration of the specific IRQ handlers. These are aliased
|
||||
// to the IntDefaultHandler, which is a 'forever' loop. When the application
|
||||
// defines a handler (with the same name), this will automatically take
|
||||
// precedence over these weak definitions
|
||||
//
|
||||
//*****************************************************************************
|
||||
#if defined (__USE_LPCOPEN)
|
||||
void DAC_IRQHandler(void) ALIAS(IntDefaultHandler);
|
||||
void M4_IRQHandler(void) ALIAS(IntDefaultHandler);
|
||||
void DMA_IRQHandler(void) ALIAS(IntDefaultHandler);
|
||||
void SGPIO_INPUT_IRQHandler(void) ALIAS(IntDefaultHandler);
|
||||
void SGPIO_MATCH_IRQHandler(void) ALIAS(IntDefaultHandler);
|
||||
void SGPIO_SHIFT_IRQHandler(void) ALIAS(IntDefaultHandler);
|
||||
void SGPIO_POS_IRQHandler(void) ALIAS(IntDefaultHandler);
|
||||
void USB0_IRQHandler(void) ALIAS(IntDefaultHandler);
|
||||
void USB1_IRQHandler(void) ALIAS(IntDefaultHandler);
|
||||
void SCT_IRQHandler(void) ALIAS(IntDefaultHandler);
|
||||
void RIT_IRQHandler(void) ALIAS(IntDefaultHandler);
|
||||
void GINT1_IRQHandler(void) ALIAS(IntDefaultHandler);
|
||||
void TIMER1_IRQHandler(void) ALIAS(IntDefaultHandler);
|
||||
void TIMER2_IRQHandler(void) ALIAS(IntDefaultHandler);
|
||||
void GPIO5_IRQHandler(void) ALIAS(IntDefaultHandler);
|
||||
void ADC0_IRQHandler(void) ALIAS(IntDefaultHandler);
|
||||
void MCPWM_IRQHandler(void) ALIAS(IntDefaultHandler);
|
||||
void I2C0_IRQHandler(void) ALIAS(IntDefaultHandler);
|
||||
void I2C1_IRQHandler(void) ALIAS(IntDefaultHandler);
|
||||
void SPI_IRQHandler(void) ALIAS(IntDefaultHandler);
|
||||
void ADC1_IRQHandler(void) ALIAS(IntDefaultHandler);
|
||||
void SSP0_SSP1_IRQHandler(void) ALIAS(IntDefaultHandler);
|
||||
void EVRT_IRQHandler(void) ALIAS(IntDefaultHandler);
|
||||
void UART0_IRQHandler(void) ALIAS(IntDefaultHandler);
|
||||
void UART1_IRQHandler(void) ALIAS(IntDefaultHandler);
|
||||
void UART2_CAN1_IRQHandler(void) ALIAS(IntDefaultHandler);
|
||||
void UART3_IRQHandler(void) ALIAS(IntDefaultHandler);
|
||||
void I2S0_I2S1_QEI_IRQHandler(void) ALIAS(IntDefaultHandler);
|
||||
void CAN0_IRQHandler(void) ALIAS(IntDefaultHandler);
|
||||
void SPIFI_ADCHS_IRQHandler(void) ALIAS(IntDefaultHandler);
|
||||
void M0APP_IRQHandler(void) ALIAS(IntDefaultHandler);
|
||||
#else
|
||||
void M0S_DAC_IRQHandler(void) ALIAS(M0S_IntDefaultHandler);
|
||||
void M0S_M4CORE_IRQHandler(void) ALIAS(M0S_IntDefaultHandler);
|
||||
void M0S_DMA_IRQHandler(void) ALIAS(M0S_IntDefaultHandler);
|
||||
void M0S_SGPIO_INPUT_IRQHandler(void) ALIAS(M0S_IntDefaultHandler);
|
||||
void M0S_SGPIO_MATCH_IRQHandler(void) ALIAS(M0S_IntDefaultHandler);
|
||||
void M0S_SGPIO_SHIFT_IRQHandler(void) ALIAS(M0S_IntDefaultHandler);
|
||||
void M0S_SGPIO_POS_IRQHandler(void) ALIAS(M0S_IntDefaultHandler);
|
||||
void M0S_USB0_IRQHandler(void) ALIAS(M0S_IntDefaultHandler);
|
||||
void M0S_USB1_IRQHandler(void) ALIAS(M0S_IntDefaultHandler);
|
||||
void M0S_SCT_IRQHandler(void) ALIAS(M0S_IntDefaultHandler);
|
||||
void M0S_RITIMER_IRQHandler(void) ALIAS(M0S_IntDefaultHandler);
|
||||
void M0S_GINT1_IRQHandler(void) ALIAS(M0S_IntDefaultHandler);
|
||||
void M0S_TIMER1_IRQHandler(void) ALIAS(M0S_IntDefaultHandler);
|
||||
void M0S_TIMER2_IRQHandler(void) ALIAS(M0S_IntDefaultHandler);
|
||||
void M0S_PIN_INT5_IRQHandler(void) ALIAS(M0S_IntDefaultHandler);
|
||||
void M0S_ADC0_IRQHandler(void) ALIAS(M0S_IntDefaultHandler);
|
||||
void M0S_MCPWM_IRQHandler(void) ALIAS(M0S_IntDefaultHandler);
|
||||
void M0S_I2C0_IRQHandler(void) ALIAS(M0S_IntDefaultHandler);
|
||||
void M0S_I2C1_IRQHandler(void) ALIAS(M0S_IntDefaultHandler);
|
||||
void M0S_SPI_IRQHandler(void) ALIAS(M0S_IntDefaultHandler);
|
||||
void M0S_ADC1_IRQHandler(void) ALIAS(M0S_IntDefaultHandler);
|
||||
void M0S_SSP0_OR_SSP1_IRQHandler(void) ALIAS(M0S_IntDefaultHandler);
|
||||
void M0S_EVENTROUTER_IRQHandler(void) ALIAS(M0S_IntDefaultHandler);
|
||||
void M0S_USART0_IRQHandler(void) ALIAS(M0S_IntDefaultHandler);
|
||||
void M0S_UART1_IRQHandler(void) ALIAS(M0S_IntDefaultHandler);
|
||||
void M0S_USART2_OR_C_CAN1_IRQHandler(void) ALIAS(M0S_IntDefaultHandler);
|
||||
void M0S_USART3_IRQHandler(void) ALIAS(M0S_IntDefaultHandler);
|
||||
void M0S_I2C0_OR_I2C1_OR_I2S1_OR_QEI_IRQHandler(void) ALIAS(M0S_IntDefaultHandler);
|
||||
void M0S_C_CAN0_IRQHandler(void) ALIAS(M0S_IntDefaultHandler);
|
||||
void M0S_SPIFI_OR_VADC_IRQHandler(void) ALIAS(M0S_IntDefaultHandler);
|
||||
void M0S_M0APP_IRQHandler(void) ALIAS(M0S_IntDefaultHandler);
|
||||
#endif
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The entry point for the application.
|
||||
// __main() is the entry point for Redlib based applications
|
||||
// main() is the entry point for Newlib based applications
|
||||
//
|
||||
//*****************************************************************************
|
||||
#if defined (__REDLIB__)
|
||||
extern void __main(void);
|
||||
#endif
|
||||
extern int main(void);
|
||||
//*****************************************************************************
|
||||
//
|
||||
// External declaration for the pointer to the stack top from the Linker Script
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern void _vStackTop(void);
|
||||
|
||||
//*****************************************************************************
|
||||
#if defined (__cplusplus)
|
||||
} // extern "C"
|
||||
#endif
|
||||
//*****************************************************************************
|
||||
//
|
||||
// The vector table.
|
||||
// This relies on the linker script to place at correct location in memory.
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern void (* const g_pfnVectors[])(void);
|
||||
__attribute__ ((section(".isr_vector")))
|
||||
void (* const g_pfnVectors[])(void) = {
|
||||
|
||||
#if defined (__USE_LPCOPEN)
|
||||
// Core Level - CM0
|
||||
&_vStackTop, // The initial stack pointer
|
||||
ResetISR, // 1 The reset handler
|
||||
NMI_Handler, // The NMI handler
|
||||
HardFault_Handler, // The hard fault handler
|
||||
0, // 4 Reserved
|
||||
0, // 5 Reserved
|
||||
0, // 6 Reserved
|
||||
0, // 7 Reserved
|
||||
0, // 8 Reserved
|
||||
0, // 9 Reserved
|
||||
0, // 10 Reserved
|
||||
SVC_Handler, // SVCall handler
|
||||
0, // Reserved
|
||||
0, // Reserved
|
||||
PendSV_Handler, // The PendSV handler
|
||||
SysTick_Handler, // The SysTick handler
|
||||
|
||||
// Chip Level - 43xx M0SUB core
|
||||
DAC_IRQHandler, // 16
|
||||
M4_IRQHandler, // 17 Interrupt from M4 Core
|
||||
DMA_IRQHandler, // 18 General Purpose DMA
|
||||
0, // 19 Reserved
|
||||
SGPIO_INPUT_IRQHandler, // 20
|
||||
SGPIO_MATCH_IRQHandler, // 21
|
||||
SGPIO_SHIFT_IRQHandler, // 22
|
||||
SGPIO_POS_IRQHandler, // 23
|
||||
USB0_IRQHandler, // 24 USB0
|
||||
USB1_IRQHandler, // 25 USB1
|
||||
SCT_IRQHandler , // 26 State Configurable Timer
|
||||
RIT_IRQHandler, // 27 Repetitive Interrupt Timer
|
||||
GINT1_IRQHandler, // 28 GINT1
|
||||
TIMER1_IRQHandler, // 29 Timer1
|
||||
TIMER2_IRQHandler, // 30 Timer2
|
||||
GPIO5_IRQHandler, // 31
|
||||
MCPWM_IRQHandler, // 32 Motor Control PWM
|
||||
ADC0_IRQHandler, // 33 ADC0
|
||||
I2C0_IRQHandler, // 34
|
||||
I2C1_IRQHandler, // 35
|
||||
SPI_IRQHandler, // 36
|
||||
ADC1_IRQHandler, // 37
|
||||
SSP0_SSP1_IRQHandler, // 38
|
||||
EVRT_IRQHandler, // 39 Event Router
|
||||
UART0_IRQHandler, // 41 USART0
|
||||
UART1_IRQHandler, // 41 UART1
|
||||
UART2_CAN1_IRQHandler, // 42 USART2 or C CAN1
|
||||
UART3_IRQHandler, // 43 USART3
|
||||
I2S0_I2S1_QEI_IRQHandler, // 35 I2C0 or I2C1 or I2S1 or QEI
|
||||
CAN0_IRQHandler, // 45 C CAN0
|
||||
SPIFI_ADCHS_IRQHandler, // 46
|
||||
M0APP_IRQHandler, // 47 Interrupt from M0APP
|
||||
};
|
||||
#else
|
||||
// Core Level - CM0
|
||||
&_vStackTop, // The initial stack pointer
|
||||
ResetISR, // 1 The reset handler
|
||||
M0S_NMI_Handler, // 2 The NMI handler
|
||||
M0S_HardFault_Handler, // 3 The hard fault handler
|
||||
0, // 4 Reserved
|
||||
0, // 5 Reserved
|
||||
0, // 6 Reserved
|
||||
0, // 7 Reserved
|
||||
0, // 8 Reserved
|
||||
0, // 9 Reserved
|
||||
0, // 10 Reserved
|
||||
M0S_SVC_Handler, // 11 SVCall handler
|
||||
M0S_DebugMon_Handler, // 12 Debug monitor handler
|
||||
0, // 13 Reserved
|
||||
M0S_PendSV_Handler, // 14 The PendSV handler
|
||||
M0S_SysTick_Handler, // 15 The SysTick handler
|
||||
|
||||
// Chip Level - LPC43 (CM0 SUB)
|
||||
M0S_DAC_IRQHandler, // 16
|
||||
M0S_M4CORE_IRQHandler, // 17 Interrupt from M4 Core
|
||||
M0S_DMA_IRQHandler, // 18 General Purpose DMA
|
||||
0, // 19 Reserved
|
||||
M0S_SGPIO_INPUT_IRQHandler, // 20
|
||||
M0S_SGPIO_MATCH_IRQHandler, // 21
|
||||
M0S_SGPIO_SHIFT_IRQHandler, // 22
|
||||
M0S_SGPIO_POS_IRQHandler, // 23
|
||||
M0S_USB0_IRQHandler, // 24 USB0
|
||||
M0S_USB1_IRQHandler, // 25 USB1
|
||||
M0S_SCT_IRQHandler , // 26 State Configurable Timer
|
||||
M0S_RITIMER_IRQHandler, // 27 Repetitive Interrupt Timer
|
||||
M0S_GINT1_IRQHandler, // 28 GINT1
|
||||
M0S_TIMER1_IRQHandler, // 29 Timer1
|
||||
M0S_TIMER2_IRQHandler, // 30 Timer2
|
||||
M0S_PIN_INT5_IRQHandler, // 31
|
||||
M0S_MCPWM_IRQHandler, // 32 Motor Control PWM
|
||||
M0S_ADC0_IRQHandler, // 33 ADC0
|
||||
M0S_I2C0_IRQHandler, // 34
|
||||
M0S_I2C1_IRQHandler, // 35
|
||||
M0S_SPI_IRQHandler, // 36
|
||||
M0S_ADC1_IRQHandler, // 37
|
||||
M0S_SSP0_OR_SSP1_IRQHandler, // 38
|
||||
M0S_EVENTROUTER_IRQHandler, // 39 Event Router
|
||||
M0S_USART0_IRQHandler, // 41 USART0
|
||||
M0S_UART1_IRQHandler, // 41 UART1
|
||||
M0S_USART2_OR_C_CAN1_IRQHandler, // 42 USART2 or C CAN1
|
||||
M0S_USART3_IRQHandler, // 43 USART3
|
||||
M0S_I2C0_OR_I2C1_OR_I2S1_OR_QEI_IRQHandler,
|
||||
// 35 I2C0 or I2C1 or I2S1 or QEI
|
||||
M0S_C_CAN0_IRQHandler, // 45 C CAN0
|
||||
M0S_SPIFI_OR_VADC_IRQHandler, // 46
|
||||
M0S_M0APP_IRQHandler, // 47 Interrupt from M0APP
|
||||
};
|
||||
#endif
|
||||
//*****************************************************************************
|
||||
// Functions to carry out the initialization of RW and BSS data sections. These
|
||||
// are written as separate functions rather than being inlined within the
|
||||
// ResetISR() function in order to cope with MCUs with multiple banks of
|
||||
// memory.
|
||||
//*****************************************************************************
|
||||
__attribute__ ((section(".after_vectors")))
|
||||
void data_init(unsigned int romstart, unsigned int start, unsigned int len) {
|
||||
unsigned int *pulDest = (unsigned int*) start;
|
||||
unsigned int *pulSrc = (unsigned int*) romstart;
|
||||
unsigned int loop;
|
||||
for (loop = 0; loop < len; loop = loop + 4)
|
||||
*pulDest++ = *pulSrc++;
|
||||
}
|
||||
|
||||
__attribute__ ((section(".after_vectors")))
|
||||
void bss_init(unsigned int start, unsigned int len) {
|
||||
unsigned int *pulDest = (unsigned int*) start;
|
||||
unsigned int loop;
|
||||
for (loop = 0; loop < len; loop = loop + 4)
|
||||
*pulDest++ = 0;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
// The following symbols are constructs generated by the linker, indicating
|
||||
// the location of various points in the "Global Section Table". This table is
|
||||
// created by the linker via the Code Red managed linker script mechanism. It
|
||||
// contains the load address, execution address and length of each RW data
|
||||
// section and the execution and length of each BSS (zero initialized) section.
|
||||
//*****************************************************************************
|
||||
extern unsigned int __data_section_table;
|
||||
extern unsigned int __data_section_table_end;
|
||||
extern unsigned int __bss_section_table;
|
||||
extern unsigned int __bss_section_table_end;
|
||||
|
||||
//*****************************************************************************
|
||||
// Reset entry point for your code.
|
||||
// Sets up a simple runtime environment and initializes the C/C++
|
||||
// library.
|
||||
//
|
||||
//*****************************************************************************
|
||||
void
|
||||
ResetISR(void) {
|
||||
|
||||
// ******************************
|
||||
// Modify CREG->M0SUBMEMMAP so that M0 looks in correct place
|
||||
// for its vector table when an exception is triggered.
|
||||
// Note that we do not use the CMSIS register access mechanism,
|
||||
// as there is no guarantee that the project has been configured
|
||||
// to use CMSIS.
|
||||
unsigned int *pCREG_M0SUBMEMMAP = (unsigned int *) 0x40043308;
|
||||
// CMSIS : CREG->M0SUBMEMMAP = <address of vector table>
|
||||
*pCREG_M0SUBMEMMAP = (unsigned int)g_pfnVectors;
|
||||
|
||||
//
|
||||
// Copy the data sections from flash to SRAM.
|
||||
//
|
||||
unsigned int LoadAddr, ExeAddr, SectionLen;
|
||||
unsigned int *SectionTableAddr;
|
||||
|
||||
// Load base address of Global Section Table
|
||||
SectionTableAddr = &__data_section_table;
|
||||
|
||||
// Copy the data sections from flash to SRAM.
|
||||
while (SectionTableAddr < &__data_section_table_end) {
|
||||
LoadAddr = *SectionTableAddr++;
|
||||
ExeAddr = *SectionTableAddr++;
|
||||
SectionLen = *SectionTableAddr++;
|
||||
data_init(LoadAddr, ExeAddr, SectionLen);
|
||||
}
|
||||
// At this point, SectionTableAddr = &__bss_section_table;
|
||||
// Zero fill the bss segment
|
||||
while (SectionTableAddr < &__bss_section_table_end) {
|
||||
ExeAddr = *SectionTableAddr++;
|
||||
SectionLen = *SectionTableAddr++;
|
||||
bss_init(ExeAddr, SectionLen);
|
||||
}
|
||||
|
||||
// **********************************************************
|
||||
// No need to call SystemInit() here, as master CM4 cpu will
|
||||
// have done the main system set up before enabling CM0.
|
||||
// **********************************************************
|
||||
|
||||
#if defined (__cplusplus)
|
||||
//
|
||||
// Call C++ library initialisation
|
||||
//
|
||||
__libc_init_array();
|
||||
#endif
|
||||
|
||||
#if defined (__REDLIB__)
|
||||
// Call the Redlib library, which in turn calls main()
|
||||
__main() ;
|
||||
#else
|
||||
main();
|
||||
#endif
|
||||
|
||||
//
|
||||
// main() shouldn't return, but if it does, we'll just enter an infinite loop
|
||||
//
|
||||
while (1) {
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
// Default exception handlers. Override the ones here by defining your own
|
||||
// handler routines in your application code.
|
||||
//*****************************************************************************
|
||||
__attribute__ ((section(".after_vectors")))
|
||||
#if defined (__USE_LPCOPEN)
|
||||
void NMI_Handler(void)
|
||||
#else
|
||||
void M0S_NMI_Handler(void)
|
||||
#endif
|
||||
{ while(1) { }
|
||||
}
|
||||
|
||||
__attribute__ ((section(".after_vectors")))
|
||||
#if defined (__USE_LPCOPEN)
|
||||
void HardFault_Handler(void)
|
||||
#else
|
||||
void M0S_HardFault_Handler(void)
|
||||
#endif
|
||||
{ while(1) { }
|
||||
}
|
||||
|
||||
__attribute__ ((section(".after_vectors")))
|
||||
#if defined (__USE_LPCOPEN)
|
||||
void SVC_Handler(void)
|
||||
#else
|
||||
void M0S_SVC_Handler(void)
|
||||
#endif
|
||||
{ while(1) { }
|
||||
}
|
||||
|
||||
__attribute__ ((section(".after_vectors")))
|
||||
#if defined (__USE_LPCOPEN)
|
||||
void PendSV_Handler(void)
|
||||
#else
|
||||
void M0S_PendSV_Handler(void)
|
||||
#endif
|
||||
{ while(1) { }
|
||||
}
|
||||
|
||||
__attribute__ ((section(".after_vectors")))
|
||||
#if defined (__USE_LPCOPEN)
|
||||
void SysTick_Handler(void)
|
||||
#else
|
||||
void M0S_SysTick_Handler(void)
|
||||
#endif
|
||||
{ while(1) { }
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Processor ends up here if an unexpected interrupt occurs or a specific
|
||||
// handler is not present in the application code.
|
||||
//
|
||||
//*****************************************************************************
|
||||
__attribute__ ((section(".after_vectors")))
|
||||
#if defined (__USE_LPCOPEN)
|
||||
void IntDefaultHandler(void)
|
||||
#else
|
||||
void M0S_IntDefaultHandler(void)
|
||||
#endif
|
||||
{ while(1) { }
|
||||
}
|
||||
@@ -0,0 +1,431 @@
|
||||
;/*****************************************************************************
|
||||
; * @file: startup_LPC18xx.s
|
||||
; * @purpose: CMSIS Cortex-M3 Core Device Startup File
|
||||
; * for the NXP LPC18xx Device Series
|
||||
; * @version: V1.00
|
||||
; * @date: 24. May. 2011
|
||||
; *----------------------------------------------------------------------------
|
||||
; *
|
||||
; * Copyright (C) 2010 ARM Limited. All rights reserved.
|
||||
; *
|
||||
; * ARM Limited (ARM) is supplying this software for use with Cortex-Mx
|
||||
; * processor based microcontrollers. This file can be freely distributed
|
||||
; * within development tools that are supporting such ARM based processors.
|
||||
; *
|
||||
; * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
|
||||
; * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
|
||||
; * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
|
||||
; * ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
|
||||
; * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
|
||||
; *
|
||||
; ******************************************************************************/
|
||||
|
||||
|
||||
;
|
||||
; The modules in this file are included in the libraries, and may be replaced
|
||||
; by any user-defined modules that define the PUBLIC symbol _program_start or
|
||||
; a user defined start symbol.
|
||||
; To override the cstartup defined in the library, simply add your modified
|
||||
; version to the workbench project.
|
||||
;
|
||||
; The vector table is normally located at address 0.
|
||||
; When debugging in RAM, it can be located in RAM, aligned to at least 2^6.
|
||||
; The name "__vector_table" has special meaning for C-SPY:
|
||||
; it is where the SP start value is found, and the NVIC vector
|
||||
; table register (VTOR) is initialized to this address if != 0.
|
||||
;
|
||||
; Cortex-M version
|
||||
;
|
||||
|
||||
MODULE ?cstartup
|
||||
|
||||
;; Forward declaration of sections.
|
||||
SECTION CSTACK:DATA:NOROOT(3)
|
||||
|
||||
SECTION .intvec:CODE:NOROOT(2)
|
||||
|
||||
EXTERN __iar_program_start
|
||||
EXTERN SystemInit
|
||||
PUBLIC __vector_table
|
||||
PUBLIC __vector_table_0x1c
|
||||
PUBLIC __Vectors
|
||||
PUBLIC __Vectors_End
|
||||
PUBLIC __Vectors_Size
|
||||
|
||||
DATA
|
||||
|
||||
Sign_Value EQU 0x5A5A5A5A
|
||||
|
||||
__vector_table
|
||||
DCD sfe(CSTACK)
|
||||
DCD Reset_Handler
|
||||
|
||||
DCD NMI_Handler
|
||||
DCD HardFault_Handler
|
||||
DCD MemManage_Handler
|
||||
DCD BusFault_Handler
|
||||
DCD UsageFault_Handler
|
||||
__vector_table_0x1c
|
||||
DCD Sign_Value
|
||||
DCD 0
|
||||
DCD 0
|
||||
DCD 0
|
||||
DCD SVC_Handler
|
||||
DCD DebugMon_Handler
|
||||
DCD 0
|
||||
DCD PendSV_Handler
|
||||
DCD SysTick_Handler
|
||||
|
||||
; External Interrupts
|
||||
DCD DAC_IRQHandler ; 16 D/A Converter
|
||||
DCD 0 ; 17 Event Router
|
||||
DCD DMA_IRQHandler ; 18 General Purpose DMA
|
||||
DCD 0 ; 19 Reserved
|
||||
DCD 0 ; 20 Reserved
|
||||
DCD ETH_IRQHandler ; 21 Ethernet
|
||||
DCD SDIO_IRQHandler ; 22 SD/MMC
|
||||
DCD LCD_IRQHandler ; 23 LCD
|
||||
DCD USB0_IRQHandler ; 24 USB0
|
||||
DCD USB1_IRQHandler ; 25 USB1
|
||||
DCD SCT_IRQHandler ; 26 State Configurable Timer
|
||||
DCD RIT_IRQHandler ; 27 Repetitive Interrupt Timer
|
||||
DCD TIMER0_IRQHandler ; 28 Timer0
|
||||
DCD TIMER1_IRQHandler ; 29 Timer1
|
||||
DCD TIMER2_IRQHandler ; 30 Timer2
|
||||
DCD TIMER3_IRQHandler ; 31 Timer3
|
||||
DCD MCPWM_IRQHandler ; 32 Motor Control PWM
|
||||
DCD ADC0_IRQHandler ; 33 A/D Converter 0
|
||||
DCD I2C0_IRQHandler ; 34 I2C0
|
||||
DCD I2C1_IRQHandler ; 35 I2C1
|
||||
DCD 0 ; 36 Reserved
|
||||
DCD ADC1_IRQHandler ; 37 A/D Converter 1
|
||||
DCD SSP0_IRQHandler ; 38 SSP0
|
||||
DCD SSP1_IRQHandler ; 39 SSP1
|
||||
DCD UART0_IRQHandler ; 40 UART0
|
||||
DCD UART1_IRQHandler ; 41 UART1
|
||||
DCD UART2_IRQHandler ; 42 UART2
|
||||
DCD UART3_IRQHandler ; 43 UART3
|
||||
DCD I2S0_IRQHandler ; 44 I2S0
|
||||
DCD I2S1_IRQHandler ; 45 I2S1
|
||||
DCD SPIFI_IRQHandler ; 46 SPI Flash Interface
|
||||
DCD SGPIO_IRQHandler ; 47 SGPIO
|
||||
DCD GPIO0_IRQHandler ; 48 GPIO0
|
||||
DCD GPIO1_IRQHandler ; 49 GPIO1
|
||||
DCD GPIO2_IRQHandler ; 50 GPIO2
|
||||
DCD GPIO3_IRQHandler ; 51 GPIO3
|
||||
DCD GPIO4_IRQHandler ; 52 GPIO4
|
||||
DCD GPIO5_IRQHandler ; 53 GPIO5
|
||||
DCD GPIO6_IRQHandler ; 54 GPIO6
|
||||
DCD GPIO7_IRQHandler ; 55 GPIO7
|
||||
DCD GINT0_IRQHandler ; 56 GINT0
|
||||
DCD GINT1_IRQHandler ; 57 GINT1
|
||||
DCD EVRT_IRQHandler ; 58 Event Router
|
||||
DCD CAN1_IRQHandler ; 59 C_CAN1
|
||||
DCD 0 ; 60 Reserved
|
||||
DCD 0 ; 61 VADC
|
||||
DCD ATIMER_IRQHandler ; 62 ATIMER
|
||||
DCD RTC_IRQHandler ; 63 RTC
|
||||
DCD 0 ; 64 Reserved
|
||||
DCD WDT_IRQHandler ; 65 WDT
|
||||
DCD 0 ; 66 M0s
|
||||
DCD CAN0_IRQHandler ; 67 C_CAN0
|
||||
DCD QEI_IRQHandler ; 68 QEI
|
||||
__Vectors_End
|
||||
|
||||
__Vectors EQU __vector_table
|
||||
__Vectors_Size EQU __Vectors_End - __Vectors
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; Default interrupt handlers.
|
||||
;;
|
||||
THUMB
|
||||
|
||||
PUBWEAK Reset_Handler
|
||||
SECTION .text:CODE:REORDER(2)
|
||||
Reset_Handler
|
||||
LDR R0, =__iar_program_start
|
||||
BX R0
|
||||
|
||||
PUBWEAK NMI_Handler
|
||||
SECTION .text:CODE:REORDER(1)
|
||||
NMI_Handler
|
||||
B NMI_Handler
|
||||
|
||||
PUBWEAK HardFault_Handler
|
||||
SECTION .text:CODE:REORDER(1)
|
||||
HardFault_Handler
|
||||
B HardFault_Handler
|
||||
|
||||
PUBWEAK MemManage_Handler
|
||||
SECTION .text:CODE:REORDER(1)
|
||||
MemManage_Handler
|
||||
B MemManage_Handler
|
||||
|
||||
PUBWEAK BusFault_Handler
|
||||
SECTION .text:CODE:REORDER(1)
|
||||
BusFault_Handler
|
||||
B BusFault_Handler
|
||||
|
||||
PUBWEAK UsageFault_Handler
|
||||
SECTION .text:CODE:REORDER(1)
|
||||
UsageFault_Handler
|
||||
B UsageFault_Handler
|
||||
|
||||
PUBWEAK SVC_Handler
|
||||
SECTION .text:CODE:REORDER(1)
|
||||
SVC_Handler
|
||||
B SVC_Handler
|
||||
|
||||
PUBWEAK DebugMon_Handler
|
||||
SECTION .text:CODE:REORDER(1)
|
||||
DebugMon_Handler
|
||||
B DebugMon_Handler
|
||||
|
||||
PUBWEAK PendSV_Handler
|
||||
SECTION .text:CODE:REORDER(1)
|
||||
PendSV_Handler
|
||||
B PendSV_Handler
|
||||
|
||||
PUBWEAK SysTick_Handler
|
||||
SECTION .text:CODE:REORDER(1)
|
||||
SysTick_Handler
|
||||
B SysTick_Handler
|
||||
|
||||
PUBWEAK DAC_IRQHandler
|
||||
SECTION .text:CODE:REORDER(1)
|
||||
DAC_IRQHandler
|
||||
B DAC_IRQHandler
|
||||
|
||||
PUBWEAK EVRT_IRQHandler
|
||||
SECTION .text:CODE:REORDER(1)
|
||||
EVRT_IRQHandler
|
||||
B EVRT_IRQHandler
|
||||
|
||||
PUBWEAK DMA_IRQHandler
|
||||
SECTION .text:CODE:REORDER(1)
|
||||
DMA_IRQHandler
|
||||
B DMA_IRQHandler
|
||||
|
||||
PUBWEAK ETH_IRQHandler
|
||||
SECTION .text:CODE:REORDER(1)
|
||||
ETH_IRQHandler
|
||||
B ETH_IRQHandler
|
||||
|
||||
PUBWEAK SDIO_IRQHandler
|
||||
SECTION .text:CODE:REORDER(1)
|
||||
SDIO_IRQHandler
|
||||
B SDIO_IRQHandler
|
||||
|
||||
PUBWEAK LCD_IRQHandler
|
||||
SECTION .text:CODE:REORDER(1)
|
||||
LCD_IRQHandler
|
||||
B LCD_IRQHandler
|
||||
|
||||
PUBWEAK USB0_IRQHandler
|
||||
SECTION .text:CODE:REORDER(1)
|
||||
USB0_IRQHandler
|
||||
B USB0_IRQHandler
|
||||
|
||||
PUBWEAK USB1_IRQHandler
|
||||
SECTION .text:CODE:REORDER(1)
|
||||
USB1_IRQHandler
|
||||
B USB1_IRQHandler
|
||||
|
||||
PUBWEAK SCT_IRQHandler
|
||||
SECTION .text:CODE:REORDER(1)
|
||||
SCT_IRQHandler
|
||||
B SCT_IRQHandler
|
||||
|
||||
PUBWEAK RIT_IRQHandler
|
||||
SECTION .text:CODE:REORDER(1)
|
||||
RIT_IRQHandler
|
||||
B RIT_IRQHandler
|
||||
|
||||
PUBWEAK TIMER0_IRQHandler
|
||||
SECTION .text:CODE:REORDER(1)
|
||||
TIMER0_IRQHandler
|
||||
B TIMER0_IRQHandler
|
||||
|
||||
PUBWEAK TIMER1_IRQHandler
|
||||
SECTION .text:CODE:REORDER(1)
|
||||
TIMER1_IRQHandler
|
||||
B TIMER1_IRQHandler
|
||||
|
||||
PUBWEAK TIMER2_IRQHandler
|
||||
SECTION .text:CODE:REORDER(1)
|
||||
TIMER2_IRQHandler
|
||||
B TIMER2_IRQHandler
|
||||
|
||||
PUBWEAK TIMER3_IRQHandler
|
||||
SECTION .text:CODE:REORDER(1)
|
||||
TIMER3_IRQHandler
|
||||
B TIMER3_IRQHandler
|
||||
|
||||
PUBWEAK MCPWM_IRQHandler
|
||||
SECTION .text:CODE:REORDER(1)
|
||||
MCPWM_IRQHandler
|
||||
B MCPWM_IRQHandler
|
||||
|
||||
PUBWEAK ADC0_IRQHandler
|
||||
SECTION .text:CODE:REORDER(1)
|
||||
ADC0_IRQHandler
|
||||
B ADC0_IRQHandler
|
||||
|
||||
PUBWEAK I2C0_IRQHandler
|
||||
SECTION .text:CODE:REORDER(1)
|
||||
I2C0_IRQHandler
|
||||
B I2C0_IRQHandler
|
||||
|
||||
PUBWEAK I2C1_IRQHandler
|
||||
SECTION .text:CODE:REORDER(1)
|
||||
I2C1_IRQHandler
|
||||
B I2C1_IRQHandler
|
||||
|
||||
PUBWEAK ADC1_IRQHandler
|
||||
SECTION .text:CODE:REORDER(1)
|
||||
ADC1_IRQHandler
|
||||
B ADC1_IRQHandler
|
||||
|
||||
PUBWEAK SSP0_IRQHandler
|
||||
SECTION .text:CODE:REORDER(1)
|
||||
SSP0_IRQHandler
|
||||
B SSP0_IRQHandler
|
||||
|
||||
PUBWEAK SSP1_IRQHandler
|
||||
SECTION .text:CODE:REORDER(1)
|
||||
SSP1_IRQHandler
|
||||
B SSP1_IRQHandler
|
||||
|
||||
PUBWEAK UART0_IRQHandler
|
||||
SECTION .text:CODE:REORDER(1)
|
||||
UART0_IRQHandler
|
||||
B UART0_IRQHandler
|
||||
|
||||
PUBWEAK UART1_IRQHandler
|
||||
SECTION .text:CODE:REORDER(1)
|
||||
UART1_IRQHandler
|
||||
B UART1_IRQHandler
|
||||
|
||||
PUBWEAK UART2_IRQHandler
|
||||
SECTION .text:CODE:REORDER(1)
|
||||
UART2_IRQHandler
|
||||
B UART2_IRQHandler
|
||||
|
||||
PUBWEAK UART3_IRQHandler
|
||||
SECTION .text:CODE:REORDER(1)
|
||||
UART3_IRQHandler
|
||||
B UART3_IRQHandler
|
||||
|
||||
PUBWEAK I2S0_IRQHandler
|
||||
SECTION .text:CODE:REORDER(1)
|
||||
I2S0_IRQHandler
|
||||
B I2S0_IRQHandler
|
||||
|
||||
PUBWEAK I2S1_IRQHandler
|
||||
SECTION .text:CODE:REORDER(1)
|
||||
I2S1_IRQHandler
|
||||
B I2S1_IRQHandler
|
||||
|
||||
PUBWEAK AES_IRQHandler
|
||||
SECTION .text:CODE:REORDER(1)
|
||||
AES_IRQHandler
|
||||
B AES_IRQHandler
|
||||
|
||||
PUBWEAK SPIFI_IRQHandler
|
||||
SECTION .text:CODE:REORDER(1)
|
||||
SPIFI_IRQHandler
|
||||
B SPIFI_IRQHandler
|
||||
|
||||
PUBWEAK SGPIO_IRQHandler
|
||||
SECTION .text:CODE:REORDER(1)
|
||||
SGPIO_IRQHandler
|
||||
B SGPIO_IRQHandler
|
||||
|
||||
PUBWEAK GPIO0_IRQHandler
|
||||
SECTION .text:CODE:REORDER(1)
|
||||
GPIO0_IRQHandler
|
||||
B GPIO0_IRQHandler
|
||||
|
||||
PUBWEAK GPIO1_IRQHandler
|
||||
SECTION .text:CODE:REORDER(1)
|
||||
GPIO1_IRQHandler
|
||||
B GPIO1_IRQHandler
|
||||
|
||||
PUBWEAK GPIO2_IRQHandler
|
||||
SECTION .text:CODE:REORDER(1)
|
||||
GPIO2_IRQHandler
|
||||
B GPIO2_IRQHandler
|
||||
|
||||
PUBWEAK GPIO3_IRQHandler
|
||||
SECTION .text:CODE:REORDER(1)
|
||||
GPIO3_IRQHandler
|
||||
B GPIO3_IRQHandler
|
||||
|
||||
PUBWEAK GPIO4_IRQHandler
|
||||
SECTION .text:CODE:REORDER(1)
|
||||
GPIO4_IRQHandler
|
||||
B GPIO4_IRQHandler
|
||||
|
||||
PUBWEAK GPIO5_IRQHandler
|
||||
SECTION .text:CODE:REORDER(1)
|
||||
GPIO5_IRQHandler
|
||||
B GPIO5_IRQHandler
|
||||
|
||||
PUBWEAK GPIO6_IRQHandler
|
||||
SECTION .text:CODE:REORDER(1)
|
||||
GPIO6_IRQHandler
|
||||
B GPIO6_IRQHandler
|
||||
|
||||
PUBWEAK GPIO7_IRQHandler
|
||||
SECTION .text:CODE:REORDER(1)
|
||||
GPIO7_IRQHandler
|
||||
B GPIO7_IRQHandler
|
||||
|
||||
PUBWEAK GINT0_IRQHandler
|
||||
SECTION .text:CODE:REORDER(1)
|
||||
GINT0_IRQHandler
|
||||
B GINT0_IRQHandler
|
||||
|
||||
PUBWEAK GINT1_IRQHandler
|
||||
SECTION .text:CODE:REORDER(1)
|
||||
GINT1_IRQHandler
|
||||
B GINT1_IRQHandler
|
||||
|
||||
PUBWEAK CAN1_IRQHandler
|
||||
SECTION .text:CODE:REORDER(1)
|
||||
CAN1_IRQHandler
|
||||
B CAN1_IRQHandler
|
||||
|
||||
PUBWEAK ATIMER_IRQHandler
|
||||
SECTION .text:CODE:REORDER(1)
|
||||
ATIMER_IRQHandler
|
||||
B ATIMER_IRQHandler
|
||||
|
||||
PUBWEAK RTC_IRQHandler
|
||||
SECTION .text:CODE:REORDER(1)
|
||||
RTC_IRQHandler
|
||||
B RTC_IRQHandler
|
||||
|
||||
PUBWEAK WDT_IRQHandler
|
||||
SECTION .text:CODE:REORDER(1)
|
||||
WDT_IRQHandler
|
||||
B WDT_IRQHandler
|
||||
|
||||
PUBWEAK CAN0_IRQHandler
|
||||
SECTION .text:CODE:REORDER(1)
|
||||
CAN0_IRQHandler
|
||||
B CAN0_IRQHandler
|
||||
|
||||
PUBWEAK QEI_IRQHandler
|
||||
SECTION .text:CODE:REORDER(1)
|
||||
QEI_IRQHandler
|
||||
B QEI_IRQHandler
|
||||
|
||||
PUBWEAK getPC
|
||||
SECTION .text:CODE:REORDER(2)
|
||||
getPC
|
||||
MOV R0,LR
|
||||
BX LR
|
||||
END
|
||||
@@ -0,0 +1,242 @@
|
||||
/**************************************************
|
||||
*
|
||||
* Part one of the system initialization code, contains low-level
|
||||
* initialization, plain thumb variant.
|
||||
*
|
||||
* Copyright 2011 IAR Systems. All rights reserved.
|
||||
*
|
||||
* $Revision: 47876 $
|
||||
*
|
||||
**************************************************/
|
||||
|
||||
;
|
||||
; The modules in this file are included in the libraries, and may be replaced
|
||||
; by any user-defined modules that define the PUBLIC symbol _program_start or
|
||||
; a user defined start symbol.
|
||||
; To override the cstartup defined in the library, simply add your modified
|
||||
; version to the workbench project.
|
||||
;
|
||||
; The vector table is normally located at address 0.
|
||||
; When debugging in RAM, it can be located in RAM, aligned to at least 2^6.
|
||||
; The name "__vector_table" has special meaning for C-SPY:
|
||||
; it is where the SP start value is found, and the NVIC vector
|
||||
; table register (VTOR) is initialized to this address if != 0.
|
||||
;
|
||||
; Cortex-M version
|
||||
;
|
||||
|
||||
|
||||
MODULE ?cstartup
|
||||
|
||||
;; Forward declaration of sections.
|
||||
SECTION CSTACK:DATA:NOROOT(3)
|
||||
|
||||
SECTION .intvec:CODE:NOROOT(2)
|
||||
|
||||
EXTERN __iar_program_start
|
||||
EXTERN SystemInit
|
||||
PUBLIC __vector_table
|
||||
PUBLIC __vector_table_0x1c
|
||||
PUBLIC __Vectors
|
||||
PUBLIC __Vectors_End
|
||||
PUBLIC __Vectors_Size
|
||||
|
||||
|
||||
DATA
|
||||
|
||||
__vector_table
|
||||
DCD sfe(CSTACK)
|
||||
DCD Reset_Handler
|
||||
DCD NMI_Handler
|
||||
DCD HardFault_Handler
|
||||
DCD MemManage_Handler
|
||||
DCD BusFault_Handler
|
||||
DCD UsageFault_Handler
|
||||
__vector_table_0x1c
|
||||
DCD 0
|
||||
DCD 0
|
||||
DCD 0
|
||||
DCD 0
|
||||
DCD SVC_Handler
|
||||
DCD DebugMon_Handler
|
||||
DCD 0
|
||||
DCD PendSV_Handler
|
||||
DCD SysTick_Handler
|
||||
|
||||
; External Interrupts
|
||||
DCD DAC_IRQHandler
|
||||
DCD M4_IRQHandler
|
||||
DCD DMA_IRQHandler
|
||||
DCD 0
|
||||
DCD SGPIO_INPUT_IRQHandler
|
||||
DCD SGPIO_MATCH_IRQHandler
|
||||
DCD SGPIO_SHIFT_IRQHandler
|
||||
DCD SGPIO_POS_IRQHandler
|
||||
DCD USB0_IRQHandler
|
||||
DCD USB1_IRQHandler
|
||||
DCD SCT_IRQHandler
|
||||
DCD RIT_IRQHandler
|
||||
DCD GINT1_IRQHandler
|
||||
DCD TIMER1_IRQHandler
|
||||
DCD TIMER2_IRQHandler
|
||||
DCD GPIO5_IRQHandler
|
||||
DCD MCPWM_IRQHandler
|
||||
DCD ADC0_IRQHandler
|
||||
DCD I2C0_IRQHandler
|
||||
DCD I2C1_IRQHandler
|
||||
DCD SPI_IRQHandler
|
||||
DCD ADC1_IRQHandler
|
||||
DCD SSP0_SSP1_IRQHandler
|
||||
DCD EVRT_IRQHandler
|
||||
DCD UART0_IRQHandler
|
||||
DCD UART1_IRQHandler
|
||||
DCD UART2_CAN1_IRQHandler
|
||||
DCD UART3_IRQHandler
|
||||
DCD I2S0_I2S1_QEI_IRQHandler
|
||||
DCD CAN0_IRQHandler
|
||||
DCD SPIFI_ADCHS_IRQHandler
|
||||
DCD M0APP_IRQHandler
|
||||
__Vectors_End
|
||||
|
||||
__Vectors EQU __vector_table
|
||||
__Vectors_Size EQU __Vectors_End - __Vectors
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; Default interrupt handlers.
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
THUMB
|
||||
|
||||
PUBWEAK Reset_Handler
|
||||
SECTION .text:CODE:REORDER(2)
|
||||
Reset_Handler
|
||||
LDR R0, =SystemInit
|
||||
BLX R0
|
||||
LDR R0, =__iar_program_start
|
||||
BX R0
|
||||
|
||||
PUBWEAK NMI_Handler
|
||||
PUBWEAK HardFault_Handler
|
||||
PUBWEAK MemManage_Handler
|
||||
PUBWEAK BusFault_Handler
|
||||
PUBWEAK UsageFault_Handler
|
||||
PUBWEAK SVC_Handler
|
||||
PUBWEAK DebugMon_Handler
|
||||
PUBWEAK PendSV_Handler
|
||||
PUBWEAK SysTick_Handler
|
||||
|
||||
PUBWEAK DAC_IRQHandler
|
||||
PUBWEAK M4_IRQHandler
|
||||
PUBWEAK DMA_IRQHandler
|
||||
PUBWEAK UnHandled_Vector
|
||||
PUBWEAK SGPIO_INPUT_IRQHandler
|
||||
PUBWEAK SGPIO_MATCH_IRQHandler
|
||||
PUBWEAK SGPIO_SHIFT_IRQHandler
|
||||
PUBWEAK SGPIO_POS_IRQHandler
|
||||
PUBWEAK USB0_IRQHandler
|
||||
PUBWEAK USB1_IRQHandler
|
||||
PUBWEAK SCT_IRQHandler
|
||||
PUBWEAK RIT_IRQHandler
|
||||
PUBWEAK GINT1_IRQHandler
|
||||
PUBWEAK TIMER1_IRQHandler
|
||||
PUBWEAK TIMER2_IRQHandler
|
||||
PUBWEAK GPIO5_IRQHandler
|
||||
PUBWEAK MCPWM_IRQHandler
|
||||
PUBWEAK ADC0_IRQHandler
|
||||
PUBWEAK I2C0_IRQHandler
|
||||
PUBWEAK I2C1_IRQHandler
|
||||
PUBWEAK SPI_IRQHandler
|
||||
PUBWEAK ADC1_IRQHandler
|
||||
PUBWEAK SSP0_SSP1_IRQHandler
|
||||
PUBWEAK EVRT_IRQHandler
|
||||
PUBWEAK UART0_IRQHandler
|
||||
PUBWEAK UART1_IRQHandler
|
||||
PUBWEAK UART2_CAN1_IRQHandler
|
||||
PUBWEAK UART3_IRQHandler
|
||||
PUBWEAK I2S0_I2S1_QEI_IRQHandler
|
||||
PUBWEAK CAN0_IRQHandler
|
||||
PUBWEAK SPIFI_ADCHS_IRQHandler
|
||||
PUBWEAK M0APP_IRQHandler
|
||||
|
||||
SECTION .text:CODE:REORDER(1)
|
||||
NMI_Handler
|
||||
B .
|
||||
SVC_Handler
|
||||
B .
|
||||
DebugMon_Handler
|
||||
B .
|
||||
PendSV_Handler
|
||||
B .
|
||||
SysTick_Handler
|
||||
B .
|
||||
HardFault_Handler
|
||||
B .
|
||||
MemManage_Handler
|
||||
B .
|
||||
BusFault_Handler
|
||||
B .
|
||||
UsageFault_Handler
|
||||
DAC_IRQHandler
|
||||
M4_IRQHandler
|
||||
DMA_IRQHandler
|
||||
UnHandled_Vector
|
||||
SGPIO_INPUT_IRQHandler
|
||||
SGPIO_MATCH_IRQHandler
|
||||
SGPIO_SHIFT_IRQHandler
|
||||
SGPIO_POS_IRQHandler
|
||||
USB0_IRQHandler
|
||||
USB1_IRQHandler
|
||||
SCT_IRQHandler
|
||||
RIT_IRQHandler
|
||||
GINT1_IRQHandler
|
||||
TIMER1_IRQHandler
|
||||
TIMER2_IRQHandler
|
||||
GPIO5_IRQHandler
|
||||
MCPWM_IRQHandler
|
||||
ADC0_IRQHandler
|
||||
I2C0_IRQHandler
|
||||
I2C1_IRQHandler
|
||||
SPI_IRQHandler
|
||||
ADC1_IRQHandler
|
||||
SSP0_SSP1_IRQHandler
|
||||
EVRT_IRQHandler
|
||||
UART0_IRQHandler
|
||||
UART1_IRQHandler
|
||||
UART2_CAN1_IRQHandler
|
||||
UART3_IRQHandler
|
||||
I2S0_I2S1_QEI_IRQHandler
|
||||
CAN0_IRQHandler
|
||||
SPIFI_ADCHS_IRQHandler
|
||||
M0APP_IRQHandler
|
||||
Default_IRQHandler
|
||||
B .
|
||||
|
||||
/* CRP Section - not needed for flashless devices */
|
||||
|
||||
;;; SECTION .crp:CODE:ROOT(2)
|
||||
;;; DATA
|
||||
/* Code Read Protection
|
||||
NO_ISP 0x4E697370 - Prevents sampling of pin PIO0_1 for entering ISP mode
|
||||
CRP1 0x12345678 - Write to RAM command cannot access RAM below 0x10000300.
|
||||
- Copy RAM to flash command can not write to Sector 0.
|
||||
- Erase command can erase Sector 0 only when all sectors
|
||||
are selected for erase.
|
||||
- Compare command is disabled.
|
||||
- Read Memory command is disabled.
|
||||
CRP2 0x87654321 - Read Memory is disabled.
|
||||
- Write to RAM is disabled.
|
||||
- "Go" command is disabled.
|
||||
- Copy RAM to flash is disabled.
|
||||
- Compare is disabled.
|
||||
CRP3 0x43218765 - Access to chip via the SWD pins is disabled. ISP entry
|
||||
by pulling PIO0_1 LOW is disabled if a valid user code is
|
||||
present in flash sector 0.
|
||||
Caution: If CRP3 is selected, no future factory testing can be
|
||||
performed on the device.
|
||||
*/
|
||||
;;; DCD 0xFFFFFFFF
|
||||
;;;
|
||||
|
||||
END
|
||||
File diff suppressed because it is too large
Load Diff
30
bsp/lpc43xx/Libraries/Device/SConscript
Normal file
30
bsp/lpc43xx/Libraries/Device/SConscript
Normal file
@@ -0,0 +1,30 @@
|
||||
# RT-Thread building script for component
|
||||
|
||||
Import('rtconfig')
|
||||
from building import *
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
src = Split('''
|
||||
NXP/LPC43xx/Source/Templates/system_LPC43xx.c
|
||||
''')
|
||||
CPPPATH = [cwd + '/NXP/LPC43xx/Include', cwd + '/../CMSIS/Include']
|
||||
CPPDEFINES = [rtconfig.USE_CORE + ' USE_SPIFI']
|
||||
|
||||
# add for startup script
|
||||
if rtconfig.USE_CORE =='CORE_M4':
|
||||
if rtconfig.CROSS_TOOL == 'gcc':
|
||||
src += ['NXP/LPC43xx/Source/Templates/GCC/startup_LPC43xx.s']
|
||||
elif rtconfig.CROSS_TOOL == 'keil':
|
||||
src += ['NXP/LPC43xx/Source/Templates/ARM/startup_LPC43xx.s']
|
||||
elif rtconfig.CROSS_TOOL == 'iar':
|
||||
src += ['NXP/LPC43xx/Source/Templates/IAR/startup_LPC43xx.s']
|
||||
else:
|
||||
if rtconfig.CROSS_TOOL == 'gcc':
|
||||
src += ['NXP/LPC43xx/Source/Templates/GCC/startup_LPC43xx_M0.s']
|
||||
elif rtconfig.CROSS_TOOL == 'keil':
|
||||
src += ['NXP/LPC43xx/Source/Templates/ARM/startup_LPC43xx_M0.s']
|
||||
elif rtconfig.CROSS_TOOL == 'iar':
|
||||
src += ['NXP/LPC43xx/Source/Templates/IAR/startup_LPC43xx_M0.s']
|
||||
group = DefineGroup('CMSIS', src, depend = [''], CPPPATH = CPPPATH, CPPDEFINES = CPPDEFINES)
|
||||
|
||||
Return('group')
|
||||
15
bsp/lpc43xx/Libraries/SConscript
Normal file
15
bsp/lpc43xx/Libraries/SConscript
Normal file
@@ -0,0 +1,15 @@
|
||||
# RT-Thread building script for bridge
|
||||
|
||||
import os
|
||||
from building import *
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
objs = []
|
||||
list = os.listdir(cwd)
|
||||
|
||||
for d in list:
|
||||
path = os.path.join(cwd, d)
|
||||
if os.path.isfile(os.path.join(path, 'SConscript')):
|
||||
objs = objs + SConscript(os.path.join(d, 'SConscript'))
|
||||
|
||||
Return('objs')
|
||||
13
bsp/lpc43xx/M0/SConscript
Normal file
13
bsp/lpc43xx/M0/SConscript
Normal file
@@ -0,0 +1,13 @@
|
||||
from building import *
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
objs = []
|
||||
list = os.listdir(os.path.join(cwd, '..'))
|
||||
|
||||
for d in list:
|
||||
if (d != 'M4' and d != 'M0'):
|
||||
path = os.path.join(cwd, '..', d)
|
||||
if os.path.isfile(os.path.join(path, 'SConscript')):
|
||||
objs = objs + SConscript(os.path.join(path, 'SConscript'))
|
||||
|
||||
Return('objs')
|
||||
29
bsp/lpc43xx/M0/SConstruct
Normal file
29
bsp/lpc43xx/M0/SConstruct
Normal file
@@ -0,0 +1,29 @@
|
||||
import os
|
||||
import sys
|
||||
import rtconfig
|
||||
|
||||
if os.getenv('RTT_ROOT'):
|
||||
RTT_ROOT = os.getenv('RTT_ROOT')
|
||||
else:
|
||||
RTT_ROOT = os.path.join(Dir('#').get_abspath(), '..', '..', 'rt-thread')
|
||||
|
||||
sys.path = sys.path + [os.path.join(RTT_ROOT, 'tools')]
|
||||
from building import *
|
||||
|
||||
TARGET = 'rtthread-lpc40xx.' + rtconfig.TARGET_EXT
|
||||
|
||||
env = Environment(tools = ['mingw'],
|
||||
AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
|
||||
CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS,
|
||||
AR = rtconfig.AR, ARFLAGS = '-rc',
|
||||
LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
|
||||
env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
|
||||
|
||||
Export('RTT_ROOT')
|
||||
Export('rtconfig')
|
||||
|
||||
# prepare building environment
|
||||
objs = PrepareBuilding(env, RTT_ROOT, has_libcpu=False)
|
||||
|
||||
# do building
|
||||
DoBuilding(TARGET, objs)
|
||||
230
bsp/lpc43xx/M0/rtconfig.h
Normal file
230
bsp/lpc43xx/M0/rtconfig.h
Normal file
@@ -0,0 +1,230 @@
|
||||
/* RT-Thread config file */
|
||||
#ifndef __RTTHREAD_CFG_H__
|
||||
#define __RTTHREAD_CFG_H__
|
||||
|
||||
// <RDTConfigurator URL="http://www.rt-thread.com/eclipse">
|
||||
|
||||
// <integer name="RT_NAME_MAX" description="Maximal size of kernel object name length" default="6" />
|
||||
#define RT_NAME_MAX 8
|
||||
// <integer name="RT_ALIGN_SIZE" description="Alignment size for CPU architecture data access" default="4" />
|
||||
#define RT_ALIGN_SIZE 4
|
||||
// <integer name="RT_THREAD_PRIORITY_MAX" description="Maximal level of thread priority" default="32">
|
||||
// <item description="8">8</item>
|
||||
// <item description="32">32</item>
|
||||
// <item description="256">256</item>
|
||||
// </integer>
|
||||
#define RT_THREAD_PRIORITY_MAX 32
|
||||
// <integer name="RT_TICK_PER_SECOND" description="OS tick per second" default="100" />
|
||||
#define RT_TICK_PER_SECOND 1000
|
||||
// <integer name="IDLE_THREAD_STACK_SIZE" description="The stack size of idle thread" default="512" />
|
||||
#define IDLE_THREAD_STACK_SIZE 512
|
||||
// <bool name="RT_USING_MODULE" description="Using Application Module" default="true" />
|
||||
//#define RT_USING_MODULE
|
||||
// <section name="RT_DEBUG" description="Kernel Debug Configuration" default="true" >
|
||||
#define RT_DEBUG
|
||||
// <bool name="RT_DEBUG_INIT" description="debug init enable" default=0 />
|
||||
#define RT_DEBUG_INIT 0
|
||||
// <bool name="RT_THREAD_DEBUG" description="Thread debug enable" default="false" />
|
||||
// #define RT_THREAD_DEBUG
|
||||
// <bool name="RT_USING_OVERFLOW_CHECK" description="Thread stack over flow detect" default="true" />
|
||||
#define RT_USING_OVERFLOW_CHECK
|
||||
// </section>
|
||||
|
||||
// <bool name="RT_USING_HOOK" description="Using hook functions" default="true" />
|
||||
#define RT_USING_HOOK
|
||||
// <section name="RT_USING_TIMER_SOFT" description="Using software timer which will start a thread to handle soft-timer" default="true" >
|
||||
#define RT_USING_TIMER_SOFT
|
||||
// <integer name="RT_TIMER_THREAD_PRIO" description="The priority level of timer thread" default="4" />
|
||||
#define RT_TIMER_THREAD_PRIO 4
|
||||
// <integer name="RT_TIMER_THREAD_STACK_SIZE" description="The stack size of timer thread" default="512" />
|
||||
#define RT_TIMER_THREAD_STACK_SIZE 512
|
||||
// <integer name="RT_TIMER_TICK_PER_SECOND" description="The soft-timer tick per second" default="10" />
|
||||
#define RT_TIMER_TICK_PER_SECOND 100
|
||||
// </section>
|
||||
|
||||
// <section name="IPC" description="Inter-Thread communication" default="always" >
|
||||
// <bool name="RT_USING_SEMAPHORE" description="Using semaphore in the system" default="true" />
|
||||
#define RT_USING_SEMAPHORE
|
||||
// <bool name="RT_USING_MUTEX" description="Using mutex in the system" default="true" />
|
||||
#define RT_USING_MUTEX
|
||||
// <bool name="RT_USING_EVENT" description="Using event group in the system" default="true" />
|
||||
#define RT_USING_EVENT
|
||||
// <bool name="RT_USING_MAILBOX" description="Using mailbox in the system" default="true" />
|
||||
#define RT_USING_MAILBOX
|
||||
// <bool name="RT_USING_MESSAGEQUEUE" description="Using message queue in the system" default="true" />
|
||||
#define RT_USING_MESSAGEQUEUE
|
||||
// </section>
|
||||
|
||||
// <section name="MM" description="Memory Management" default="always" >
|
||||
// <bool name="RT_USING_MEMPOOL" description="Using Memory Pool Management in the system" default="true" />
|
||||
#define RT_USING_MEMPOOL
|
||||
// <bool name="RT_USING_MEMHEAP" description="Using Memory Heap Object in the system" default="true" />
|
||||
#define RT_USING_MEMHEAP
|
||||
// <bool name="RT_USING_HEAP" description="Using Dynamic Heap Management in the system" default="true" />
|
||||
#define RT_USING_HEAP
|
||||
// <bool name="RT_USING_SMALL_MEM" description="Optimizing for small memory" default="false" />
|
||||
#define RT_USING_SMALL_MEM
|
||||
// <bool name="RT_USING_SLAB" description="Using SLAB memory management for large memory" default="false" />
|
||||
// #define RT_USING_SLAB
|
||||
// </section>
|
||||
|
||||
// <section name="RT_USING_DEVICE" description="Using Device Driver Framework" default="true" >
|
||||
#define RT_USING_DEVICE
|
||||
// <bool name=RT_USING_DEVICE_IPC description="Using IPC in Device Driver Framework" default="true" />
|
||||
#define RT_USING_DEVICE_IPC
|
||||
// <bool name="RT_USING_SERIAL" description="Using Serial Device Driver Framework" default="true" />
|
||||
#define RT_USING_SERIAL
|
||||
// <integer name="RT_UART_RX_BUFFER_SIZE" description="The buffer size for UART reception" default="64" />
|
||||
#define RT_UART_RX_BUFFER_SIZE 256
|
||||
// <bool name="RT_USING_MTD_NAND" description="Using MTD NAND Framework" default="true" />
|
||||
//#define RT_USING_MTD_NAND
|
||||
// <bool name="RT_MTD_NAND_DEBUG" description="Enable MTD NAND Framework Debug" default="true" />
|
||||
//#define RT_MTD_NAND_DEBUG
|
||||
// <bool name="RT_USING_NFTL" description="Using NFTL layer" default="true" />
|
||||
//#define RT_USING_NFTL
|
||||
// <bool name="RT_USING_SPI" description="Using SPI Device Driver Framework" default="true" />
|
||||
//#define RT_USING_SPI
|
||||
// <bool name="RT_USING_I2C" description="Using I2C Device Driver Framework" default="true" />
|
||||
//#define RT_USING_I2C
|
||||
// <bool name="RT_USING_RTC" description="Using RTC Device Driver Framework" default="true" />
|
||||
//#define RT_USING_RTC
|
||||
// <integer name="RT_MMCSD_THREAD_PREORITY" description="The prority of mmcsd thread" default="15" />
|
||||
#define RT_MMCSD_THREAD_PREORITY 15
|
||||
// <section name="RT_USING_CONSOLE" description="Using console" default="true" >
|
||||
#define RT_USING_CONSOLE
|
||||
// <integer name="RT_CONSOLEBUF_SIZE" description="The buffer size for console output" default="128" />
|
||||
#define RT_CONSOLEBUF_SIZE 128
|
||||
// <string name="RT_CONSOLE_DEVICE_NAME" description="The device name for console" default="uart" />
|
||||
#define RT_CONSOLE_DEVICE_NAME "uart0"
|
||||
// </section>
|
||||
|
||||
// <bool name="RT_USING_COMPONENTS_INIT" description="Using RT-Thread components initialization" default="true" />
|
||||
//#define RT_USING_COMPONENTS_INIT
|
||||
// <section name="RT_USING_FINSH" description="Using finsh as shell, which is a C-Express shell" default="true" >
|
||||
#define RT_USING_FINSH
|
||||
// <bool name="FINSH_USING_SYMTAB" description="Using symbol table in finsh shell" default="true" />
|
||||
#define FINSH_USING_SYMTAB
|
||||
// <bool name="FINSH_USING_DESCRIPTION" description="Keeping description in symbol table" default="true" />
|
||||
#define FINSH_USING_DESCRIPTION
|
||||
// <integer name="FINSH_THREAD_STACK_SIZE" description="The stack size for finsh thread" default="4096" />
|
||||
#define FINSH_THREAD_STACK_SIZE 4096
|
||||
// <bool name="FINSH_USING_MSH" description="Using module shell in finsh" default="true" />
|
||||
//#define FINSH_USING_MSH
|
||||
// </section>
|
||||
|
||||
// <section name="LIBC" description="C Runtime library setting" default="always" >
|
||||
// <bool name="RT_USING_NEWLIB" description="Using newlib library, only available under GNU GCC" default="true" />
|
||||
// #define RT_USING_NEWLIB
|
||||
// <bool name="RT_USING_PTHREADS" description="Using POSIX threads library" default="true" />
|
||||
//#define RT_USING_PTHREADS
|
||||
// </section>
|
||||
|
||||
// <section name="RT_USING_DFS" description="Device file system" default="true" >
|
||||
//#define RT_USING_DFS
|
||||
// <bool name="DFS_USING_WORKDIR" description="Using working directory" default="true" />
|
||||
//#define DFS_USING_WORKDIR
|
||||
// <integer name="DFS_FILESYSTEM_TYPES_MAX" description="The maximal number of the supported file system type" default="4" />
|
||||
#define DFS_FILESYSTEM_TYPES_MAX 4
|
||||
// <integer name="DFS_FILESYSTEMS_MAX" description="The maximal number of mounted file system" default="4" />
|
||||
#define DFS_FILESYSTEMS_MAX 4
|
||||
// <integer name="DFS_FD_MAX" description="The maximal number of opened files" default="4" />
|
||||
#define DFS_FD_MAX 16
|
||||
// <bool name="RT_USING_DFS_ELMFAT" description="Using ELM FatFs" default="true" />
|
||||
#define RT_USING_DFS_ELMFAT
|
||||
// <integer name="RT_DFS_ELM_DRIVES" description="The maximal number of drives of FatFs" default="4" />
|
||||
#define RT_DFS_ELM_DRIVES 4
|
||||
// <bool name="RT_DFS_ELM_REENTRANT" description="Support reentrant" default="true" />
|
||||
#define RT_DFS_ELM_REENTRANT
|
||||
// <integer name="RT_DFS_ELM_USE_LFN" description="Support long file name" default="0">
|
||||
// <item description="LFN with static LFN working buffer">1</item>
|
||||
// <item description="LFN with dynamic LFN working buffer on the stack">2</item>
|
||||
// <item description="LFN with dynamic LFN working buffer on the heap">3</item>
|
||||
// </integer>
|
||||
#define RT_DFS_ELM_USE_LFN 3
|
||||
// <integer name="RT_DFS_ELM_CODE_PAGE" description="OEM code page" default="936">
|
||||
#define RT_DFS_ELM_CODE_PAGE 936
|
||||
// <bool name="RT_DFS_ELM_CODE_PAGE_FILE" description="Using OEM code page file" default="false" />
|
||||
#define RT_DFS_ELM_CODE_PAGE_FILE
|
||||
// <integer name="RT_DFS_ELM_MAX_LFN" description="Maximal size of file name length" default="256" />
|
||||
#define RT_DFS_ELM_MAX_LFN 256
|
||||
// <integer name="RT_DFS_ELM_MAX_SECTOR_SIZE" description="Maximal size of sector" default="512" />
|
||||
#define RT_DFS_ELM_MAX_SECTOR_SIZE 4096
|
||||
// <bool name="RT_DFS_ELM_USE_ERASE" description="Enable erase feature for flash" default="true" />
|
||||
#define RT_DFS_ELM_USE_ERASE
|
||||
// <bool name="RT_USING_DFS_YAFFS2" description="Using YAFFS2" default="false" />
|
||||
// #define RT_USING_DFS_YAFFS2
|
||||
// <bool name="RT_USING_DFS_UFFS" description="Using UFFS" default="false" />
|
||||
// #define RT_USING_DFS_UFFS
|
||||
// <bool name="RT_USING_DFS_DEVFS" description="Using devfs for device objects" default="true" />
|
||||
#define RT_USING_DFS_DEVFS
|
||||
// <bool name="RT_USING_DFS_ROMFS" description="Using ROMFS" default="false" />
|
||||
//#define RT_USING_DFS_ROMFS
|
||||
// <bool name="RT_USING_DFS_NFS" description="Using NFS" default="false" />
|
||||
//#define RT_USING_DFS_NFS
|
||||
// <string name="RT_NFS_HOST_EXPORT" description="The exported NFS host path" default="192.168.1.10:/" />
|
||||
#define RT_NFS_HOST_EXPORT "192.168.1.20:/"
|
||||
// </section>
|
||||
|
||||
// <section name="RT_USING_LWIP" description="lwip, a lightweight TCP/IP protocol stack" default="true" >
|
||||
//#define RT_USING_LWIP
|
||||
// <bool name="RT_USING_LWIP141" description="Using lwIP 1.4.1 version" default="true" />
|
||||
#define RT_USING_LWIP141
|
||||
// <bool name="RT_LWIP_ICMP" description="Enable ICMP protocol" default="true" />
|
||||
#define RT_LWIP_ICMP
|
||||
// <bool name="RT_LWIP_IGMP" description="Enable IGMP protocol" default="false" />
|
||||
// #define RT_LWIP_IGMP
|
||||
// <bool name="RT_LWIP_UDP" description="Enable UDP protocol" default="true" />
|
||||
#define RT_LWIP_UDP
|
||||
// <bool name="RT_LWIP_TCP" description="Enable TCP protocol" default="true" />
|
||||
#define RT_LWIP_TCP
|
||||
// <bool name="RT_LWIP_DNS" description="Enable DNS protocol" default="true" />
|
||||
#define RT_LWIP_DNS
|
||||
// <integer name="RT_LWIP_PBUF_NUM" description="Maximal number of buffers in the pbuf pool" default="4" />
|
||||
#define RT_LWIP_PBUF_NUM 4
|
||||
// <integer name="RT_LWIP_TCP_PCB_NUM" description="Maximal number of simultaneously active TCP connections" default="5" />
|
||||
#define RT_LWIP_TCP_PCB_NUM 3
|
||||
// <integer name="RT_LWIP_TCP_SND_BUF" description="TCP sender buffer size" default="8192" />
|
||||
#define RT_LWIP_TCP_SND_BUF 4086
|
||||
// <integer name="RT_LWIP_TCP_WND" description="TCP receive window" default="8192" />
|
||||
#define RT_LWIP_TCP_WND 2048
|
||||
// <bool name="RT_LWIP_SNMP" description="Enable SNMP protocol" default="false" />
|
||||
// #define RT_LWIP_SNMP
|
||||
// <bool name="RT_LWIP_DHCP" description="Enable DHCP client to get IP address" default="false" />
|
||||
// #define RT_LWIP_DHCP
|
||||
// <integer name="RT_LWIP_TCP_SEG_NUM" description="the number of simultaneously queued TCP" default="4" />
|
||||
#define RT_LWIP_TCP_SEG_NUM 8
|
||||
// <integer name="RT_LWIP_TCPTHREAD_PRIORITY" description="the thread priority of TCP thread" default="128" />
|
||||
#define RT_LWIP_TCPTHREAD_PRIORITY 12
|
||||
// <integer name="RT_LWIP_TCPTHREAD_MBOX_SIZE" description="the mail box size of TCP thread to wait for" default="32" />
|
||||
#define RT_LWIP_TCPTHREAD_MBOX_SIZE 8
|
||||
// <integer name="RT_LWIP_TCPTHREAD_STACKSIZE" description="the thread stack size of TCP thread" default="4096" />
|
||||
#define RT_LWIP_TCPTHREAD_STACKSIZE 4096
|
||||
// <integer name="RT_LWIP_ETHTHREAD_PRIORITY" description="the thread priority of ethnetif thread" default="144" />
|
||||
#define RT_LWIP_ETHTHREAD_PRIORITY 14
|
||||
// <integer name="RT_LWIP_ETHTHREAD_MBOX_SIZE" description="the mail box size of ethnetif thread to wait for" default="8" />
|
||||
#define RT_LWIP_ETHTHREAD_MBOX_SIZE 8
|
||||
// <integer name="RT_LWIP_ETHTHREAD_STACKSIZE" description="the stack size of ethnetif thread" default="512" />
|
||||
#define RT_LWIP_ETHTHREAD_STACKSIZE 512
|
||||
// <ipaddr name="RT_LWIP_IPADDR" description="IP address of device" default="192.168.1.30" />
|
||||
#define RT_LWIP_IPADDR0 192
|
||||
#define RT_LWIP_IPADDR1 168
|
||||
#define RT_LWIP_IPADDR2 1
|
||||
#define RT_LWIP_IPADDR3 30
|
||||
// <ipaddr name="RT_LWIP_GWADDR" description="Gateway address of device" default="192.168.1.1" />
|
||||
#define RT_LWIP_GWADDR0 192
|
||||
#define RT_LWIP_GWADDR1 168
|
||||
#define RT_LWIP_GWADDR2 1
|
||||
#define RT_LWIP_GWADDR3 1
|
||||
// <ipaddr name="RT_LWIP_MSKADDR" description="Mask address of device" default="255.255.255.0" />
|
||||
#define RT_LWIP_MSKADDR0 255
|
||||
#define RT_LWIP_MSKADDR1 255
|
||||
#define RT_LWIP_MSKADDR2 255
|
||||
#define RT_LWIP_MSKADDR3 0
|
||||
// </section>
|
||||
|
||||
|
||||
|
||||
// </RDTConfigurator>
|
||||
|
||||
|
||||
#endif
|
||||
139
bsp/lpc43xx/M0/rtconfig.py
Normal file
139
bsp/lpc43xx/M0/rtconfig.py
Normal file
@@ -0,0 +1,139 @@
|
||||
import os
|
||||
|
||||
# core to be use
|
||||
USE_CORE = 'CORE_M0'
|
||||
#USE_CORE = 'CORE_M4'
|
||||
|
||||
# toolchains options
|
||||
ARCH='arm'
|
||||
|
||||
if USE_CORE == 'CORE_M4':
|
||||
CPU = 'cortex-m4'
|
||||
else:
|
||||
CPU = 'cortex-m0'
|
||||
|
||||
CROSS_TOOL='keil'
|
||||
|
||||
|
||||
# get setting from environment.
|
||||
if os.getenv('RTT_CC'):
|
||||
CROSS_TOOL = os.getenv('RTT_CC')
|
||||
|
||||
# cross_tool provides the cross compiler
|
||||
# EXEC_PATH is the compiler execute path, for example, CodeSourcery, Keil MDK, IAR
|
||||
if CROSS_TOOL == 'gcc':
|
||||
PLATFORM = 'gcc'
|
||||
EXEC_PATH = r'C:/Program Files/CodeSourcery/arm-none-eabi/bin'
|
||||
elif CROSS_TOOL == 'keil':
|
||||
PLATFORM = 'armcc'
|
||||
EXEC_PATH = r'D:/Keil'
|
||||
elif CROSS_TOOL == 'iar':
|
||||
PLATFORM = 'iar'
|
||||
IAR_PATH = r'C:/Program Files/IAR Systems/Embedded Workbench 6.0'
|
||||
|
||||
if os.getenv('RTT_EXEC_PATH'):
|
||||
EXEC_PATH = os.getenv('RTT_EXEC_PATH')
|
||||
|
||||
#
|
||||
BUILD = 'release'
|
||||
|
||||
if PLATFORM == 'gcc':
|
||||
# toolchains
|
||||
PREFIX = 'arm-none-eabi-'
|
||||
CC = PREFIX + 'gcc'
|
||||
AS = PREFIX + 'gcc'
|
||||
AR = PREFIX + 'ar'
|
||||
LINK = PREFIX + 'gcc'
|
||||
TARGET_EXT = 'elf'
|
||||
SIZE = PREFIX + 'size'
|
||||
OBJDUMP = PREFIX + 'objdump'
|
||||
OBJCPY = PREFIX + 'objcopy'
|
||||
DEVICE = ' -mcpu=' + CPU + ' -mthumb -ffunction-sections -fdata-sections'
|
||||
if USE_CORE == 'CORE_M4':
|
||||
DEVICE += ' -mfpu=fpv4-sp-d16 -mfloat-abi=softfp'
|
||||
CFLAGS = DEVICE
|
||||
AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb '
|
||||
LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rtthread-lpc43xx.map,-cref,-u,Reset_Handler -T lpc43xx_spifi.ld'
|
||||
|
||||
CPATH = ''
|
||||
LPATH = ''
|
||||
|
||||
if BUILD == 'debug':
|
||||
CFLAGS += ' -O0 -gdwarf-2'
|
||||
AFLAGS += ' -gdwarf-2'
|
||||
else:
|
||||
CFLAGS += ' -O2'
|
||||
|
||||
POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n'
|
||||
|
||||
elif PLATFORM == 'armcc':
|
||||
# toolchains
|
||||
CC = 'armcc'
|
||||
AS = 'armasm'
|
||||
AR = 'armar'
|
||||
LINK = 'armlink'
|
||||
TARGET_EXT = 'axf'
|
||||
|
||||
DEVICE = ' --device DARMSTM'
|
||||
CFLAGS = DEVICE + ' --apcs=interwork'
|
||||
AFLAGS = DEVICE
|
||||
LFLAGS = DEVICE + ' --info sizes --info totals --info unused --info veneers --list rtthread-lpc43xx.map --scatter rtthread-lpc43xx_spifi.sct'
|
||||
|
||||
CFLAGS += ' -I' + EXEC_PATH + '/ARM/RV31/INC'
|
||||
LFLAGS += ' --libpath ' + EXEC_PATH + '/ARM/RV31/LIB'
|
||||
|
||||
EXEC_PATH += '/arm/bin40/'
|
||||
|
||||
if BUILD == 'debug':
|
||||
CFLAGS += ' -g -O0'
|
||||
AFLAGS += ' -g'
|
||||
else:
|
||||
CFLAGS += ' -O2'
|
||||
|
||||
POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET'
|
||||
|
||||
elif PLATFORM == 'iar':
|
||||
# toolchains
|
||||
CC = 'iccarm'
|
||||
AS = 'iasmarm'
|
||||
AR = 'iarchive'
|
||||
LINK = 'ilinkarm'
|
||||
TARGET_EXT = 'out'
|
||||
|
||||
CFLAGS = ' --diag_suppress Pa050'
|
||||
CFLAGS += ' --no_cse'
|
||||
CFLAGS += ' --no_unroll'
|
||||
CFLAGS += ' --no_inline'
|
||||
CFLAGS += ' --no_code_motion'
|
||||
CFLAGS += ' --no_tbaa'
|
||||
CFLAGS += ' --no_clustering'
|
||||
CFLAGS += ' --no_scheduling'
|
||||
CFLAGS += ' --debug'
|
||||
CFLAGS += ' --endian=little'
|
||||
if USE_CORE == 'CORE_M4':
|
||||
CFLAGS += ' --cpu=Cortex-M4'
|
||||
CFLAGS += ' --fpu=None'
|
||||
else:
|
||||
CFLAGS += ' --cpu=Cortex-M0'
|
||||
CFLAGS += ' -e'
|
||||
CFLAGS += ' --dlib_config "' + IAR_PATH + '/arm/INC/c/DLib_Config_Normal.h"'
|
||||
CFLAGS += ' -Ol'
|
||||
CFLAGS += ' --use_c++_inline'
|
||||
|
||||
AFLAGS = ''
|
||||
AFLAGS += ' -s+'
|
||||
AFLAGS += ' -w+'
|
||||
AFLAGS += ' -r'
|
||||
if USE_CORE == 'CORE_M4':
|
||||
AFLAGS += ' --cpu Cortex-M4'
|
||||
AFLAGS += ' --fpu None'
|
||||
else:
|
||||
AFLAGS += ' --cpu Cortex-M0'
|
||||
|
||||
LFLAGS = ' --config lpc43xx_flash.icf'
|
||||
LFLAGS += ' --redirect _Printf=_PrintfTiny'
|
||||
LFLAGS += ' --redirect _Scanf=_ScanfSmall'
|
||||
LFLAGS += ' --entry __iar_program_start'
|
||||
|
||||
EXEC_PATH = IAR_PATH + '/arm/bin/'
|
||||
POST_ACTION = ''
|
||||
349
bsp/lpc43xx/M0/template.uvopt
Normal file
349
bsp/lpc43xx/M0/template.uvopt
Normal file
@@ -0,0 +1,349 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||
<ProjectOpt xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="project_opt.xsd">
|
||||
|
||||
<SchemaVersion>1.0</SchemaVersion>
|
||||
|
||||
<Header>### uVision Project, (C) Keil Software</Header>
|
||||
|
||||
<Extensions>
|
||||
<cExt>*.c</cExt>
|
||||
<aExt>*.s*; *.src; *.a*</aExt>
|
||||
<oExt>*.obj</oExt>
|
||||
<lExt>*.lib</lExt>
|
||||
<tExt>*.txt; *.h; *.inc</tExt>
|
||||
<pExt>*.plm</pExt>
|
||||
<CppX>*.cpp</CppX>
|
||||
</Extensions>
|
||||
|
||||
<DaveTm>
|
||||
<dwLowDateTime>0</dwLowDateTime>
|
||||
<dwHighDateTime>0</dwHighDateTime>
|
||||
</DaveTm>
|
||||
|
||||
<Target>
|
||||
<TargetName>LPC43xx SPIFI</TargetName>
|
||||
<ToolsetNumber>0x4</ToolsetNumber>
|
||||
<ToolsetName>ARM-ADS</ToolsetName>
|
||||
<TargetOption>
|
||||
<CLKADS>12000000</CLKADS>
|
||||
<OPTTT>
|
||||
<gFlags>1</gFlags>
|
||||
<BeepAtEnd>1</BeepAtEnd>
|
||||
<RunSim>1</RunSim>
|
||||
<RunTarget>0</RunTarget>
|
||||
</OPTTT>
|
||||
<OPTHX>
|
||||
<HexSelection>1</HexSelection>
|
||||
<FlashByte>65535</FlashByte>
|
||||
<HexRangeLowAddress>0</HexRangeLowAddress>
|
||||
<HexRangeHighAddress>0</HexRangeHighAddress>
|
||||
<HexOffset>0</HexOffset>
|
||||
</OPTHX>
|
||||
<OPTLEX>
|
||||
<PageWidth>79</PageWidth>
|
||||
<PageLength>66</PageLength>
|
||||
<TabStop>8</TabStop>
|
||||
<ListingPath>.\build\</ListingPath>
|
||||
</OPTLEX>
|
||||
<ListingPage>
|
||||
<CreateCListing>1</CreateCListing>
|
||||
<CreateAListing>1</CreateAListing>
|
||||
<CreateLListing>1</CreateLListing>
|
||||
<CreateIListing>0</CreateIListing>
|
||||
<AsmCond>1</AsmCond>
|
||||
<AsmSymb>1</AsmSymb>
|
||||
<AsmXref>0</AsmXref>
|
||||
<CCond>1</CCond>
|
||||
<CCode>0</CCode>
|
||||
<CListInc>0</CListInc>
|
||||
<CSymb>0</CSymb>
|
||||
<LinkerCodeListing>0</LinkerCodeListing>
|
||||
</ListingPage>
|
||||
<OPTXL>
|
||||
<LMap>1</LMap>
|
||||
<LComments>1</LComments>
|
||||
<LGenerateSymbols>1</LGenerateSymbols>
|
||||
<LLibSym>1</LLibSym>
|
||||
<LLines>1</LLines>
|
||||
<LLocSym>1</LLocSym>
|
||||
<LPubSym>1</LPubSym>
|
||||
<LXref>0</LXref>
|
||||
<LExpSel>0</LExpSel>
|
||||
</OPTXL>
|
||||
<OPTFL>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<IsCurrentTarget>1</IsCurrentTarget>
|
||||
</OPTFL>
|
||||
<CpuCode>8</CpuCode>
|
||||
<Books>
|
||||
<Book>
|
||||
<Number>0</Number>
|
||||
<Title>User Manual</Title>
|
||||
<Path>DATASHTS\NXP\LPC43xx\UM10503.pdf</Path>
|
||||
</Book>
|
||||
<Book>
|
||||
<Number>1</Number>
|
||||
<Title>Data Sheet</Title>
|
||||
<Path>DATASHTS\NXP\LPC43xx\LPC435X_3X_2X_1X.pdf</Path>
|
||||
</Book>
|
||||
<Book>
|
||||
<Number>2</Number>
|
||||
<Title>Technical Reference Manual</Title>
|
||||
<Path>datashts\arm\cortex_m4\r0p1\DDI0439C_CORTEX_M4_R0P1_TRM.PDF</Path>
|
||||
</Book>
|
||||
<Book>
|
||||
<Number>3</Number>
|
||||
<Title>Generic User Guide</Title>
|
||||
<Path>datashts\arm\cortex_m4\r0p1\DUI0553A_CORTEX_M4_DGUG.PDF</Path>
|
||||
</Book>
|
||||
</Books>
|
||||
<DllOpt>
|
||||
<SimDllName>SARMCM3.DLL</SimDllName>
|
||||
<SimDllArguments>-MPU</SimDllArguments>
|
||||
<SimDlgDllName>DCM.DLL</SimDlgDllName>
|
||||
<SimDlgDllArguments>-pCM4</SimDlgDllArguments>
|
||||
<TargetDllName>SARMCM3.DLL</TargetDllName>
|
||||
<TargetDllArguments>-MPU</TargetDllArguments>
|
||||
<TargetDlgDllName>TCM.DLL</TargetDlgDllName>
|
||||
<TargetDlgDllArguments>-pCM4</TargetDlgDllArguments>
|
||||
</DllOpt>
|
||||
<DebugOpt>
|
||||
<uSim>0</uSim>
|
||||
<uTrg>1</uTrg>
|
||||
<sLdApp>1</sLdApp>
|
||||
<sGomain>1</sGomain>
|
||||
<sRbreak>1</sRbreak>
|
||||
<sRwatch>1</sRwatch>
|
||||
<sRmem>1</sRmem>
|
||||
<sRfunc>1</sRfunc>
|
||||
<sRbox>1</sRbox>
|
||||
<tLdApp>1</tLdApp>
|
||||
<tGomain>1</tGomain>
|
||||
<tRbreak>1</tRbreak>
|
||||
<tRwatch>1</tRwatch>
|
||||
<tRmem>0</tRmem>
|
||||
<tRfunc>0</tRfunc>
|
||||
<tRbox>1</tRbox>
|
||||
<tRtrace>0</tRtrace>
|
||||
<sRunDeb>0</sRunDeb>
|
||||
<sLrtime>0</sLrtime>
|
||||
<nTsel>1</nTsel>
|
||||
<sDll></sDll>
|
||||
<sDllPa></sDllPa>
|
||||
<sDlgDll></sDlgDll>
|
||||
<sDlgPa></sDlgPa>
|
||||
<sIfile></sIfile>
|
||||
<tDll></tDll>
|
||||
<tDllPa></tDllPa>
|
||||
<tDlgDll></tDlgDll>
|
||||
<tDlgPa></tDlgPa>
|
||||
<tIfile></tIfile>
|
||||
<pMon>BIN\UL2CM3.DLL</pMon>
|
||||
</DebugOpt>
|
||||
<TargetDriverDllRegistry>
|
||||
<SetRegEntry>
|
||||
<Number>0</Number>
|
||||
<Key>UL2CM3</Key>
|
||||
<Name>-U -O975 -S0 -C0 -P00 -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD10000000 -FC8000 -FN3 -FF0LPC18xx43xx_512_BA -FS01A000000 -FL080000 -FF1LPC18xx43xx_512_BB -FS11B000000 -FL180000 -FF2LPC18xx43xx_S25FL032 -FS214000000 -FL2400000</Name>
|
||||
</SetRegEntry>
|
||||
</TargetDriverDllRegistry>
|
||||
<Breakpoint/>
|
||||
<Tracepoint>
|
||||
<THDelay>0</THDelay>
|
||||
</Tracepoint>
|
||||
<DebugFlag>
|
||||
<trace>0</trace>
|
||||
<periodic>0</periodic>
|
||||
<aLwin>0</aLwin>
|
||||
<aCover>0</aCover>
|
||||
<aSer1>0</aSer1>
|
||||
<aSer2>0</aSer2>
|
||||
<aPa>0</aPa>
|
||||
<viewmode>0</viewmode>
|
||||
<vrSel>0</vrSel>
|
||||
<aSym>0</aSym>
|
||||
<aTbox>0</aTbox>
|
||||
<AscS1>0</AscS1>
|
||||
<AscS2>0</AscS2>
|
||||
<AscS3>0</AscS3>
|
||||
<aSer3>0</aSer3>
|
||||
<eProf>0</eProf>
|
||||
<aLa>0</aLa>
|
||||
<aPa1>0</aPa1>
|
||||
<AscS4>0</AscS4>
|
||||
<aSer4>0</aSer4>
|
||||
<StkLoc>0</StkLoc>
|
||||
<TrcWin>0</TrcWin>
|
||||
<newCpu>0</newCpu>
|
||||
<uProt>0</uProt>
|
||||
</DebugFlag>
|
||||
<LintExecutable></LintExecutable>
|
||||
<LintConfigFile></LintConfigFile>
|
||||
</TargetOption>
|
||||
</Target>
|
||||
|
||||
<Target>
|
||||
<TargetName>LPC43xx RAM</TargetName>
|
||||
<ToolsetNumber>0x4</ToolsetNumber>
|
||||
<ToolsetName>ARM-ADS</ToolsetName>
|
||||
<TargetOption>
|
||||
<CLKADS>12000000</CLKADS>
|
||||
<OPTTT>
|
||||
<gFlags>1</gFlags>
|
||||
<BeepAtEnd>1</BeepAtEnd>
|
||||
<RunSim>1</RunSim>
|
||||
<RunTarget>0</RunTarget>
|
||||
</OPTTT>
|
||||
<OPTHX>
|
||||
<HexSelection>1</HexSelection>
|
||||
<FlashByte>65535</FlashByte>
|
||||
<HexRangeLowAddress>0</HexRangeLowAddress>
|
||||
<HexRangeHighAddress>0</HexRangeHighAddress>
|
||||
<HexOffset>0</HexOffset>
|
||||
</OPTHX>
|
||||
<OPTLEX>
|
||||
<PageWidth>79</PageWidth>
|
||||
<PageLength>66</PageLength>
|
||||
<TabStop>8</TabStop>
|
||||
<ListingPath>.\build\</ListingPath>
|
||||
</OPTLEX>
|
||||
<ListingPage>
|
||||
<CreateCListing>1</CreateCListing>
|
||||
<CreateAListing>1</CreateAListing>
|
||||
<CreateLListing>1</CreateLListing>
|
||||
<CreateIListing>0</CreateIListing>
|
||||
<AsmCond>1</AsmCond>
|
||||
<AsmSymb>1</AsmSymb>
|
||||
<AsmXref>0</AsmXref>
|
||||
<CCond>1</CCond>
|
||||
<CCode>0</CCode>
|
||||
<CListInc>0</CListInc>
|
||||
<CSymb>0</CSymb>
|
||||
<LinkerCodeListing>0</LinkerCodeListing>
|
||||
</ListingPage>
|
||||
<OPTXL>
|
||||
<LMap>1</LMap>
|
||||
<LComments>1</LComments>
|
||||
<LGenerateSymbols>1</LGenerateSymbols>
|
||||
<LLibSym>1</LLibSym>
|
||||
<LLines>1</LLines>
|
||||
<LLocSym>1</LLocSym>
|
||||
<LPubSym>1</LPubSym>
|
||||
<LXref>0</LXref>
|
||||
<LExpSel>0</LExpSel>
|
||||
</OPTXL>
|
||||
<OPTFL>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<IsCurrentTarget>0</IsCurrentTarget>
|
||||
</OPTFL>
|
||||
<CpuCode>8</CpuCode>
|
||||
<Books>
|
||||
<Book>
|
||||
<Number>0</Number>
|
||||
<Title>User Manual</Title>
|
||||
<Path>DATASHTS\NXP\LPC43xx\UM10503.pdf</Path>
|
||||
</Book>
|
||||
<Book>
|
||||
<Number>1</Number>
|
||||
<Title>Data Sheet</Title>
|
||||
<Path>DATASHTS\NXP\LPC43xx\LPC435X_3X_2X_1X.pdf</Path>
|
||||
</Book>
|
||||
<Book>
|
||||
<Number>2</Number>
|
||||
<Title>Technical Reference Manual</Title>
|
||||
<Path>datashts\arm\cortex_m4\r0p1\DDI0439C_CORTEX_M4_R0P1_TRM.PDF</Path>
|
||||
</Book>
|
||||
<Book>
|
||||
<Number>3</Number>
|
||||
<Title>Generic User Guide</Title>
|
||||
<Path>datashts\arm\cortex_m4\r0p1\DUI0553A_CORTEX_M4_DGUG.PDF</Path>
|
||||
</Book>
|
||||
</Books>
|
||||
<DllOpt>
|
||||
<SimDllName>SARMCM3.DLL</SimDllName>
|
||||
<SimDllArguments>-MPU</SimDllArguments>
|
||||
<SimDlgDllName>DCM.DLL</SimDlgDllName>
|
||||
<SimDlgDllArguments>-pCM4</SimDlgDllArguments>
|
||||
<TargetDllName>SARMCM3.DLL</TargetDllName>
|
||||
<TargetDllArguments>-MPU</TargetDllArguments>
|
||||
<TargetDlgDllName>TCM.DLL</TargetDlgDllName>
|
||||
<TargetDlgDllArguments>-pCM4</TargetDlgDllArguments>
|
||||
</DllOpt>
|
||||
<DebugOpt>
|
||||
<uSim>0</uSim>
|
||||
<uTrg>1</uTrg>
|
||||
<sLdApp>1</sLdApp>
|
||||
<sGomain>1</sGomain>
|
||||
<sRbreak>1</sRbreak>
|
||||
<sRwatch>1</sRwatch>
|
||||
<sRmem>1</sRmem>
|
||||
<sRfunc>1</sRfunc>
|
||||
<sRbox>1</sRbox>
|
||||
<tLdApp>0</tLdApp>
|
||||
<tGomain>0</tGomain>
|
||||
<tRbreak>1</tRbreak>
|
||||
<tRwatch>1</tRwatch>
|
||||
<tRmem>0</tRmem>
|
||||
<tRfunc>0</tRfunc>
|
||||
<tRbox>1</tRbox>
|
||||
<tRtrace>0</tRtrace>
|
||||
<sRunDeb>0</sRunDeb>
|
||||
<sLrtime>0</sLrtime>
|
||||
<nTsel>1</nTsel>
|
||||
<sDll></sDll>
|
||||
<sDllPa></sDllPa>
|
||||
<sDlgDll></sDlgDll>
|
||||
<sDlgPa></sDlgPa>
|
||||
<sIfile></sIfile>
|
||||
<tDll></tDll>
|
||||
<tDllPa></tDllPa>
|
||||
<tDlgDll></tDlgDll>
|
||||
<tDlgPa></tDlgPa>
|
||||
<tIfile>.\Dbg_RAM.ini</tIfile>
|
||||
<pMon>BIN\UL2CM3.DLL</pMon>
|
||||
</DebugOpt>
|
||||
<TargetDriverDllRegistry>
|
||||
<SetRegEntry>
|
||||
<Number>0</Number>
|
||||
<Key>UL2CM3</Key>
|
||||
<Name>-U -O783 -S0 -C0 -P00 -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD10000000 -FC8000 -FN3 -FF0LPC18xx43xx_512_BA -FS01A000000 -FL080000 -FF1LPC18xx43xx_512_BB -FS11B000000 -FL180000 -FF2LPC18xx43xx_S25FL032 -FS214000000 -FL2400000</Name>
|
||||
</SetRegEntry>
|
||||
</TargetDriverDllRegistry>
|
||||
<Breakpoint/>
|
||||
<Tracepoint>
|
||||
<THDelay>0</THDelay>
|
||||
</Tracepoint>
|
||||
<DebugFlag>
|
||||
<trace>0</trace>
|
||||
<periodic>0</periodic>
|
||||
<aLwin>0</aLwin>
|
||||
<aCover>0</aCover>
|
||||
<aSer1>0</aSer1>
|
||||
<aSer2>0</aSer2>
|
||||
<aPa>0</aPa>
|
||||
<viewmode>0</viewmode>
|
||||
<vrSel>0</vrSel>
|
||||
<aSym>0</aSym>
|
||||
<aTbox>0</aTbox>
|
||||
<AscS1>0</AscS1>
|
||||
<AscS2>0</AscS2>
|
||||
<AscS3>0</AscS3>
|
||||
<aSer3>0</aSer3>
|
||||
<eProf>0</eProf>
|
||||
<aLa>0</aLa>
|
||||
<aPa1>0</aPa1>
|
||||
<AscS4>0</AscS4>
|
||||
<aSer4>0</aSer4>
|
||||
<StkLoc>0</StkLoc>
|
||||
<TrcWin>0</TrcWin>
|
||||
<newCpu>0</newCpu>
|
||||
<uProt>0</uProt>
|
||||
</DebugFlag>
|
||||
<LintExecutable></LintExecutable>
|
||||
<LintConfigFile></LintConfigFile>
|
||||
</TargetOption>
|
||||
</Target>
|
||||
|
||||
</ProjectOpt>
|
||||
777
bsp/lpc43xx/M0/template.uvproj
Normal file
777
bsp/lpc43xx/M0/template.uvproj
Normal file
File diff suppressed because it is too large
Load Diff
13
bsp/lpc43xx/M4/SConscript
Normal file
13
bsp/lpc43xx/M4/SConscript
Normal file
@@ -0,0 +1,13 @@
|
||||
from building import *
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
objs = []
|
||||
list = os.listdir(os.path.join(cwd, '..'))
|
||||
|
||||
for d in list:
|
||||
if (d != 'M4' and d != 'M0'):
|
||||
path = os.path.join(cwd, '..', d)
|
||||
if os.path.isfile(os.path.join(path, 'SConscript')):
|
||||
objs = objs + SConscript(os.path.join(path, 'SConscript'))
|
||||
|
||||
Return('objs')
|
||||
29
bsp/lpc43xx/M4/SConstruct
Normal file
29
bsp/lpc43xx/M4/SConstruct
Normal file
@@ -0,0 +1,29 @@
|
||||
import os
|
||||
import sys
|
||||
import rtconfig
|
||||
|
||||
if os.getenv('RTT_ROOT'):
|
||||
RTT_ROOT = os.getenv('RTT_ROOT')
|
||||
else:
|
||||
RTT_ROOT = os.path.join(Dir('#').get_abspath(), '..', '..', 'rt-thread')
|
||||
|
||||
sys.path = sys.path + [os.path.join(RTT_ROOT, 'tools')]
|
||||
from building import *
|
||||
|
||||
TARGET = 'rtthread-lpc40xx.' + rtconfig.TARGET_EXT
|
||||
|
||||
env = Environment(tools = ['mingw'],
|
||||
AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
|
||||
CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS,
|
||||
AR = rtconfig.AR, ARFLAGS = '-rc',
|
||||
LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
|
||||
env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
|
||||
|
||||
Export('RTT_ROOT')
|
||||
Export('rtconfig')
|
||||
|
||||
# prepare building environment
|
||||
objs = PrepareBuilding(env, RTT_ROOT, has_libcpu=False)
|
||||
|
||||
# do building
|
||||
DoBuilding(TARGET, objs)
|
||||
230
bsp/lpc43xx/M4/rtconfig.h
Normal file
230
bsp/lpc43xx/M4/rtconfig.h
Normal file
@@ -0,0 +1,230 @@
|
||||
/* RT-Thread config file */
|
||||
#ifndef __RTTHREAD_CFG_H__
|
||||
#define __RTTHREAD_CFG_H__
|
||||
|
||||
// <RDTConfigurator URL="http://www.rt-thread.com/eclipse">
|
||||
|
||||
// <integer name="RT_NAME_MAX" description="Maximal size of kernel object name length" default="6" />
|
||||
#define RT_NAME_MAX 8
|
||||
// <integer name="RT_ALIGN_SIZE" description="Alignment size for CPU architecture data access" default="4" />
|
||||
#define RT_ALIGN_SIZE 4
|
||||
// <integer name="RT_THREAD_PRIORITY_MAX" description="Maximal level of thread priority" default="32">
|
||||
// <item description="8">8</item>
|
||||
// <item description="32">32</item>
|
||||
// <item description="256">256</item>
|
||||
// </integer>
|
||||
#define RT_THREAD_PRIORITY_MAX 32
|
||||
// <integer name="RT_TICK_PER_SECOND" description="OS tick per second" default="100" />
|
||||
#define RT_TICK_PER_SECOND 1000
|
||||
// <integer name="IDLE_THREAD_STACK_SIZE" description="The stack size of idle thread" default="512" />
|
||||
#define IDLE_THREAD_STACK_SIZE 512
|
||||
// <bool name="RT_USING_MODULE" description="Using Application Module" default="true" />
|
||||
//#define RT_USING_MODULE
|
||||
// <section name="RT_DEBUG" description="Kernel Debug Configuration" default="true" >
|
||||
#define RT_DEBUG
|
||||
// <bool name="RT_DEBUG_INIT" description="debug init enable" default=0 />
|
||||
#define RT_DEBUG_INIT 0
|
||||
// <bool name="RT_THREAD_DEBUG" description="Thread debug enable" default="false" />
|
||||
// #define RT_THREAD_DEBUG
|
||||
// <bool name="RT_USING_OVERFLOW_CHECK" description="Thread stack over flow detect" default="true" />
|
||||
#define RT_USING_OVERFLOW_CHECK
|
||||
// </section>
|
||||
|
||||
// <bool name="RT_USING_HOOK" description="Using hook functions" default="true" />
|
||||
#define RT_USING_HOOK
|
||||
// <section name="RT_USING_TIMER_SOFT" description="Using software timer which will start a thread to handle soft-timer" default="true" >
|
||||
#define RT_USING_TIMER_SOFT
|
||||
// <integer name="RT_TIMER_THREAD_PRIO" description="The priority level of timer thread" default="4" />
|
||||
#define RT_TIMER_THREAD_PRIO 4
|
||||
// <integer name="RT_TIMER_THREAD_STACK_SIZE" description="The stack size of timer thread" default="512" />
|
||||
#define RT_TIMER_THREAD_STACK_SIZE 512
|
||||
// <integer name="RT_TIMER_TICK_PER_SECOND" description="The soft-timer tick per second" default="10" />
|
||||
#define RT_TIMER_TICK_PER_SECOND 100
|
||||
// </section>
|
||||
|
||||
// <section name="IPC" description="Inter-Thread communication" default="always" >
|
||||
// <bool name="RT_USING_SEMAPHORE" description="Using semaphore in the system" default="true" />
|
||||
#define RT_USING_SEMAPHORE
|
||||
// <bool name="RT_USING_MUTEX" description="Using mutex in the system" default="true" />
|
||||
#define RT_USING_MUTEX
|
||||
// <bool name="RT_USING_EVENT" description="Using event group in the system" default="true" />
|
||||
#define RT_USING_EVENT
|
||||
// <bool name="RT_USING_MAILBOX" description="Using mailbox in the system" default="true" />
|
||||
#define RT_USING_MAILBOX
|
||||
// <bool name="RT_USING_MESSAGEQUEUE" description="Using message queue in the system" default="true" />
|
||||
#define RT_USING_MESSAGEQUEUE
|
||||
// </section>
|
||||
|
||||
// <section name="MM" description="Memory Management" default="always" >
|
||||
// <bool name="RT_USING_MEMPOOL" description="Using Memory Pool Management in the system" default="true" />
|
||||
#define RT_USING_MEMPOOL
|
||||
// <bool name="RT_USING_MEMHEAP" description="Using Memory Heap Object in the system" default="true" />
|
||||
#define RT_USING_MEMHEAP
|
||||
// <bool name="RT_USING_HEAP" description="Using Dynamic Heap Management in the system" default="true" />
|
||||
#define RT_USING_HEAP
|
||||
// <bool name="RT_USING_SMALL_MEM" description="Optimizing for small memory" default="false" />
|
||||
#define RT_USING_SMALL_MEM
|
||||
// <bool name="RT_USING_SLAB" description="Using SLAB memory management for large memory" default="false" />
|
||||
// #define RT_USING_SLAB
|
||||
// </section>
|
||||
|
||||
// <section name="RT_USING_DEVICE" description="Using Device Driver Framework" default="true" >
|
||||
#define RT_USING_DEVICE
|
||||
// <bool name=RT_USING_DEVICE_IPC description="Using IPC in Device Driver Framework" default="true" />
|
||||
#define RT_USING_DEVICE_IPC
|
||||
// <bool name="RT_USING_SERIAL" description="Using Serial Device Driver Framework" default="true" />
|
||||
#define RT_USING_SERIAL
|
||||
// <integer name="RT_UART_RX_BUFFER_SIZE" description="The buffer size for UART reception" default="64" />
|
||||
#define RT_UART_RX_BUFFER_SIZE 256
|
||||
// <bool name="RT_USING_MTD_NAND" description="Using MTD NAND Framework" default="true" />
|
||||
//#define RT_USING_MTD_NAND
|
||||
// <bool name="RT_MTD_NAND_DEBUG" description="Enable MTD NAND Framework Debug" default="true" />
|
||||
//#define RT_MTD_NAND_DEBUG
|
||||
// <bool name="RT_USING_NFTL" description="Using NFTL layer" default="true" />
|
||||
//#define RT_USING_NFTL
|
||||
// <bool name="RT_USING_SPI" description="Using SPI Device Driver Framework" default="true" />
|
||||
//#define RT_USING_SPI
|
||||
// <bool name="RT_USING_I2C" description="Using I2C Device Driver Framework" default="true" />
|
||||
//#define RT_USING_I2C
|
||||
// <bool name="RT_USING_RTC" description="Using RTC Device Driver Framework" default="true" />
|
||||
//#define RT_USING_RTC
|
||||
// <integer name="RT_MMCSD_THREAD_PREORITY" description="The prority of mmcsd thread" default="15" />
|
||||
#define RT_MMCSD_THREAD_PREORITY 15
|
||||
// <section name="RT_USING_CONSOLE" description="Using console" default="true" >
|
||||
#define RT_USING_CONSOLE
|
||||
// <integer name="RT_CONSOLEBUF_SIZE" description="The buffer size for console output" default="128" />
|
||||
#define RT_CONSOLEBUF_SIZE 128
|
||||
// <string name="RT_CONSOLE_DEVICE_NAME" description="The device name for console" default="uart" />
|
||||
#define RT_CONSOLE_DEVICE_NAME "uart0"
|
||||
// </section>
|
||||
|
||||
// <bool name="RT_USING_COMPONENTS_INIT" description="Using RT-Thread components initialization" default="true" />
|
||||
//#define RT_USING_COMPONENTS_INIT
|
||||
// <section name="RT_USING_FINSH" description="Using finsh as shell, which is a C-Express shell" default="true" >
|
||||
#define RT_USING_FINSH
|
||||
// <bool name="FINSH_USING_SYMTAB" description="Using symbol table in finsh shell" default="true" />
|
||||
#define FINSH_USING_SYMTAB
|
||||
// <bool name="FINSH_USING_DESCRIPTION" description="Keeping description in symbol table" default="true" />
|
||||
#define FINSH_USING_DESCRIPTION
|
||||
// <integer name="FINSH_THREAD_STACK_SIZE" description="The stack size for finsh thread" default="4096" />
|
||||
#define FINSH_THREAD_STACK_SIZE 4096
|
||||
// <bool name="FINSH_USING_MSH" description="Using module shell in finsh" default="true" />
|
||||
//#define FINSH_USING_MSH
|
||||
// </section>
|
||||
|
||||
// <section name="LIBC" description="C Runtime library setting" default="always" >
|
||||
// <bool name="RT_USING_NEWLIB" description="Using newlib library, only available under GNU GCC" default="true" />
|
||||
// #define RT_USING_NEWLIB
|
||||
// <bool name="RT_USING_PTHREADS" description="Using POSIX threads library" default="true" />
|
||||
//#define RT_USING_PTHREADS
|
||||
// </section>
|
||||
|
||||
// <section name="RT_USING_DFS" description="Device file system" default="true" >
|
||||
//#define RT_USING_DFS
|
||||
// <bool name="DFS_USING_WORKDIR" description="Using working directory" default="true" />
|
||||
//#define DFS_USING_WORKDIR
|
||||
// <integer name="DFS_FILESYSTEM_TYPES_MAX" description="The maximal number of the supported file system type" default="4" />
|
||||
#define DFS_FILESYSTEM_TYPES_MAX 4
|
||||
// <integer name="DFS_FILESYSTEMS_MAX" description="The maximal number of mounted file system" default="4" />
|
||||
#define DFS_FILESYSTEMS_MAX 4
|
||||
// <integer name="DFS_FD_MAX" description="The maximal number of opened files" default="4" />
|
||||
#define DFS_FD_MAX 16
|
||||
// <bool name="RT_USING_DFS_ELMFAT" description="Using ELM FatFs" default="true" />
|
||||
#define RT_USING_DFS_ELMFAT
|
||||
// <integer name="RT_DFS_ELM_DRIVES" description="The maximal number of drives of FatFs" default="4" />
|
||||
#define RT_DFS_ELM_DRIVES 4
|
||||
// <bool name="RT_DFS_ELM_REENTRANT" description="Support reentrant" default="true" />
|
||||
#define RT_DFS_ELM_REENTRANT
|
||||
// <integer name="RT_DFS_ELM_USE_LFN" description="Support long file name" default="0">
|
||||
// <item description="LFN with static LFN working buffer">1</item>
|
||||
// <item description="LFN with dynamic LFN working buffer on the stack">2</item>
|
||||
// <item description="LFN with dynamic LFN working buffer on the heap">3</item>
|
||||
// </integer>
|
||||
#define RT_DFS_ELM_USE_LFN 3
|
||||
// <integer name="RT_DFS_ELM_CODE_PAGE" description="OEM code page" default="936">
|
||||
#define RT_DFS_ELM_CODE_PAGE 936
|
||||
// <bool name="RT_DFS_ELM_CODE_PAGE_FILE" description="Using OEM code page file" default="false" />
|
||||
#define RT_DFS_ELM_CODE_PAGE_FILE
|
||||
// <integer name="RT_DFS_ELM_MAX_LFN" description="Maximal size of file name length" default="256" />
|
||||
#define RT_DFS_ELM_MAX_LFN 256
|
||||
// <integer name="RT_DFS_ELM_MAX_SECTOR_SIZE" description="Maximal size of sector" default="512" />
|
||||
#define RT_DFS_ELM_MAX_SECTOR_SIZE 4096
|
||||
// <bool name="RT_DFS_ELM_USE_ERASE" description="Enable erase feature for flash" default="true" />
|
||||
#define RT_DFS_ELM_USE_ERASE
|
||||
// <bool name="RT_USING_DFS_YAFFS2" description="Using YAFFS2" default="false" />
|
||||
// #define RT_USING_DFS_YAFFS2
|
||||
// <bool name="RT_USING_DFS_UFFS" description="Using UFFS" default="false" />
|
||||
// #define RT_USING_DFS_UFFS
|
||||
// <bool name="RT_USING_DFS_DEVFS" description="Using devfs for device objects" default="true" />
|
||||
#define RT_USING_DFS_DEVFS
|
||||
// <bool name="RT_USING_DFS_ROMFS" description="Using ROMFS" default="false" />
|
||||
//#define RT_USING_DFS_ROMFS
|
||||
// <bool name="RT_USING_DFS_NFS" description="Using NFS" default="false" />
|
||||
//#define RT_USING_DFS_NFS
|
||||
// <string name="RT_NFS_HOST_EXPORT" description="The exported NFS host path" default="192.168.1.10:/" />
|
||||
#define RT_NFS_HOST_EXPORT "192.168.1.20:/"
|
||||
// </section>
|
||||
|
||||
// <section name="RT_USING_LWIP" description="lwip, a lightweight TCP/IP protocol stack" default="true" >
|
||||
//#define RT_USING_LWIP
|
||||
// <bool name="RT_USING_LWIP141" description="Using lwIP 1.4.1 version" default="true" />
|
||||
#define RT_USING_LWIP141
|
||||
// <bool name="RT_LWIP_ICMP" description="Enable ICMP protocol" default="true" />
|
||||
#define RT_LWIP_ICMP
|
||||
// <bool name="RT_LWIP_IGMP" description="Enable IGMP protocol" default="false" />
|
||||
// #define RT_LWIP_IGMP
|
||||
// <bool name="RT_LWIP_UDP" description="Enable UDP protocol" default="true" />
|
||||
#define RT_LWIP_UDP
|
||||
// <bool name="RT_LWIP_TCP" description="Enable TCP protocol" default="true" />
|
||||
#define RT_LWIP_TCP
|
||||
// <bool name="RT_LWIP_DNS" description="Enable DNS protocol" default="true" />
|
||||
#define RT_LWIP_DNS
|
||||
// <integer name="RT_LWIP_PBUF_NUM" description="Maximal number of buffers in the pbuf pool" default="4" />
|
||||
#define RT_LWIP_PBUF_NUM 4
|
||||
// <integer name="RT_LWIP_TCP_PCB_NUM" description="Maximal number of simultaneously active TCP connections" default="5" />
|
||||
#define RT_LWIP_TCP_PCB_NUM 3
|
||||
// <integer name="RT_LWIP_TCP_SND_BUF" description="TCP sender buffer size" default="8192" />
|
||||
#define RT_LWIP_TCP_SND_BUF 4086
|
||||
// <integer name="RT_LWIP_TCP_WND" description="TCP receive window" default="8192" />
|
||||
#define RT_LWIP_TCP_WND 2048
|
||||
// <bool name="RT_LWIP_SNMP" description="Enable SNMP protocol" default="false" />
|
||||
// #define RT_LWIP_SNMP
|
||||
// <bool name="RT_LWIP_DHCP" description="Enable DHCP client to get IP address" default="false" />
|
||||
// #define RT_LWIP_DHCP
|
||||
// <integer name="RT_LWIP_TCP_SEG_NUM" description="the number of simultaneously queued TCP" default="4" />
|
||||
#define RT_LWIP_TCP_SEG_NUM 8
|
||||
// <integer name="RT_LWIP_TCPTHREAD_PRIORITY" description="the thread priority of TCP thread" default="128" />
|
||||
#define RT_LWIP_TCPTHREAD_PRIORITY 12
|
||||
// <integer name="RT_LWIP_TCPTHREAD_MBOX_SIZE" description="the mail box size of TCP thread to wait for" default="32" />
|
||||
#define RT_LWIP_TCPTHREAD_MBOX_SIZE 8
|
||||
// <integer name="RT_LWIP_TCPTHREAD_STACKSIZE" description="the thread stack size of TCP thread" default="4096" />
|
||||
#define RT_LWIP_TCPTHREAD_STACKSIZE 4096
|
||||
// <integer name="RT_LWIP_ETHTHREAD_PRIORITY" description="the thread priority of ethnetif thread" default="144" />
|
||||
#define RT_LWIP_ETHTHREAD_PRIORITY 14
|
||||
// <integer name="RT_LWIP_ETHTHREAD_MBOX_SIZE" description="the mail box size of ethnetif thread to wait for" default="8" />
|
||||
#define RT_LWIP_ETHTHREAD_MBOX_SIZE 8
|
||||
// <integer name="RT_LWIP_ETHTHREAD_STACKSIZE" description="the stack size of ethnetif thread" default="512" />
|
||||
#define RT_LWIP_ETHTHREAD_STACKSIZE 512
|
||||
// <ipaddr name="RT_LWIP_IPADDR" description="IP address of device" default="192.168.1.30" />
|
||||
#define RT_LWIP_IPADDR0 192
|
||||
#define RT_LWIP_IPADDR1 168
|
||||
#define RT_LWIP_IPADDR2 1
|
||||
#define RT_LWIP_IPADDR3 30
|
||||
// <ipaddr name="RT_LWIP_GWADDR" description="Gateway address of device" default="192.168.1.1" />
|
||||
#define RT_LWIP_GWADDR0 192
|
||||
#define RT_LWIP_GWADDR1 168
|
||||
#define RT_LWIP_GWADDR2 1
|
||||
#define RT_LWIP_GWADDR3 1
|
||||
// <ipaddr name="RT_LWIP_MSKADDR" description="Mask address of device" default="255.255.255.0" />
|
||||
#define RT_LWIP_MSKADDR0 255
|
||||
#define RT_LWIP_MSKADDR1 255
|
||||
#define RT_LWIP_MSKADDR2 255
|
||||
#define RT_LWIP_MSKADDR3 0
|
||||
// </section>
|
||||
|
||||
|
||||
|
||||
// </RDTConfigurator>
|
||||
|
||||
|
||||
#endif
|
||||
139
bsp/lpc43xx/M4/rtconfig.py
Normal file
139
bsp/lpc43xx/M4/rtconfig.py
Normal file
@@ -0,0 +1,139 @@
|
||||
import os
|
||||
|
||||
# core to be use
|
||||
#USE_CORE = 'CORE_M0'
|
||||
USE_CORE = 'CORE_M4'
|
||||
|
||||
# toolchains options
|
||||
ARCH='arm'
|
||||
|
||||
if USE_CORE == 'CORE_M4':
|
||||
CPU = 'cortex-m4'
|
||||
else:
|
||||
CPU = 'cortex-m0'
|
||||
|
||||
CROSS_TOOL='keil'
|
||||
|
||||
|
||||
# get setting from environment.
|
||||
if os.getenv('RTT_CC'):
|
||||
CROSS_TOOL = os.getenv('RTT_CC')
|
||||
|
||||
# cross_tool provides the cross compiler
|
||||
# EXEC_PATH is the compiler execute path, for example, CodeSourcery, Keil MDK, IAR
|
||||
if CROSS_TOOL == 'gcc':
|
||||
PLATFORM = 'gcc'
|
||||
EXEC_PATH = r'C:/Program Files/CodeSourcery/arm-none-eabi/bin'
|
||||
elif CROSS_TOOL == 'keil':
|
||||
PLATFORM = 'armcc'
|
||||
EXEC_PATH = r'D:/Keil'
|
||||
elif CROSS_TOOL == 'iar':
|
||||
PLATFORM = 'iar'
|
||||
IAR_PATH = r'C:/Program Files/IAR Systems/Embedded Workbench 6.0'
|
||||
|
||||
if os.getenv('RTT_EXEC_PATH'):
|
||||
EXEC_PATH = os.getenv('RTT_EXEC_PATH')
|
||||
|
||||
#
|
||||
BUILD = 'release'
|
||||
|
||||
if PLATFORM == 'gcc':
|
||||
# toolchains
|
||||
PREFIX = 'arm-none-eabi-'
|
||||
CC = PREFIX + 'gcc'
|
||||
AS = PREFIX + 'gcc'
|
||||
AR = PREFIX + 'ar'
|
||||
LINK = PREFIX + 'gcc'
|
||||
TARGET_EXT = 'elf'
|
||||
SIZE = PREFIX + 'size'
|
||||
OBJDUMP = PREFIX + 'objdump'
|
||||
OBJCPY = PREFIX + 'objcopy'
|
||||
DEVICE = ' -mcpu=' + CPU + ' -mthumb -ffunction-sections -fdata-sections'
|
||||
if USE_CORE == 'CORE_M4':
|
||||
DEVICE += ' -mfpu=fpv4-sp-d16 -mfloat-abi=softfp'
|
||||
CFLAGS = DEVICE
|
||||
AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb '
|
||||
LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rtthread-lpc43xx.map,-cref,-u,Reset_Handler -T lpc43xx_spifi.ld'
|
||||
|
||||
CPATH = ''
|
||||
LPATH = ''
|
||||
|
||||
if BUILD == 'debug':
|
||||
CFLAGS += ' -O0 -gdwarf-2'
|
||||
AFLAGS += ' -gdwarf-2'
|
||||
else:
|
||||
CFLAGS += ' -O2'
|
||||
|
||||
POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n'
|
||||
|
||||
elif PLATFORM == 'armcc':
|
||||
# toolchains
|
||||
CC = 'armcc'
|
||||
AS = 'armasm'
|
||||
AR = 'armar'
|
||||
LINK = 'armlink'
|
||||
TARGET_EXT = 'axf'
|
||||
|
||||
DEVICE = ' --device DARMSTM'
|
||||
CFLAGS = DEVICE + ' --apcs=interwork'
|
||||
AFLAGS = DEVICE
|
||||
LFLAGS = DEVICE + ' --info sizes --info totals --info unused --info veneers --list rtthread-lpc43xx.map --scatter rtthread-lpc43xx_spifi.sct'
|
||||
|
||||
CFLAGS += ' -I' + EXEC_PATH + '/ARM/RV31/INC'
|
||||
LFLAGS += ' --libpath ' + EXEC_PATH + '/ARM/RV31/LIB'
|
||||
|
||||
EXEC_PATH += '/arm/bin40/'
|
||||
|
||||
if BUILD == 'debug':
|
||||
CFLAGS += ' -g -O0'
|
||||
AFLAGS += ' -g'
|
||||
else:
|
||||
CFLAGS += ' -O2'
|
||||
|
||||
POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET'
|
||||
|
||||
elif PLATFORM == 'iar':
|
||||
# toolchains
|
||||
CC = 'iccarm'
|
||||
AS = 'iasmarm'
|
||||
AR = 'iarchive'
|
||||
LINK = 'ilinkarm'
|
||||
TARGET_EXT = 'out'
|
||||
|
||||
CFLAGS = ' --diag_suppress Pa050'
|
||||
CFLAGS += ' --no_cse'
|
||||
CFLAGS += ' --no_unroll'
|
||||
CFLAGS += ' --no_inline'
|
||||
CFLAGS += ' --no_code_motion'
|
||||
CFLAGS += ' --no_tbaa'
|
||||
CFLAGS += ' --no_clustering'
|
||||
CFLAGS += ' --no_scheduling'
|
||||
CFLAGS += ' --debug'
|
||||
CFLAGS += ' --endian=little'
|
||||
if USE_CORE == 'CORE_M4':
|
||||
CFLAGS += ' --cpu=Cortex-M4'
|
||||
CFLAGS += ' --fpu=None'
|
||||
else:
|
||||
CFLAGS += ' --cpu=Cortex-M0'
|
||||
CFLAGS += ' -e'
|
||||
CFLAGS += ' --dlib_config "' + IAR_PATH + '/arm/INC/c/DLib_Config_Normal.h"'
|
||||
CFLAGS += ' -Ol'
|
||||
CFLAGS += ' --use_c++_inline'
|
||||
|
||||
AFLAGS = ''
|
||||
AFLAGS += ' -s+'
|
||||
AFLAGS += ' -w+'
|
||||
AFLAGS += ' -r'
|
||||
if USE_CORE == 'CORE_M4':
|
||||
AFLAGS += ' --cpu Cortex-M4'
|
||||
AFLAGS += ' --fpu None'
|
||||
else:
|
||||
AFLAGS += ' --cpu Cortex-M0'
|
||||
|
||||
LFLAGS = ' --config lpc43xx_flash.icf'
|
||||
LFLAGS += ' --redirect _Printf=_PrintfTiny'
|
||||
LFLAGS += ' --redirect _Scanf=_ScanfSmall'
|
||||
LFLAGS += ' --entry __iar_program_start'
|
||||
|
||||
EXEC_PATH = IAR_PATH + '/arm/bin/'
|
||||
POST_ACTION = ''
|
||||
349
bsp/lpc43xx/M4/template.uvopt
Normal file
349
bsp/lpc43xx/M4/template.uvopt
Normal file
@@ -0,0 +1,349 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||
<ProjectOpt xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="project_opt.xsd">
|
||||
|
||||
<SchemaVersion>1.0</SchemaVersion>
|
||||
|
||||
<Header>### uVision Project, (C) Keil Software</Header>
|
||||
|
||||
<Extensions>
|
||||
<cExt>*.c</cExt>
|
||||
<aExt>*.s*; *.src; *.a*</aExt>
|
||||
<oExt>*.obj</oExt>
|
||||
<lExt>*.lib</lExt>
|
||||
<tExt>*.txt; *.h; *.inc</tExt>
|
||||
<pExt>*.plm</pExt>
|
||||
<CppX>*.cpp</CppX>
|
||||
</Extensions>
|
||||
|
||||
<DaveTm>
|
||||
<dwLowDateTime>0</dwLowDateTime>
|
||||
<dwHighDateTime>0</dwHighDateTime>
|
||||
</DaveTm>
|
||||
|
||||
<Target>
|
||||
<TargetName>LPC43xx SPIFI</TargetName>
|
||||
<ToolsetNumber>0x4</ToolsetNumber>
|
||||
<ToolsetName>ARM-ADS</ToolsetName>
|
||||
<TargetOption>
|
||||
<CLKADS>12000000</CLKADS>
|
||||
<OPTTT>
|
||||
<gFlags>1</gFlags>
|
||||
<BeepAtEnd>1</BeepAtEnd>
|
||||
<RunSim>1</RunSim>
|
||||
<RunTarget>0</RunTarget>
|
||||
</OPTTT>
|
||||
<OPTHX>
|
||||
<HexSelection>1</HexSelection>
|
||||
<FlashByte>65535</FlashByte>
|
||||
<HexRangeLowAddress>0</HexRangeLowAddress>
|
||||
<HexRangeHighAddress>0</HexRangeHighAddress>
|
||||
<HexOffset>0</HexOffset>
|
||||
</OPTHX>
|
||||
<OPTLEX>
|
||||
<PageWidth>79</PageWidth>
|
||||
<PageLength>66</PageLength>
|
||||
<TabStop>8</TabStop>
|
||||
<ListingPath>.\build\</ListingPath>
|
||||
</OPTLEX>
|
||||
<ListingPage>
|
||||
<CreateCListing>1</CreateCListing>
|
||||
<CreateAListing>1</CreateAListing>
|
||||
<CreateLListing>1</CreateLListing>
|
||||
<CreateIListing>0</CreateIListing>
|
||||
<AsmCond>1</AsmCond>
|
||||
<AsmSymb>1</AsmSymb>
|
||||
<AsmXref>0</AsmXref>
|
||||
<CCond>1</CCond>
|
||||
<CCode>0</CCode>
|
||||
<CListInc>0</CListInc>
|
||||
<CSymb>0</CSymb>
|
||||
<LinkerCodeListing>0</LinkerCodeListing>
|
||||
</ListingPage>
|
||||
<OPTXL>
|
||||
<LMap>1</LMap>
|
||||
<LComments>1</LComments>
|
||||
<LGenerateSymbols>1</LGenerateSymbols>
|
||||
<LLibSym>1</LLibSym>
|
||||
<LLines>1</LLines>
|
||||
<LLocSym>1</LLocSym>
|
||||
<LPubSym>1</LPubSym>
|
||||
<LXref>0</LXref>
|
||||
<LExpSel>0</LExpSel>
|
||||
</OPTXL>
|
||||
<OPTFL>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<IsCurrentTarget>1</IsCurrentTarget>
|
||||
</OPTFL>
|
||||
<CpuCode>8</CpuCode>
|
||||
<Books>
|
||||
<Book>
|
||||
<Number>0</Number>
|
||||
<Title>User Manual</Title>
|
||||
<Path>DATASHTS\NXP\LPC43xx\UM10503.pdf</Path>
|
||||
</Book>
|
||||
<Book>
|
||||
<Number>1</Number>
|
||||
<Title>Data Sheet</Title>
|
||||
<Path>DATASHTS\NXP\LPC43xx\LPC435X_3X_2X_1X.pdf</Path>
|
||||
</Book>
|
||||
<Book>
|
||||
<Number>2</Number>
|
||||
<Title>Technical Reference Manual</Title>
|
||||
<Path>datashts\arm\cortex_m4\r0p1\DDI0439C_CORTEX_M4_R0P1_TRM.PDF</Path>
|
||||
</Book>
|
||||
<Book>
|
||||
<Number>3</Number>
|
||||
<Title>Generic User Guide</Title>
|
||||
<Path>datashts\arm\cortex_m4\r0p1\DUI0553A_CORTEX_M4_DGUG.PDF</Path>
|
||||
</Book>
|
||||
</Books>
|
||||
<DllOpt>
|
||||
<SimDllName>SARMCM3.DLL</SimDllName>
|
||||
<SimDllArguments>-MPU</SimDllArguments>
|
||||
<SimDlgDllName>DCM.DLL</SimDlgDllName>
|
||||
<SimDlgDllArguments>-pCM4</SimDlgDllArguments>
|
||||
<TargetDllName>SARMCM3.DLL</TargetDllName>
|
||||
<TargetDllArguments>-MPU</TargetDllArguments>
|
||||
<TargetDlgDllName>TCM.DLL</TargetDlgDllName>
|
||||
<TargetDlgDllArguments>-pCM4</TargetDlgDllArguments>
|
||||
</DllOpt>
|
||||
<DebugOpt>
|
||||
<uSim>0</uSim>
|
||||
<uTrg>1</uTrg>
|
||||
<sLdApp>1</sLdApp>
|
||||
<sGomain>1</sGomain>
|
||||
<sRbreak>1</sRbreak>
|
||||
<sRwatch>1</sRwatch>
|
||||
<sRmem>1</sRmem>
|
||||
<sRfunc>1</sRfunc>
|
||||
<sRbox>1</sRbox>
|
||||
<tLdApp>1</tLdApp>
|
||||
<tGomain>1</tGomain>
|
||||
<tRbreak>1</tRbreak>
|
||||
<tRwatch>1</tRwatch>
|
||||
<tRmem>0</tRmem>
|
||||
<tRfunc>0</tRfunc>
|
||||
<tRbox>1</tRbox>
|
||||
<tRtrace>0</tRtrace>
|
||||
<sRunDeb>0</sRunDeb>
|
||||
<sLrtime>0</sLrtime>
|
||||
<nTsel>1</nTsel>
|
||||
<sDll></sDll>
|
||||
<sDllPa></sDllPa>
|
||||
<sDlgDll></sDlgDll>
|
||||
<sDlgPa></sDlgPa>
|
||||
<sIfile></sIfile>
|
||||
<tDll></tDll>
|
||||
<tDllPa></tDllPa>
|
||||
<tDlgDll></tDlgDll>
|
||||
<tDlgPa></tDlgPa>
|
||||
<tIfile></tIfile>
|
||||
<pMon>BIN\UL2CM3.DLL</pMon>
|
||||
</DebugOpt>
|
||||
<TargetDriverDllRegistry>
|
||||
<SetRegEntry>
|
||||
<Number>0</Number>
|
||||
<Key>UL2CM3</Key>
|
||||
<Name>-U-O783 -O783 -S0 -C0 -P00 -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD10000000 -FC8000 -FN3 -FF0LPC18xx43xx_512_BA -FS01A000000 -FL080000 -FF1LPC18xx43xx_512_BB -FS11B000000 -FL180000 -FF2LPC18xx43xx_S25FL032 -FS214000000 -FL2400000</Name>
|
||||
</SetRegEntry>
|
||||
</TargetDriverDllRegistry>
|
||||
<Breakpoint/>
|
||||
<Tracepoint>
|
||||
<THDelay>0</THDelay>
|
||||
</Tracepoint>
|
||||
<DebugFlag>
|
||||
<trace>0</trace>
|
||||
<periodic>0</periodic>
|
||||
<aLwin>0</aLwin>
|
||||
<aCover>0</aCover>
|
||||
<aSer1>0</aSer1>
|
||||
<aSer2>0</aSer2>
|
||||
<aPa>0</aPa>
|
||||
<viewmode>0</viewmode>
|
||||
<vrSel>0</vrSel>
|
||||
<aSym>0</aSym>
|
||||
<aTbox>0</aTbox>
|
||||
<AscS1>0</AscS1>
|
||||
<AscS2>0</AscS2>
|
||||
<AscS3>0</AscS3>
|
||||
<aSer3>0</aSer3>
|
||||
<eProf>0</eProf>
|
||||
<aLa>0</aLa>
|
||||
<aPa1>0</aPa1>
|
||||
<AscS4>0</AscS4>
|
||||
<aSer4>0</aSer4>
|
||||
<StkLoc>0</StkLoc>
|
||||
<TrcWin>0</TrcWin>
|
||||
<newCpu>0</newCpu>
|
||||
<uProt>0</uProt>
|
||||
</DebugFlag>
|
||||
<LintExecutable></LintExecutable>
|
||||
<LintConfigFile></LintConfigFile>
|
||||
</TargetOption>
|
||||
</Target>
|
||||
|
||||
<Target>
|
||||
<TargetName>LPC43xx RAM</TargetName>
|
||||
<ToolsetNumber>0x4</ToolsetNumber>
|
||||
<ToolsetName>ARM-ADS</ToolsetName>
|
||||
<TargetOption>
|
||||
<CLKADS>12000000</CLKADS>
|
||||
<OPTTT>
|
||||
<gFlags>1</gFlags>
|
||||
<BeepAtEnd>1</BeepAtEnd>
|
||||
<RunSim>1</RunSim>
|
||||
<RunTarget>0</RunTarget>
|
||||
</OPTTT>
|
||||
<OPTHX>
|
||||
<HexSelection>1</HexSelection>
|
||||
<FlashByte>65535</FlashByte>
|
||||
<HexRangeLowAddress>0</HexRangeLowAddress>
|
||||
<HexRangeHighAddress>0</HexRangeHighAddress>
|
||||
<HexOffset>0</HexOffset>
|
||||
</OPTHX>
|
||||
<OPTLEX>
|
||||
<PageWidth>79</PageWidth>
|
||||
<PageLength>66</PageLength>
|
||||
<TabStop>8</TabStop>
|
||||
<ListingPath>.\build\</ListingPath>
|
||||
</OPTLEX>
|
||||
<ListingPage>
|
||||
<CreateCListing>1</CreateCListing>
|
||||
<CreateAListing>1</CreateAListing>
|
||||
<CreateLListing>1</CreateLListing>
|
||||
<CreateIListing>0</CreateIListing>
|
||||
<AsmCond>1</AsmCond>
|
||||
<AsmSymb>1</AsmSymb>
|
||||
<AsmXref>0</AsmXref>
|
||||
<CCond>1</CCond>
|
||||
<CCode>0</CCode>
|
||||
<CListInc>0</CListInc>
|
||||
<CSymb>0</CSymb>
|
||||
<LinkerCodeListing>0</LinkerCodeListing>
|
||||
</ListingPage>
|
||||
<OPTXL>
|
||||
<LMap>1</LMap>
|
||||
<LComments>1</LComments>
|
||||
<LGenerateSymbols>1</LGenerateSymbols>
|
||||
<LLibSym>1</LLibSym>
|
||||
<LLines>1</LLines>
|
||||
<LLocSym>1</LLocSym>
|
||||
<LPubSym>1</LPubSym>
|
||||
<LXref>0</LXref>
|
||||
<LExpSel>0</LExpSel>
|
||||
</OPTXL>
|
||||
<OPTFL>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<IsCurrentTarget>0</IsCurrentTarget>
|
||||
</OPTFL>
|
||||
<CpuCode>8</CpuCode>
|
||||
<Books>
|
||||
<Book>
|
||||
<Number>0</Number>
|
||||
<Title>User Manual</Title>
|
||||
<Path>DATASHTS\NXP\LPC43xx\UM10503.pdf</Path>
|
||||
</Book>
|
||||
<Book>
|
||||
<Number>1</Number>
|
||||
<Title>Data Sheet</Title>
|
||||
<Path>DATASHTS\NXP\LPC43xx\LPC435X_3X_2X_1X.pdf</Path>
|
||||
</Book>
|
||||
<Book>
|
||||
<Number>2</Number>
|
||||
<Title>Technical Reference Manual</Title>
|
||||
<Path>datashts\arm\cortex_m4\r0p1\DDI0439C_CORTEX_M4_R0P1_TRM.PDF</Path>
|
||||
</Book>
|
||||
<Book>
|
||||
<Number>3</Number>
|
||||
<Title>Generic User Guide</Title>
|
||||
<Path>datashts\arm\cortex_m4\r0p1\DUI0553A_CORTEX_M4_DGUG.PDF</Path>
|
||||
</Book>
|
||||
</Books>
|
||||
<DllOpt>
|
||||
<SimDllName>SARMCM3.DLL</SimDllName>
|
||||
<SimDllArguments>-MPU</SimDllArguments>
|
||||
<SimDlgDllName>DCM.DLL</SimDlgDllName>
|
||||
<SimDlgDllArguments>-pCM4</SimDlgDllArguments>
|
||||
<TargetDllName>SARMCM3.DLL</TargetDllName>
|
||||
<TargetDllArguments>-MPU</TargetDllArguments>
|
||||
<TargetDlgDllName>TCM.DLL</TargetDlgDllName>
|
||||
<TargetDlgDllArguments>-pCM4</TargetDlgDllArguments>
|
||||
</DllOpt>
|
||||
<DebugOpt>
|
||||
<uSim>0</uSim>
|
||||
<uTrg>1</uTrg>
|
||||
<sLdApp>1</sLdApp>
|
||||
<sGomain>1</sGomain>
|
||||
<sRbreak>1</sRbreak>
|
||||
<sRwatch>1</sRwatch>
|
||||
<sRmem>1</sRmem>
|
||||
<sRfunc>1</sRfunc>
|
||||
<sRbox>1</sRbox>
|
||||
<tLdApp>0</tLdApp>
|
||||
<tGomain>0</tGomain>
|
||||
<tRbreak>1</tRbreak>
|
||||
<tRwatch>1</tRwatch>
|
||||
<tRmem>0</tRmem>
|
||||
<tRfunc>0</tRfunc>
|
||||
<tRbox>1</tRbox>
|
||||
<tRtrace>0</tRtrace>
|
||||
<sRunDeb>0</sRunDeb>
|
||||
<sLrtime>0</sLrtime>
|
||||
<nTsel>1</nTsel>
|
||||
<sDll></sDll>
|
||||
<sDllPa></sDllPa>
|
||||
<sDlgDll></sDlgDll>
|
||||
<sDlgPa></sDlgPa>
|
||||
<sIfile></sIfile>
|
||||
<tDll></tDll>
|
||||
<tDllPa></tDllPa>
|
||||
<tDlgDll></tDlgDll>
|
||||
<tDlgPa></tDlgPa>
|
||||
<tIfile>.\Dbg_RAM.ini</tIfile>
|
||||
<pMon>BIN\UL2CM3.DLL</pMon>
|
||||
</DebugOpt>
|
||||
<TargetDriverDllRegistry>
|
||||
<SetRegEntry>
|
||||
<Number>0</Number>
|
||||
<Key>UL2CM3</Key>
|
||||
<Name>-U -O783 -S0 -C0 -P00 -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD10000000 -FC8000 -FN3 -FF0LPC18xx43xx_512_BA -FS01A000000 -FL080000 -FF1LPC18xx43xx_512_BB -FS11B000000 -FL180000 -FF2LPC18xx43xx_S25FL032 -FS214000000 -FL2400000</Name>
|
||||
</SetRegEntry>
|
||||
</TargetDriverDllRegistry>
|
||||
<Breakpoint/>
|
||||
<Tracepoint>
|
||||
<THDelay>0</THDelay>
|
||||
</Tracepoint>
|
||||
<DebugFlag>
|
||||
<trace>0</trace>
|
||||
<periodic>0</periodic>
|
||||
<aLwin>0</aLwin>
|
||||
<aCover>0</aCover>
|
||||
<aSer1>0</aSer1>
|
||||
<aSer2>0</aSer2>
|
||||
<aPa>0</aPa>
|
||||
<viewmode>0</viewmode>
|
||||
<vrSel>0</vrSel>
|
||||
<aSym>0</aSym>
|
||||
<aTbox>0</aTbox>
|
||||
<AscS1>0</AscS1>
|
||||
<AscS2>0</AscS2>
|
||||
<AscS3>0</AscS3>
|
||||
<aSer3>0</aSer3>
|
||||
<eProf>0</eProf>
|
||||
<aLa>0</aLa>
|
||||
<aPa1>0</aPa1>
|
||||
<AscS4>0</AscS4>
|
||||
<aSer4>0</aSer4>
|
||||
<StkLoc>0</StkLoc>
|
||||
<TrcWin>0</TrcWin>
|
||||
<newCpu>0</newCpu>
|
||||
<uProt>0</uProt>
|
||||
</DebugFlag>
|
||||
<LintExecutable></LintExecutable>
|
||||
<LintConfigFile></LintConfigFile>
|
||||
</TargetOption>
|
||||
</Target>
|
||||
|
||||
</ProjectOpt>
|
||||
777
bsp/lpc43xx/M4/template.uvproj
Normal file
777
bsp/lpc43xx/M4/template.uvproj
Normal file
File diff suppressed because it is too large
Load Diff
11
bsp/lpc43xx/applications/SConscript
Normal file
11
bsp/lpc43xx/applications/SConscript
Normal file
@@ -0,0 +1,11 @@
|
||||
Import('RTT_ROOT')
|
||||
Import('rtconfig')
|
||||
from building import *
|
||||
|
||||
cwd = os.path.join(str(Dir('#')), 'applications')
|
||||
src = Glob('*.c')
|
||||
CPPPATH = [cwd, str(Dir('#'))]
|
||||
|
||||
group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH)
|
||||
|
||||
Return('group')
|
||||
84
bsp/lpc43xx/applications/application.c
Normal file
84
bsp/lpc43xx/applications/application.c
Normal file
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
* File : application.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2014, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2014-07-13 xiaonong port for lpc43xx
|
||||
*/
|
||||
|
||||
#include <rtthread.h>
|
||||
#include <board.h>
|
||||
#include <rtdevice.h>
|
||||
#include "drv_led.h"
|
||||
#ifdef RT_USING_FINSH
|
||||
#include <finsh.h>
|
||||
#include <shell.h>
|
||||
#endif
|
||||
|
||||
/* thread phase init */
|
||||
void rt_init_thread_entry(void *parameter)
|
||||
{
|
||||
#ifdef RT_USING_FINSH
|
||||
/* initialize finsh */
|
||||
finsh_system_init();
|
||||
finsh_set_device(RT_CONSOLE_DEVICE_NAME);
|
||||
#endif
|
||||
}
|
||||
/*the led thread*/
|
||||
ALIGN(RT_ALIGN_SIZE)
|
||||
static rt_uint8_t led_stack[ 512 ];
|
||||
static struct rt_thread led_thread;
|
||||
static void led_thread_entry(void *parameter)
|
||||
{
|
||||
rt_uint8_t led_value = 0;
|
||||
rt_device_t led_dev;
|
||||
rt_led_hw_init();
|
||||
led_dev = rt_device_find("led");
|
||||
if (led_dev == RT_NULL)
|
||||
{
|
||||
rt_kprintf("can not find the led device!\n");
|
||||
return;
|
||||
}
|
||||
while (1)
|
||||
{
|
||||
/* led0 on */
|
||||
led_value = 1;
|
||||
led_dev->write(led_dev, 0, &led_value, 1);
|
||||
rt_thread_delay(RT_TICK_PER_SECOND / 2); /* sleep 0.5 second and switch to other thread */
|
||||
|
||||
/* led0 off */
|
||||
led_value = 0;
|
||||
led_dev->write(led_dev, 0, &led_value, 1);
|
||||
rt_thread_delay(RT_TICK_PER_SECOND / 2);
|
||||
}
|
||||
}
|
||||
|
||||
int rt_application_init(void)
|
||||
{
|
||||
rt_thread_t tid;
|
||||
rt_err_t result;
|
||||
tid = rt_thread_create("init",
|
||||
rt_init_thread_entry, RT_NULL,
|
||||
2048, RT_THREAD_PRIORITY_MAX / 3, 20);
|
||||
if (tid != RT_NULL) rt_thread_startup(tid);
|
||||
/* init led thread */
|
||||
result = rt_thread_init(&led_thread,
|
||||
"led",
|
||||
led_thread_entry,
|
||||
RT_NULL,
|
||||
(rt_uint8_t *)&led_stack[0],
|
||||
sizeof(led_stack),
|
||||
20,
|
||||
5);
|
||||
if (result == RT_EOK)
|
||||
{
|
||||
rt_thread_startup(&led_thread);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
74
bsp/lpc43xx/applications/startup.c
Normal file
74
bsp/lpc43xx/applications/startup.c
Normal file
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* File : startup.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2009, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2009-01-05 Bernard first implementation
|
||||
* 2014-07-13 xiaonong for LPC43xx
|
||||
*/
|
||||
|
||||
#include <rthw.h>
|
||||
#include <rtthread.h>
|
||||
|
||||
#include "board.h"
|
||||
|
||||
extern int rt_application_init(void);
|
||||
|
||||
/**
|
||||
* This function will startup RT-Thread RTOS.
|
||||
*/
|
||||
void rtthread_startup(void)
|
||||
{
|
||||
/* initialize board */
|
||||
rt_hw_board_init();
|
||||
|
||||
/* show version */
|
||||
rt_show_version();
|
||||
|
||||
#ifdef RT_USING_HEAP
|
||||
#if LPC_EXT_SDRAM
|
||||
rt_system_heap_init((void *)LPC_EXT_SDRAM_BEGIN, (void *)LPC_EXT_SDRAM_END);
|
||||
sram_init();
|
||||
#else
|
||||
rt_system_heap_init((void *)HEAP_BEGIN, (void *)HEAP_END);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* initialize scheduler system */
|
||||
rt_system_scheduler_init();
|
||||
|
||||
/* initialize system timer*/
|
||||
rt_system_timer_init();
|
||||
|
||||
/* initialize application */
|
||||
rt_application_init();
|
||||
|
||||
/* initialize timer thread */
|
||||
rt_system_timer_thread_init();
|
||||
|
||||
/* initialize idle thread */
|
||||
rt_thread_idle_init();
|
||||
|
||||
/* start scheduler */
|
||||
rt_system_scheduler_start();
|
||||
|
||||
/* never reach here */
|
||||
return ;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
/* disable interrupt first */
|
||||
rt_hw_interrupt_disable();
|
||||
|
||||
/* startup RT-Thread RTOS */
|
||||
rtthread_startup();
|
||||
|
||||
return 0;
|
||||
}
|
||||
14
bsp/lpc43xx/drivers/SConscript
Normal file
14
bsp/lpc43xx/drivers/SConscript
Normal file
@@ -0,0 +1,14 @@
|
||||
from building import *
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
src = Glob('*.c')
|
||||
|
||||
# remove no need file.
|
||||
if GetDepend('RT_USING_LWIP') == False:
|
||||
SrcRemove(src, 'drv_emac.c')
|
||||
|
||||
CPPPATH = [cwd]
|
||||
|
||||
group = DefineGroup('Drivers', src, depend = [''], CPPPATH = CPPPATH)
|
||||
|
||||
Return('group')
|
||||
77
bsp/lpc43xx/drivers/board.c
Normal file
77
bsp/lpc43xx/drivers/board.c
Normal file
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* File : board.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2014 RT-Thread Develop Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2009-01-05 Bernard first implementation
|
||||
* 2014-06-20 xiaonong ported to LPC43xx
|
||||
*/
|
||||
|
||||
#include <rthw.h>
|
||||
#include <rtthread.h>
|
||||
|
||||
#include "board.h"
|
||||
#include "drv_uart.h"
|
||||
|
||||
|
||||
/**
|
||||
* This is the timer interrupt service routine.
|
||||
*
|
||||
*/
|
||||
void SysTick_Handler(void)
|
||||
{
|
||||
/* enter interrupt */
|
||||
rt_interrupt_enter();
|
||||
|
||||
rt_tick_increase();
|
||||
|
||||
/* leave interrupt */
|
||||
rt_interrupt_leave();
|
||||
}
|
||||
|
||||
extern void SystemCoreClockUpdate(void);
|
||||
/**
|
||||
* This function will initial LPC43xx board.
|
||||
*/
|
||||
void rt_hw_board_init()
|
||||
{
|
||||
#ifdef CORE_M4
|
||||
/* NVIC Configuration */
|
||||
#define NVIC_VTOR_MASK 0x3FFFFF80
|
||||
#ifdef VECT_TAB_RAM
|
||||
/* Set the Vector Table base location at 0x10000000 */
|
||||
SCB->VTOR = (0x10000000 & NVIC_VTOR_MASK);
|
||||
#else /* VECT_TAB_FLASH */
|
||||
/* Set the Vector Table base location at 0x00000000 */
|
||||
SCB->VTOR = (0x00000000 & NVIC_VTOR_MASK);
|
||||
#endif
|
||||
#endif
|
||||
/* update the core clock */
|
||||
SystemCoreClockUpdate();
|
||||
|
||||
/* init systick */
|
||||
SysTick_Config(SystemCoreClock / RT_TICK_PER_SECOND - 1);
|
||||
|
||||
/* set pend exception priority */
|
||||
NVIC_SetPriority(PendSV_IRQn, (1 << __NVIC_PRIO_BITS) - 1);
|
||||
|
||||
/* init uart device */
|
||||
rt_hw_uart_init();
|
||||
|
||||
/* setup the console device */
|
||||
rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
|
||||
|
||||
#if LPC_EXT_SDRAM == 1
|
||||
lpc_sdram_hw_init();
|
||||
mpu_init();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
60
bsp/lpc43xx/drivers/board.h
Normal file
60
bsp/lpc43xx/drivers/board.h
Normal file
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* File : board.h
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2009, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2009-09-22 Bernard add board.h to this bsp
|
||||
* 2010-02-04 Magicoe add board.h to LPC176x bsp
|
||||
* 2013-12-18 Bernard porting to LPC4088 bsp
|
||||
*/
|
||||
|
||||
#ifndef __BOARD_H__
|
||||
#define __BOARD_H__
|
||||
|
||||
#include "LPC43xx.h"
|
||||
#include <rtthread.h>
|
||||
|
||||
/* disable SDRAM in default */
|
||||
#ifndef LPC_EXT_SDRAM
|
||||
#define LPC_EXT_SDRAM 0
|
||||
#endif
|
||||
|
||||
// <RDTConfigurator URL="http://www.rt-thread.com/eclipse">
|
||||
|
||||
// <integer name="LPC_EXT_SDRAM" description="Begin Address of External SDRAM" default="0xA0000000" />
|
||||
#define LPC_EXT_SDRAM_BEGIN 0xA0000000
|
||||
// <integer name="LPC_EXT_SDRAM_END" description="End Address of External SDRAM" default="0xA2000000" />
|
||||
#define LPC_EXT_SDRAM_END 0xA2000000
|
||||
|
||||
// <bool name="RT_USING_UART0" description="Using UART0" default="true" />
|
||||
#define RT_USING_UART0
|
||||
// <bool name="RT_USING_UART1" description="Using UART1" default="true" />
|
||||
//#define RT_USING_UART1
|
||||
// <bool name="RT_USING_UART2" description="Using UART2" default="true" />
|
||||
//#define RT_USING_UART2
|
||||
|
||||
// </RDTConfigurator>
|
||||
|
||||
#ifdef __CC_ARM
|
||||
extern int Image$$RW_IRAM1$$ZI$$Limit;
|
||||
#define HEAP_BEGIN ((void *)&Image$$RW_IRAM1$$ZI$$Limit)
|
||||
#elif __ICCARM__
|
||||
#pragma section="HEAP"
|
||||
#define HEAP_BEGIN (__segment_end("HEAP"))
|
||||
#else
|
||||
extern int __bss_end;
|
||||
#define HEAP_BEGIN ((void *)&__bss_end)
|
||||
#endif
|
||||
#define HEAP_END (void*)(0x10000000 + 0x8000)
|
||||
|
||||
void rt_hw_board_init(void);
|
||||
int rt_hw_board_heap_init(void);
|
||||
|
||||
|
||||
#endif
|
||||
536
bsp/lpc43xx/drivers/drv_emac.c
Normal file
536
bsp/lpc43xx/drivers/drv_emac.c
Normal file
File diff suppressed because it is too large
Load Diff
291
bsp/lpc43xx/drivers/drv_emac.h
Normal file
291
bsp/lpc43xx/drivers/drv_emac.h
Normal file
@@ -0,0 +1,291 @@
|
||||
/*
|
||||
* File : drv_emac.h
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2009-2013 RT-Thread Develop Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2013-05-19 Bernard porting from LPC17xx drivers.
|
||||
*/
|
||||
|
||||
#ifndef __DRV_EMAC_H__
|
||||
#define __DRV_EMAC_H__
|
||||
|
||||
#include "board.h"
|
||||
|
||||
/* EMAC Memory Buffer configuration for 16K Ethernet RAM. */
|
||||
#define NUM_RX_FRAG 4 /* Num.of RX Fragments 4*1536= 6.0kB */
|
||||
#define NUM_TX_FRAG 3 /* Num.of TX Fragments 3*1536= 4.6kB */
|
||||
#define ETH_FRAG_SIZE 1536 /* Packet Fragment size 1536 Bytes */
|
||||
|
||||
#define ETH_MAX_FLEN 1536 /* Max. Ethernet Frame Size */
|
||||
|
||||
|
||||
/* MAC Configuration Register 1 */
|
||||
#define MAC1_REC_EN 0x00000001 /* Receive Enable */
|
||||
#define MAC1_PASS_ALL 0x00000002 /* Pass All Receive Frames */
|
||||
#define MAC1_RX_FLOWC 0x00000004 /* RX Flow Control */
|
||||
#define MAC1_TX_FLOWC 0x00000008 /* TX Flow Control */
|
||||
#define MAC1_LOOPB 0x00000010 /* Loop Back Mode */
|
||||
#define MAC1_RES_TX 0x00000100 /* Reset TX Logic */
|
||||
#define MAC1_RES_MCS_TX 0x00000200 /* Reset MAC TX Control Sublayer */
|
||||
#define MAC1_RES_RX 0x00000400 /* Reset RX Logic */
|
||||
#define MAC1_RES_MCS_RX 0x00000800 /* Reset MAC RX Control Sublayer */
|
||||
#define MAC1_SIM_RES 0x00004000 /* Simulation Reset */
|
||||
#define MAC1_SOFT_RES 0x00008000 /* Soft Reset MAC */
|
||||
|
||||
/* MAC Configuration Register 2 */
|
||||
#define MAC2_FULL_DUP 0x00000001 /* Full Duplex Mode */
|
||||
#define MAC2_FRM_LEN_CHK 0x00000002 /* Frame Length Checking */
|
||||
#define MAC2_HUGE_FRM_EN 0x00000004 /* Huge Frame Enable */
|
||||
#define MAC2_DLY_CRC 0x00000008 /* Delayed CRC Mode */
|
||||
#define MAC2_CRC_EN 0x00000010 /* Append CRC to every Frame */
|
||||
#define MAC2_PAD_EN 0x00000020 /* Pad all Short Frames */
|
||||
#define MAC2_VLAN_PAD_EN 0x00000040 /* VLAN Pad Enable */
|
||||
#define MAC2_ADET_PAD_EN 0x00000080 /* Auto Detect Pad Enable */
|
||||
#define MAC2_PPREAM_ENF 0x00000100 /* Pure Preamble Enforcement */
|
||||
#define MAC2_LPREAM_ENF 0x00000200 /* Long Preamble Enforcement */
|
||||
#define MAC2_NO_BACKOFF 0x00001000 /* No Backoff Algorithm */
|
||||
#define MAC2_BACK_PRESSURE 0x00002000 /* Backoff Presurre / No Backoff */
|
||||
#define MAC2_EXCESS_DEF 0x00004000 /* Excess Defer */
|
||||
|
||||
/* Back-to-Back Inter-Packet-Gap Register */
|
||||
#define IPGT_FULL_DUP 0x00000015 /* Recommended value for Full Duplex */
|
||||
#define IPGT_HALF_DUP 0x00000012 /* Recommended value for Half Duplex */
|
||||
|
||||
/* Non Back-to-Back Inter-Packet-Gap Register */
|
||||
#define IPGR_DEF 0x00000012 /* Recommended value */
|
||||
|
||||
/* Collision Window/Retry Register */
|
||||
#define CLRT_DEF 0x0000370F /* Default value */
|
||||
|
||||
/* PHY Support Register */
|
||||
#define SUPP_SPEED 0x00000100 /* Reduced MII Logic Current Speed */
|
||||
#define SUPP_RES_RMII 0x00000800 /* Reset Reduced MII Logic */
|
||||
|
||||
/* Test Register */
|
||||
#define TEST_SHCUT_PQUANTA 0x00000001 /* Shortcut Pause Quanta */
|
||||
#define TEST_TST_PAUSE 0x00000002 /* Test Pause */
|
||||
#define TEST_TST_BACKP 0x00000004 /* Test Back Pressure */
|
||||
|
||||
/* MII Management Configuration Register */
|
||||
#define MCFG_SCAN_INC 0x00000001 /* Scan Increment PHY Address */
|
||||
#define MCFG_SUPP_PREAM 0x00000002 /* Suppress Preamble */
|
||||
#define MCFG_CLK_SEL 0x0000001C /* Clock Select Mask */
|
||||
#define MCFG_RES_MII 0x00008000 /* Reset MII Management Hardware */
|
||||
|
||||
#define MCFG_CLK_DIV4 0x00000000 /* MDC = hclk / 4 */
|
||||
#define MCFG_CLK_DIV6 0x00000008 /* MDC = hclk / 6 */
|
||||
#define MCFG_CLK_DIV8 0x0000000C /* MDC = hclk / 8 */
|
||||
#define MCFG_CLK_DIV10 0x00000010 /* MDC = hclk / 10 */
|
||||
#define MCFG_CLK_DIV14 0x00000014 /* MDC = hclk / 14 */
|
||||
#define MCFG_CLK_DIV20 0x00000018 /* MDC = hclk / 20 */
|
||||
#define MCFG_CLK_DIV28 0x0000001C /* MDC = hclk / 28 */
|
||||
|
||||
|
||||
/* MII Management Command Register */
|
||||
#define MCMD_READ 0x00000001 /* MII Read */
|
||||
#define MCMD_SCAN 0x00000002 /* MII Scan continuously */
|
||||
|
||||
#define MII_WR_TOUT 0x00050000 /* MII Write timeout count */
|
||||
#define MII_RD_TOUT 0x00050000 /* MII Read timeout count */
|
||||
|
||||
/* MII Management Address Register */
|
||||
#define MADR_REG_ADR 0x0000001F /* MII Register Address Mask */
|
||||
#define MADR_PHY_ADR 0x00001F00 /* PHY Address Mask */
|
||||
|
||||
/* MII Management Indicators Register */
|
||||
#define MIND_BUSY 0x00000001 /* MII is Busy */
|
||||
#define MIND_SCAN 0x00000002 /* MII Scanning in Progress */
|
||||
#define MIND_NOT_VAL 0x00000004 /* MII Read Data not valid */
|
||||
#define MIND_MII_LINK_FAIL 0x00000008 /* MII Link Failed */
|
||||
|
||||
/* Command Register */
|
||||
#define CR_RX_EN 0x00000001 /* Enable Receive */
|
||||
#define CR_TX_EN 0x00000002 /* Enable Transmit */
|
||||
#define CR_REG_RES 0x00000008 /* Reset Host Registers */
|
||||
#define CR_TX_RES 0x00000010 /* Reset Transmit Datapath */
|
||||
#define CR_RX_RES 0x00000020 /* Reset Receive Datapath */
|
||||
#define CR_PASS_RUNT_FRM 0x00000040 /* Pass Runt Frames */
|
||||
#define CR_PASS_RX_FILT 0x00000080 /* Pass RX Filter */
|
||||
#define CR_TX_FLOW_CTRL 0x00000100 /* TX Flow Control */
|
||||
#define CR_RMII 0x00000200 /* Reduced MII Interface */
|
||||
#define CR_FULL_DUP 0x00000400 /* Full Duplex */
|
||||
|
||||
/* Status Register */
|
||||
#define SR_RX_EN 0x00000001 /* Enable Receive */
|
||||
#define SR_TX_EN 0x00000002 /* Enable Transmit */
|
||||
|
||||
/* Transmit Status Vector 0 Register */
|
||||
#define TSV0_CRC_ERR 0x00000001 /* CRC error */
|
||||
#define TSV0_LEN_CHKERR 0x00000002 /* Length Check Error */
|
||||
#define TSV0_LEN_OUTRNG 0x00000004 /* Length Out of Range */
|
||||
#define TSV0_DONE 0x00000008 /* Tramsmission Completed */
|
||||
#define TSV0_MCAST 0x00000010 /* Multicast Destination */
|
||||
#define TSV0_BCAST 0x00000020 /* Broadcast Destination */
|
||||
#define TSV0_PKT_DEFER 0x00000040 /* Packet Deferred */
|
||||
#define TSV0_EXC_DEFER 0x00000080 /* Excessive Packet Deferral */
|
||||
#define TSV0_EXC_COLL 0x00000100 /* Excessive Collision */
|
||||
#define TSV0_LATE_COLL 0x00000200 /* Late Collision Occured */
|
||||
#define TSV0_GIANT 0x00000400 /* Giant Frame */
|
||||
#define TSV0_UNDERRUN 0x00000800 /* Buffer Underrun */
|
||||
#define TSV0_BYTES 0x0FFFF000 /* Total Bytes Transferred */
|
||||
#define TSV0_CTRL_FRAME 0x10000000 /* Control Frame */
|
||||
#define TSV0_PAUSE 0x20000000 /* Pause Frame */
|
||||
#define TSV0_BACK_PRESS 0x40000000 /* Backpressure Method Applied */
|
||||
#define TSV0_VLAN 0x80000000 /* VLAN Frame */
|
||||
|
||||
/* Transmit Status Vector 1 Register */
|
||||
#define TSV1_BYTE_CNT 0x0000FFFF /* Transmit Byte Count */
|
||||
#define TSV1_COLL_CNT 0x000F0000 /* Transmit Collision Count */
|
||||
|
||||
/* Receive Status Vector Register */
|
||||
#define RSV_BYTE_CNT 0x0000FFFF /* Receive Byte Count */
|
||||
#define RSV_PKT_IGNORED 0x00010000 /* Packet Previously Ignored */
|
||||
#define RSV_RXDV_SEEN 0x00020000 /* RXDV Event Previously Seen */
|
||||
#define RSV_CARR_SEEN 0x00040000 /* Carrier Event Previously Seen */
|
||||
#define RSV_REC_CODEV 0x00080000 /* Receive Code Violation */
|
||||
#define RSV_CRC_ERR 0x00100000 /* CRC Error */
|
||||
#define RSV_LEN_CHKERR 0x00200000 /* Length Check Error */
|
||||
#define RSV_LEN_OUTRNG 0x00400000 /* Length Out of Range */
|
||||
#define RSV_REC_OK 0x00800000 /* Frame Received OK */
|
||||
#define RSV_MCAST 0x01000000 /* Multicast Frame */
|
||||
#define RSV_BCAST 0x02000000 /* Broadcast Frame */
|
||||
#define RSV_DRIB_NIBB 0x04000000 /* Dribble Nibble */
|
||||
#define RSV_CTRL_FRAME 0x08000000 /* Control Frame */
|
||||
#define RSV_PAUSE 0x10000000 /* Pause Frame */
|
||||
#define RSV_UNSUPP_OPC 0x20000000 /* Unsupported Opcode */
|
||||
#define RSV_VLAN 0x40000000 /* VLAN Frame */
|
||||
|
||||
/* Flow Control Counter Register */
|
||||
#define FCC_MIRR_CNT 0x0000FFFF /* Mirror Counter */
|
||||
#define FCC_PAUSE_TIM 0xFFFF0000 /* Pause Timer */
|
||||
|
||||
/* Flow Control Status Register */
|
||||
#define FCS_MIRR_CNT 0x0000FFFF /* Mirror Counter Current */
|
||||
|
||||
/* Receive Filter Control Register */
|
||||
#define RFC_UCAST_EN 0x00000001 /* Accept Unicast Frames Enable */
|
||||
#define RFC_BCAST_EN 0x00000002 /* Accept Broadcast Frames Enable */
|
||||
#define RFC_MCAST_EN 0x00000004 /* Accept Multicast Frames Enable */
|
||||
#define RFC_UCAST_HASH_EN 0x00000008 /* Accept Unicast Hash Filter Frames */
|
||||
#define RFC_MCAST_HASH_EN 0x00000010 /* Accept Multicast Hash Filter Fram.*/
|
||||
#define RFC_PERFECT_EN 0x00000020 /* Accept Perfect Match Enable */
|
||||
#define RFC_MAGP_WOL_EN 0x00001000 /* Magic Packet Filter WoL Enable */
|
||||
#define RFC_PFILT_WOL_EN 0x00002000 /* Perfect Filter WoL Enable */
|
||||
|
||||
/* Receive Filter WoL Status/Clear Registers */
|
||||
#define WOL_UCAST 0x00000001 /* Unicast Frame caused WoL */
|
||||
#define WOL_BCAST 0x00000002 /* Broadcast Frame caused WoL */
|
||||
#define WOL_MCAST 0x00000004 /* Multicast Frame caused WoL */
|
||||
#define WOL_UCAST_HASH 0x00000008 /* Unicast Hash Filter Frame WoL */
|
||||
#define WOL_MCAST_HASH 0x00000010 /* Multicast Hash Filter Frame WoL */
|
||||
#define WOL_PERFECT 0x00000020 /* Perfect Filter WoL */
|
||||
#define WOL_RX_FILTER 0x00000080 /* RX Filter caused WoL */
|
||||
#define WOL_MAG_PACKET 0x00000100 /* Magic Packet Filter caused WoL */
|
||||
|
||||
/* Interrupt Status/Enable/Clear/Set Registers */
|
||||
#define INT_RX_OVERRUN 0x00000001 /* Overrun Error in RX Queue */
|
||||
#define INT_RX_ERR 0x00000002 /* Receive Error */
|
||||
#define INT_RX_FIN 0x00000004 /* RX Finished Process Descriptors */
|
||||
#define INT_RX_DONE 0x00000008 /* Receive Done */
|
||||
#define INT_TX_UNDERRUN 0x00000010 /* Transmit Underrun */
|
||||
#define INT_TX_ERR 0x00000020 /* Transmit Error */
|
||||
#define INT_TX_FIN 0x00000040 /* TX Finished Process Descriptors */
|
||||
#define INT_TX_DONE 0x00000080 /* Transmit Done */
|
||||
#define INT_SOFT_INT 0x00001000 /* Software Triggered Interrupt */
|
||||
#define INT_WAKEUP 0x00002000 /* Wakeup Event Interrupt */
|
||||
|
||||
/* Power Down Register */
|
||||
#define PD_POWER_DOWN 0x80000000 /* Power Down MAC */
|
||||
|
||||
/* RX Descriptor Control Word */
|
||||
#define RCTRL_SIZE 0x000007FF /* Buffer size mask */
|
||||
#define RCTRL_INT 0x80000000 /* Generate RxDone Interrupt */
|
||||
|
||||
/* RX Status Hash CRC Word */
|
||||
#define RHASH_SA 0x000001FF /* Hash CRC for Source Address */
|
||||
#define RHASH_DA 0x001FF000 /* Hash CRC for Destination Address */
|
||||
|
||||
/* RX Status Information Word */
|
||||
#define RINFO_SIZE 0x000007FF /* Data size in bytes */
|
||||
#define RINFO_CTRL_FRAME 0x00040000 /* Control Frame */
|
||||
#define RINFO_VLAN 0x00080000 /* VLAN Frame */
|
||||
#define RINFO_FAIL_FILT 0x00100000 /* RX Filter Failed */
|
||||
#define RINFO_MCAST 0x00200000 /* Multicast Frame */
|
||||
#define RINFO_BCAST 0x00400000 /* Broadcast Frame */
|
||||
#define RINFO_CRC_ERR 0x00800000 /* CRC Error in Frame */
|
||||
#define RINFO_SYM_ERR 0x01000000 /* Symbol Error from PHY */
|
||||
#define RINFO_LEN_ERR 0x02000000 /* Length Error */
|
||||
#define RINFO_RANGE_ERR 0x04000000 /* Range Error (exceeded max. size) */
|
||||
#define RINFO_ALIGN_ERR 0x08000000 /* Alignment Error */
|
||||
#define RINFO_OVERRUN 0x10000000 /* Receive overrun */
|
||||
#define RINFO_NO_DESCR 0x20000000 /* No new Descriptor available */
|
||||
#define RINFO_LAST_FLAG 0x40000000 /* Last Fragment in Frame */
|
||||
#define RINFO_ERR 0x80000000 /* Error Occured (OR of all errors) */
|
||||
|
||||
#define RINFO_ERR_MASK (RINFO_FAIL_FILT | RINFO_CRC_ERR | RINFO_SYM_ERR | \
|
||||
RINFO_LEN_ERR | RINFO_ALIGN_ERR | RINFO_OVERRUN)
|
||||
|
||||
/* TX Descriptor Control Word */
|
||||
#define TCTRL_SIZE 0x000007FF /* Size of data buffer in bytes */
|
||||
#define TCTRL_OVERRIDE 0x04000000 /* Override Default MAC Registers */
|
||||
#define TCTRL_HUGE 0x08000000 /* Enable Huge Frame */
|
||||
#define TCTRL_PAD 0x10000000 /* Pad short Frames to 64 bytes */
|
||||
#define TCTRL_CRC 0x20000000 /* Append a hardware CRC to Frame */
|
||||
#define TCTRL_LAST 0x40000000 /* Last Descriptor for TX Frame */
|
||||
#define TCTRL_INT 0x80000000 /* Generate TxDone Interrupt */
|
||||
|
||||
/* TX Status Information Word */
|
||||
#define TINFO_COL_CNT 0x01E00000 /* Collision Count */
|
||||
#define TINFO_DEFER 0x02000000 /* Packet Deferred (not an error) */
|
||||
#define TINFO_EXCESS_DEF 0x04000000 /* Excessive Deferral */
|
||||
#define TINFO_EXCESS_COL 0x08000000 /* Excessive Collision */
|
||||
#define TINFO_LATE_COL 0x10000000 /* Late Collision Occured */
|
||||
#define TINFO_UNDERRUN 0x20000000 /* Transmit Underrun */
|
||||
#define TINFO_NO_DESCR 0x40000000 /* No new Descriptor available */
|
||||
#define TINFO_ERR 0x80000000 /* Error Occured (OR of all errors) */
|
||||
|
||||
/* ENET Device Revision ID */
|
||||
#define OLD_EMAC_MODULE_ID 0x39022000 /* Rev. ID for first rev '-' */
|
||||
|
||||
/* DP83848C PHY Registers */
|
||||
#define PHY_REG_BMCR 0x00 /* Basic Mode Control Register */
|
||||
#define PHY_REG_BMSR 0x01 /* Basic Mode Status Register */
|
||||
#define PHY_REG_IDR1 0x02 /* PHY Identifier 1 */
|
||||
#define PHY_REG_IDR2 0x03 /* PHY Identifier 2 */
|
||||
#define PHY_REG_ANAR 0x04 /* Auto-Negotiation Advertisement */
|
||||
#define PHY_REG_ANLPAR 0x05 /* Auto-Neg. Link Partner Abitily */
|
||||
#define PHY_REG_ANER 0x06 /* Auto-Neg. Expansion Register */
|
||||
#define PHY_REG_ANNPTR 0x07 /* Auto-Neg. Next Page TX */
|
||||
|
||||
/* PHY Extended Registers */
|
||||
#define PHY_REG_STS 0x10 /* Status Register */
|
||||
#define PHY_REG_MICR 0x11 /* MII Interrupt Control Register */
|
||||
#define PHY_REG_MISR 0x12 /* MII Interrupt Status Register */
|
||||
#define PHY_REG_FCSCR 0x14 /* False Carrier Sense Counter */
|
||||
#define PHY_REG_RECR 0x15 /* Receive Error Counter */
|
||||
#define PHY_REG_PCSR 0x16 /* PCS Sublayer Config. and Status */
|
||||
#define PHY_REG_RBR 0x17 /* RMII and Bypass Register */
|
||||
#define PHY_REG_LEDCR 0x18 /* LED Direct Control Register */
|
||||
#define PHY_REG_PHYCR 0x19 /* PHY Control Register */
|
||||
#define PHY_REG_10BTSCR 0x1A /* 10Base-T Status/Control Register */
|
||||
#define PHY_REG_CDCTRL1 0x1B /* CD Test Control and BIST Extens. */
|
||||
#define PHY_REG_EDCR 0x1D /* Energy Detect Control Register */
|
||||
|
||||
#define PHY_FULLD_100M 0x2100 /* Full Duplex 100Mbit */
|
||||
#define PHY_HALFD_100M 0x2000 /* Half Duplex 100Mbit */
|
||||
#define PHY_FULLD_10M 0x0100 /* Full Duplex 10Mbit */
|
||||
#define PHY_HALFD_10M 0x0000 /* Half Duplex 10MBit */
|
||||
#define PHY_AUTO_NEG 0x3000 /* Select Auto Negotiation */
|
||||
|
||||
#define DP83848C_DEF_ADR 0x0F00 /* Default PHY device address */
|
||||
#define DP83848C_ID 0x20005C90 /* PHY Identifier */
|
||||
|
||||
int lpc_emac_hw_init(void);
|
||||
|
||||
#endif
|
||||
161
bsp/lpc43xx/drivers/drv_led.c
Normal file
161
bsp/lpc43xx/drivers/drv_led.c
Normal file
@@ -0,0 +1,161 @@
|
||||
#include <rtthread.h>
|
||||
#include "board.h"
|
||||
#include "drv_led.h"
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* LED1 <==> GPIO4[12]
|
||||
* LED2 <==> GPIO4[13]
|
||||
*
|
||||
**/
|
||||
|
||||
#define LED_NUM 8
|
||||
|
||||
#define LED1_PIN 12
|
||||
#define LED1_PORT 4
|
||||
|
||||
#define LED2_PIN 13
|
||||
#define LED2_PORT 4
|
||||
|
||||
struct led_ctrl
|
||||
{
|
||||
uint8_t num;
|
||||
uint8_t port;
|
||||
};
|
||||
|
||||
struct lpc_led
|
||||
{
|
||||
/* inherit from rt_device */
|
||||
struct rt_device parent;
|
||||
|
||||
struct led_ctrl ctrl[LED_NUM];
|
||||
};
|
||||
|
||||
static struct lpc_led led;
|
||||
|
||||
static rt_err_t rt_led_init(rt_device_t dev)
|
||||
{
|
||||
/* Enable clock and init GPIO outputs */
|
||||
LPC_CCU1->CLK_M4_GPIO_CFG = CCU_CLK_CFG_AUTO | CCU_CLK_CFG_RUN;
|
||||
while (!(LPC_CCU1->CLK_M4_GPIO_STAT & CCU_CLK_STAT_RUN));
|
||||
|
||||
/* set GPIO4[12] GPIO4[13] as GPIO. */
|
||||
LPC_SCU->SFSP9_0 = 0; /* GPIO4[12] */
|
||||
LPC_SCU->SFSP9_1 = 0; /* GPIO4[13] */
|
||||
/* set GPIO4[12] GPIO4[13] output. */
|
||||
LPC_GPIO_PORT->DIR[LED1_PORT] |= 0x01 << LED1_PIN;
|
||||
LPC_GPIO_PORT->DIR[LED2_PORT] |= 0x01 << LED2_PIN;
|
||||
/* turn off all the led */
|
||||
LPC_GPIO_PORT->CLR[LED1_PORT] |= 0x01 << LED1_PIN;
|
||||
LPC_GPIO_PORT->CLR[LED2_PORT] |= 0x01 << LED2_PIN;
|
||||
|
||||
led.ctrl[0].num = LED1_PIN;
|
||||
led.ctrl[0].port = LED1_PORT;
|
||||
led.ctrl[1].num = LED2_PIN;
|
||||
led.ctrl[1].port = LED2_PORT;
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
static rt_err_t rt_led_open(rt_device_t dev, rt_uint16_t oflag)
|
||||
{
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
static rt_err_t rt_led_close(rt_device_t dev)
|
||||
{
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
static rt_size_t rt_led_read(rt_device_t dev, rt_off_t pos, void *buffer,
|
||||
rt_size_t size)
|
||||
{
|
||||
rt_ubase_t index = 0;
|
||||
rt_ubase_t nr = size;
|
||||
rt_uint8_t *value = buffer;
|
||||
|
||||
RT_ASSERT(dev == &led.parent);
|
||||
RT_ASSERT((pos + size) <= LED_NUM);
|
||||
|
||||
for (index = 0; index < nr; index++)
|
||||
{
|
||||
if ((LPC_GPIO_PORT->PIN[led.ctrl[pos + index].port] & (1 << led.ctrl[pos + index].num)) != 0)
|
||||
{
|
||||
*value = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
*value = 1;
|
||||
}
|
||||
value++;
|
||||
}
|
||||
return index;
|
||||
}
|
||||
|
||||
static rt_size_t rt_led_write(rt_device_t dev, rt_off_t pos,
|
||||
const void *buffer, rt_size_t size)
|
||||
{
|
||||
rt_ubase_t index = 0;
|
||||
rt_ubase_t nw = size;
|
||||
const rt_uint8_t *value = buffer;
|
||||
|
||||
RT_ASSERT(dev == &led.parent);
|
||||
RT_ASSERT((pos + size) <= LED_NUM);
|
||||
|
||||
for (index = 0; index < nw; index++)
|
||||
{
|
||||
if (*value++)
|
||||
{
|
||||
LPC_GPIO_PORT->CLR[led.ctrl[pos + index].port] = (1 << led.ctrl[pos + index].num);
|
||||
}
|
||||
else
|
||||
{
|
||||
LPC_GPIO_PORT->SET[led.ctrl[pos + index].port] = (1 << led.ctrl[pos + index].num);
|
||||
}
|
||||
}
|
||||
return index;
|
||||
}
|
||||
|
||||
static rt_err_t rt_led_control(rt_device_t dev, rt_uint8_t cmd, void *args)
|
||||
{
|
||||
RT_ASSERT(dev == &led.parent);
|
||||
|
||||
if (cmd == LED_DEVICE_CTRL)
|
||||
{
|
||||
rt_uint32_t *led_num = args;
|
||||
*led_num = LED_NUM;
|
||||
}
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
int rt_led_hw_init(void)
|
||||
{
|
||||
led.parent.type = RT_Device_Class_Char;
|
||||
led.parent.rx_indicate = RT_NULL;
|
||||
led.parent.tx_complete = RT_NULL;
|
||||
led.parent.init = rt_led_init;
|
||||
led.parent.open = rt_led_open;
|
||||
led.parent.close = rt_led_close;
|
||||
led.parent.read = rt_led_read;
|
||||
led.parent.write = rt_led_write;
|
||||
led.parent.control = rt_led_control;
|
||||
led.parent.user_data = RT_NULL;
|
||||
|
||||
/* register a character device */
|
||||
rt_device_register(&led.parent, "led", RT_DEVICE_FLAG_RDWR);
|
||||
/* init led device */
|
||||
rt_led_init(&led.parent);
|
||||
return 0;
|
||||
}
|
||||
INIT_DEVICE_EXPORT(rt_led_hw_init);
|
||||
|
||||
#ifdef RT_USING_FINSH
|
||||
#include <finsh.h>
|
||||
void led_test(rt_uint32_t led_num, rt_uint32_t value)
|
||||
{
|
||||
rt_uint8_t led_value = value;
|
||||
rt_led_write(&led.parent, led_num, &led_value, 1);
|
||||
}
|
||||
FINSH_FUNCTION_EXPORT(led_test, e.g: led_test(0, 100).)
|
||||
#endif
|
||||
12
bsp/lpc43xx/drivers/drv_led.h
Normal file
12
bsp/lpc43xx/drivers/drv_led.h
Normal file
@@ -0,0 +1,12 @@
|
||||
#ifndef __DRV_LED_H
|
||||
#define __DRV_LED_H
|
||||
|
||||
/* Clock Control Unit register bits */
|
||||
#define CCU_CLK_CFG_RUN (1 << 0)
|
||||
#define CCU_CLK_CFG_AUTO (1 << 1)
|
||||
#define CCU_CLK_STAT_RUN (1 << 0)
|
||||
|
||||
#define LED_DEVICE_CTRL 0x81 /*LED control command*/
|
||||
|
||||
int rt_led_hw_init(void);
|
||||
#endif
|
||||
315
bsp/lpc43xx/drivers/drv_uart.c
Normal file
315
bsp/lpc43xx/drivers/drv_uart.c
Normal file
@@ -0,0 +1,315 @@
|
||||
/*
|
||||
* File : drv_uart.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2009-2013 RT-Thread Develop Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2013-05-18 Bernard The first version for LPC40xx
|
||||
*/
|
||||
|
||||
#include <rthw.h>
|
||||
#include <rtthread.h>
|
||||
#include <rtdevice.h>
|
||||
#include "board.h"
|
||||
#include "drv_uart.h"
|
||||
|
||||
struct lpc_uart
|
||||
{
|
||||
LPC_USARTn_Type *USART;
|
||||
IRQn_Type USART_IRQn;
|
||||
};
|
||||
|
||||
static rt_err_t lpc_configure(struct rt_serial_device *serial, struct serial_configure *cfg)
|
||||
{
|
||||
// struct lpc_uart *uart;
|
||||
|
||||
|
||||
RT_ASSERT(serial != RT_NULL);
|
||||
// uart = (struct lpc_uart *)serial->parent.user_data;
|
||||
|
||||
|
||||
|
||||
// Initialize FIFO for UART0 peripheral
|
||||
// UART_FIFOConfig(uart->USART, &UARTFIFOConfigStruct);
|
||||
|
||||
// UART_TxCmd(uart->USART, ENABLE);
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
static rt_err_t lpc_control(struct rt_serial_device *serial, int cmd, void *arg)
|
||||
{
|
||||
struct lpc_uart *uart;
|
||||
|
||||
RT_ASSERT(serial != RT_NULL);
|
||||
uart = (struct lpc_uart *)serial->parent.user_data;
|
||||
|
||||
switch (cmd)
|
||||
{
|
||||
case RT_DEVICE_CTRL_CLR_INT:
|
||||
/* disable rx irq */
|
||||
uart->USART->IER &= ~UART_IER_RBRINT_EN;
|
||||
break;
|
||||
case RT_DEVICE_CTRL_SET_INT:
|
||||
/* enable rx irq */
|
||||
uart->USART->IER |= UART_IER_RBRINT_EN;
|
||||
break;
|
||||
}
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
static int lpc_putc(struct rt_serial_device *serial, char c)
|
||||
{
|
||||
struct lpc_uart *uart;
|
||||
|
||||
uart = (struct lpc_uart *)serial->parent.user_data;
|
||||
while (!(uart->USART->LSR & 0x20));
|
||||
uart->USART->THR = c;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lpc_getc(struct rt_serial_device *serial)
|
||||
{
|
||||
struct lpc_uart *uart;
|
||||
|
||||
uart = (struct lpc_uart *)serial->parent.user_data;
|
||||
|
||||
if (uart->USART->LSR & 0x01)
|
||||
{
|
||||
return (uart->USART->RBR);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
static const struct rt_uart_ops lpc_uart_ops =
|
||||
{
|
||||
lpc_configure,
|
||||
lpc_control,
|
||||
lpc_putc,
|
||||
lpc_getc,
|
||||
};
|
||||
|
||||
#if defined(RT_USING_UART0)
|
||||
/* UART0 device driver structure */
|
||||
struct serial_ringbuffer uart0_int_rx;
|
||||
struct lpc_uart uart0 =
|
||||
{
|
||||
LPC_USART0,
|
||||
USART0_IRQn,
|
||||
};
|
||||
struct rt_serial_device serial0;
|
||||
|
||||
void UART0_IRQHandler(void)
|
||||
{
|
||||
struct lpc_uart *uart;
|
||||
volatile uint32_t intsrc, temp;
|
||||
|
||||
uart = &uart0;
|
||||
|
||||
/* enter interrupt */
|
||||
rt_interrupt_enter();
|
||||
|
||||
/* Determine the interrupt source */
|
||||
intsrc = uart->USART->IIR & UART_IIR_INTID_MASK;
|
||||
|
||||
switch (intsrc)
|
||||
{
|
||||
|
||||
case UART_IIR_INTID_RLS: /* Receive Line Status interrupt*/
|
||||
/* read the line status */
|
||||
intsrc = uart->USART->LSR;
|
||||
/* Receive an error data */
|
||||
if (intsrc & UART_LSR_PE)
|
||||
{
|
||||
temp = LPC_USART0->RBR;
|
||||
}
|
||||
break;
|
||||
|
||||
case UART_IIR_INTID_RDA: /* Receive data */
|
||||
case UART_IIR_INTID_CTI: /* Receive data timeout */
|
||||
/* read the data to buffer */
|
||||
while (uart->USART->LSR & UART_LSR_RDR)
|
||||
{
|
||||
rt_hw_serial_isr(&serial0);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
/* leave interrupt */
|
||||
rt_interrupt_leave();
|
||||
}
|
||||
#endif
|
||||
#if defined(RT_USING_UART2)
|
||||
/* UART2 device driver structure */
|
||||
struct serial_ringbuffer uart2_int_rx;
|
||||
struct lpc_uart uart2 =
|
||||
{
|
||||
LPC_USART2,
|
||||
USART2_IRQn,
|
||||
};
|
||||
struct rt_serial_device serial2;
|
||||
|
||||
void UART2_IRQHandler(void)
|
||||
{
|
||||
struct lpc_uart *uart;
|
||||
uint32_t intsrc, temp;
|
||||
|
||||
uart = &uart2;
|
||||
|
||||
/* enter interrupt */
|
||||
rt_interrupt_enter();
|
||||
|
||||
/* Determine the interrupt source */
|
||||
intsrc = uart->USART->IIR & UART_IIR_INTID_MASK;
|
||||
|
||||
switch (intsrc)
|
||||
{
|
||||
|
||||
case UART_IIR_INTID_RLS: /* Receive Line Status interrupt*/
|
||||
/* read the line status */
|
||||
intsrc = uart->USART->LSR;
|
||||
/* Receive an error data */
|
||||
if (intsrc & UART_LSR_PE)
|
||||
{
|
||||
temp = LPC_USART0->RBR;
|
||||
}
|
||||
break;
|
||||
|
||||
case UART_IIR_INTID_RDA: /* Receive data */
|
||||
case UART_IIR_INTID_CTI: /* Receive data timeout */
|
||||
/* read the data to buffer */
|
||||
while (uart->USART->LSR & UART_LSR_RDR)
|
||||
{
|
||||
rt_hw_serial_isr(&serial0);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
/* leave interrupt */
|
||||
rt_interrupt_leave();
|
||||
}
|
||||
#endif
|
||||
void rt_hw_uart_init(void)
|
||||
{
|
||||
struct lpc_uart *uart;
|
||||
struct serial_configure config;
|
||||
|
||||
#ifdef RT_USING_UART0
|
||||
uart = &uart0;
|
||||
config.baud_rate = BAUD_RATE_115200;
|
||||
config.bit_order = BIT_ORDER_LSB;
|
||||
config.data_bits = DATA_BITS_8;
|
||||
config.parity = PARITY_NONE;
|
||||
config.stop_bits = STOP_BITS_1;
|
||||
config.invert = NRZ_NORMAL;
|
||||
|
||||
serial0.ops = &lpc_uart_ops;
|
||||
serial0.int_rx = &uart0_int_rx;
|
||||
serial0.config = config;
|
||||
|
||||
/* Enable GPIO register interface clock */
|
||||
LPC_CCU1->CLK_M4_GPIO_CFG |= 0x01;
|
||||
while (!(LPC_CCU1->CLK_M4_GPIO_STAT & 0x01));
|
||||
|
||||
/* Enable USART1 peripheral clock */
|
||||
LPC_CCU2->CLK_APB0_USART0_CFG |= 0x01;
|
||||
while (!(LPC_CCU2->CLK_APB0_USART0_STAT & 0x01));
|
||||
|
||||
/* Enable USART1 register interface clock */
|
||||
LPC_CCU1->CLK_M4_USART0_CFG |= 0x01;
|
||||
while (!(LPC_CCU1->CLK_M4_USART0_STAT & 0x01));
|
||||
|
||||
/* Init GPIO pins */
|
||||
LPC_SCU->SFSP2_0 = (1 << 6) | /* Input buffer enabled */
|
||||
(1 << 4) | /* Pull-up disabled */
|
||||
(1 << 0) ; /* Pin P2_0 used as U0_TXD */
|
||||
|
||||
LPC_SCU->SFSP2_1 = (1 << 6) | /* Input buffer enabled */
|
||||
(1 << 4) | /* Pull-up disabled */
|
||||
(1 << 0) ; /* Pin P2_1 used as U0_RXD */
|
||||
|
||||
/* Init USART0 */
|
||||
LPC_USART0->LCR = 0x83; /* 8 bits, no Parity, 1 Stop bit */
|
||||
LPC_USART0->DLL = 0x06; /* 115200 Baudrate @ 12 MHz IRC */
|
||||
LPC_USART0->DLM = 0x00;
|
||||
LPC_USART0->FDR = 0xC1;
|
||||
LPC_USART0->LCR = 0x03; /* DLAB = 0 */
|
||||
/* enable the receive interrupt */
|
||||
LPC_USART0->IER |= UART_IER_RBRINT_EN;
|
||||
/* preemption = 1, sub-priority = 1 */
|
||||
NVIC_SetPriority(uart->USART_IRQn, ((0x01 << 3) | 0x01));
|
||||
|
||||
/* Enable Interrupt for UART channel */
|
||||
NVIC_EnableIRQ(uart->USART_IRQn);
|
||||
|
||||
/* register UART1 device */
|
||||
rt_hw_serial_register(&serial0, "uart0",
|
||||
RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX | RT_DEVICE_FLAG_STREAM,
|
||||
uart);
|
||||
#endif
|
||||
#ifdef RT_USING_UART2
|
||||
uart = &uart2;
|
||||
config.baud_rate = BAUD_RATE_115200;
|
||||
config.bit_order = BIT_ORDER_LSB;
|
||||
config.data_bits = DATA_BITS_8;
|
||||
config.parity = PARITY_NONE;
|
||||
config.stop_bits = STOP_BITS_1;
|
||||
config.invert = NRZ_NORMAL;
|
||||
|
||||
serial2.ops = &lpc_uart_ops;
|
||||
serial2.int_rx = &uart2_int_rx;
|
||||
serial2.config = config;
|
||||
|
||||
/* Enable GPIO register interface clock */
|
||||
LPC_CCU1->CLK_M4_GPIO_CFG |= 0x01;
|
||||
while (!(LPC_CCU1->CLK_M4_GPIO_STAT & 0x01));
|
||||
|
||||
/* Enable USART1 peripheral clock */
|
||||
LPC_CCU2->CLK_APB0_USART0_CFG |= 0x01;
|
||||
while (!(LPC_CCU2->CLK_APB2_USART2_STAT & 0x01));
|
||||
|
||||
/* Enable USART2 register interface clock */
|
||||
LPC_CCU1->CLK_M4_USART0_CFG |= 0x01;
|
||||
while (!(LPC_CCU1->CLK_M4_USART2_STAT & 0x01));
|
||||
|
||||
/* Init GPIO pins */
|
||||
LPC_SCU->SFSP1_15 = (1 << 6) | /* Input buffer enabled */
|
||||
(1 << 4) | /* Pull-up disabled */
|
||||
(1 << 0) ; /* Pin P1_15 used as U2_TXD */
|
||||
|
||||
LPC_SCU->SFSP1_16 = (1 << 6) | /* Input buffer enabled */
|
||||
(1 << 4) | /* Pull-up disabled */
|
||||
(1 << 0) ; /* Pin P1_16 used as U2_RXD */
|
||||
|
||||
/* Init USART2 */
|
||||
LPC_USART2->LCR = 0x83; /* 8 bits, no Parity, 1 Stop bit */
|
||||
LPC_USART2->DLL = 0x06; /* 115200 Baudrate @ 12 MHz IRC */
|
||||
LPC_USART2->DLM = 0x00;
|
||||
LPC_USART2->FDR = 0xC1;
|
||||
LPC_USART2->LCR = 0x03; /* DLAB = 0 */
|
||||
/* enable the receive interrupt */
|
||||
LPC_USART2->IER |= UART_IER_RBRINT_EN;
|
||||
/* preemption = 1, sub-priority = 1 */
|
||||
NVIC_SetPriority(uart->USART_IRQn, ((0x01 << 3) | 0x01));
|
||||
|
||||
/* Enable Interrupt for UART channel */
|
||||
NVIC_EnableIRQ(uart->USART_IRQn);
|
||||
|
||||
/* register UART1 device */
|
||||
rt_hw_serial_register(&serial2, "uart2",
|
||||
RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX | RT_DEVICE_FLAG_STREAM,
|
||||
uart);
|
||||
#endif
|
||||
}
|
||||
228
bsp/lpc43xx/drivers/drv_uart.h
Normal file
228
bsp/lpc43xx/drivers/drv_uart.h
Normal file
@@ -0,0 +1,228 @@
|
||||
#ifndef __UART_H__
|
||||
#define __UART_H__
|
||||
|
||||
|
||||
/* Accepted Error baud rate value (in percent unit) */
|
||||
#define UART_ACCEPTED_BAUDRATE_ERROR (3) /*!< Acceptable UART baudrate error */
|
||||
|
||||
|
||||
/* --------------------- BIT DEFINITIONS -------------------------------------- */
|
||||
/*********************************************************************//**
|
||||
* Macro defines for Macro defines for UARTn Receiver Buffer Register
|
||||
**********************************************************************/
|
||||
#define UART_RBR_MASKBIT ((uint8_t)0xFF) /*!< UART Received Buffer mask bit (8 bits) */
|
||||
|
||||
/*********************************************************************//**
|
||||
* Macro defines for Macro defines for UARTn Transmit Holding Register
|
||||
**********************************************************************/
|
||||
#define UART_THR_MASKBIT ((uint8_t)0xFF) /*!< UART Transmit Holding mask bit (8 bits) */
|
||||
|
||||
/*********************************************************************//**
|
||||
* Macro defines for Macro defines for UARTn Divisor Latch LSB register
|
||||
**********************************************************************/
|
||||
#define UART_LOAD_DLL(div) ((div) & 0xFF) /**< Macro for loading least significant halfs of divisors */
|
||||
#define UART_DLL_MASKBIT ((uint8_t)0xFF) /*!< Divisor latch LSB bit mask */
|
||||
|
||||
/*********************************************************************//**
|
||||
* Macro defines for Macro defines for UARTn Divisor Latch MSB register
|
||||
**********************************************************************/
|
||||
#define UART_DLM_MASKBIT ((uint8_t)0xFF) /*!< Divisor latch MSB bit mask */
|
||||
#define UART_LOAD_DLM(div) (((div) >> 8) & 0xFF) /**< Macro for loading most significant halfs of divisors */
|
||||
|
||||
/*********************************************************************//**
|
||||
* Macro defines for Macro defines for UART interrupt enable register
|
||||
**********************************************************************/
|
||||
#define UART_IER_RBRINT_EN ((uint32_t)(1<<0)) /*!< RBR Interrupt enable*/
|
||||
#define UART_IER_THREINT_EN ((uint32_t)(1<<1)) /*!< THR Interrupt enable*/
|
||||
#define UART_IER_RLSINT_EN ((uint32_t)(1<<2)) /*!< RX line status interrupt enable*/
|
||||
#define UART1_IER_MSINT_EN ((uint32_t)(1<<3)) /*!< Modem status interrupt enable */
|
||||
#define UART1_IER_CTSINT_EN ((uint32_t)(1<<7)) /*!< CTS1 signal transition interrupt enable */
|
||||
#define UART_IER_ABEOINT_EN ((uint32_t)(1<<8)) /*!< Enables the end of auto-baud interrupt */
|
||||
#define UART_IER_ABTOINT_EN ((uint32_t)(1<<9)) /*!< Enables the auto-baud time-out interrupt */
|
||||
#define UART_IER_BITMASK ((uint32_t)(0x307)) /*!< UART interrupt enable register bit mask */
|
||||
#define UART1_IER_BITMASK ((uint32_t)(0x38F)) /*!< UART1 interrupt enable register bit mask */
|
||||
|
||||
/*********************************************************************//**
|
||||
* Macro defines for Macro defines for UART interrupt identification register
|
||||
**********************************************************************/
|
||||
#define UART_IIR_INTSTAT_PEND ((uint32_t)(1<<0)) /*!<Interrupt Status - Active low */
|
||||
#define UART_IIR_INTID_RLS ((uint32_t)(3<<1)) /*!<Interrupt identification: Receive line status*/
|
||||
#define UART_IIR_INTID_RDA ((uint32_t)(2<<1)) /*!<Interrupt identification: Receive data available*/
|
||||
#define UART_IIR_INTID_CTI ((uint32_t)(6<<1)) /*!<Interrupt identification: Character time-out indicator*/
|
||||
#define UART_IIR_INTID_THRE ((uint32_t)(1<<1)) /*!<Interrupt identification: THRE interrupt*/
|
||||
#define UART1_IIR_INTID_MODEM ((uint32_t)(0<<1)) /*!<Interrupt identification: Modem interrupt*/
|
||||
#define UART_IIR_INTID_MASK ((uint32_t)(7<<1)) /*!<Interrupt identification: Interrupt ID mask */
|
||||
#define UART_IIR_FIFO_EN ((uint32_t)(3<<6)) /*!<These bits are equivalent to UnFCR[0] */
|
||||
#define UART_IIR_ABEO_INT ((uint32_t)(1<<8)) /*!< End of auto-baud interrupt */
|
||||
#define UART_IIR_ABTO_INT ((uint32_t)(1<<9)) /*!< Auto-baud time-out interrupt */
|
||||
#define UART_IIR_BITMASK ((uint32_t)(0x3CF)) /*!< UART interrupt identification register bit mask */
|
||||
|
||||
/*********************************************************************//**
|
||||
* Macro defines for Macro defines for UART FIFO control register
|
||||
**********************************************************************/
|
||||
#define UART_FCR_FIFO_EN ((uint8_t)(1<<0)) /*!< UART FIFO enable */
|
||||
#define UART_FCR_RX_RS ((uint8_t)(1<<1)) /*!< UART FIFO RX reset */
|
||||
#define UART_FCR_TX_RS ((uint8_t)(1<<2)) /*!< UART FIFO TX reset */
|
||||
#define UART_FCR_DMAMODE_SEL ((uint8_t)(1<<3)) /*!< UART DMA mode selection */
|
||||
#define UART_FCR_TRG_LEV0 ((uint8_t)(0)) /*!< UART FIFO trigger level 0: 1 character */
|
||||
#define UART_FCR_TRG_LEV1 ((uint8_t)(1<<6)) /*!< UART FIFO trigger level 1: 4 character */
|
||||
#define UART_FCR_TRG_LEV2 ((uint8_t)(2<<6)) /*!< UART FIFO trigger level 2: 8 character */
|
||||
#define UART_FCR_TRG_LEV3 ((uint8_t)(3<<6)) /*!< UART FIFO trigger level 3: 14 character */
|
||||
#define UART_FCR_BITMASK ((uint8_t)(0xCF)) /*!< UART FIFO control bit mask */
|
||||
#define UART_TX_FIFO_SIZE (16)
|
||||
|
||||
/*********************************************************************//**
|
||||
* Macro defines for Macro defines for UART line control register
|
||||
**********************************************************************/
|
||||
#define UART_LCR_WLEN5 ((uint8_t)(0)) /*!< UART 5 bit data mode */
|
||||
#define UART_LCR_WLEN6 ((uint8_t)(1<<0)) /*!< UART 6 bit data mode */
|
||||
#define UART_LCR_WLEN7 ((uint8_t)(2<<0)) /*!< UART 7 bit data mode */
|
||||
#define UART_LCR_WLEN8 ((uint8_t)(3<<0)) /*!< UART 8 bit data mode */
|
||||
#define UART_LCR_STOPBIT_SEL ((uint8_t)(1<<2)) /*!< UART Two Stop Bits Select */
|
||||
#define UART_LCR_PARITY_EN ((uint8_t)(1<<3)) /*!< UART Parity Enable */
|
||||
#define UART_LCR_PARITY_ODD ((uint8_t)(0)) /*!< UART Odd Parity Select */
|
||||
#define UART_LCR_PARITY_EVEN ((uint8_t)(1<<4)) /*!< UART Even Parity Select */
|
||||
#define UART_LCR_PARITY_F_1 ((uint8_t)(2<<4)) /*!< UART force 1 stick parity */
|
||||
#define UART_LCR_PARITY_F_0 ((uint8_t)(3<<4)) /*!< UART force 0 stick parity */
|
||||
#define UART_LCR_BREAK_EN ((uint8_t)(1<<6)) /*!< UART Transmission Break enable */
|
||||
#define UART_LCR_DLAB_EN ((uint8_t)(1<<7)) /*!< UART Divisor Latches Access bit enable */
|
||||
#define UART_LCR_BITMASK ((uint8_t)(0xFF)) /*!< UART line control bit mask */
|
||||
|
||||
/*********************************************************************//**
|
||||
* Macro defines for Macro defines for UART1 Modem Control Register
|
||||
**********************************************************************/
|
||||
#define UART1_MCR_DTR_CTRL ((uint8_t)(1<<0)) /*!< Source for modem output pin DTR */
|
||||
#define UART1_MCR_RTS_CTRL ((uint8_t)(1<<1)) /*!< Source for modem output pin RTS */
|
||||
#define UART1_MCR_LOOPB_EN ((uint8_t)(1<<4)) /*!< Loop back mode select */
|
||||
#define UART1_MCR_AUTO_RTS_EN ((uint8_t)(1<<6)) /*!< Enable Auto RTS flow-control */
|
||||
#define UART1_MCR_AUTO_CTS_EN ((uint8_t)(1<<7)) /*!< Enable Auto CTS flow-control */
|
||||
#define UART1_MCR_BITMASK ((uint8_t)(0x0F3)) /*!< UART1 bit mask value */
|
||||
|
||||
/*********************************************************************//**
|
||||
* Macro defines for Macro defines for UART line status register
|
||||
**********************************************************************/
|
||||
#define UART_LSR_RDR ((uint8_t)(1<<0)) /*!<Line status register: Receive data ready*/
|
||||
#define UART_LSR_OE ((uint8_t)(1<<1)) /*!<Line status register: Overrun error*/
|
||||
#define UART_LSR_PE ((uint8_t)(1<<2)) /*!<Line status register: Parity error*/
|
||||
#define UART_LSR_FE ((uint8_t)(1<<3)) /*!<Line status register: Framing error*/
|
||||
#define UART_LSR_BI ((uint8_t)(1<<4)) /*!<Line status register: Break interrupt*/
|
||||
#define UART_LSR_THRE ((uint8_t)(1<<5)) /*!<Line status register: Transmit holding register empty*/
|
||||
#define UART_LSR_TEMT ((uint8_t)(1<<6)) /*!<Line status register: Transmitter empty*/
|
||||
#define UART_LSR_RXFE ((uint8_t)(1<<7)) /*!<Error in RX FIFO*/
|
||||
#define UART_LSR_BITMASK ((uint8_t)(0xFF)) /*!<UART Line status bit mask */
|
||||
|
||||
/*********************************************************************//**
|
||||
* Macro defines for Macro defines for UART Modem (UART1 only) status register
|
||||
**********************************************************************/
|
||||
#define UART1_MSR_DELTA_CTS ((uint8_t)(1<<0)) /*!< Set upon state change of input CTS */
|
||||
#define UART1_MSR_DELTA_DSR ((uint8_t)(1<<1)) /*!< Set upon state change of input DSR */
|
||||
#define UART1_MSR_LO2HI_RI ((uint8_t)(1<<2)) /*!< Set upon low to high transition of input RI */
|
||||
#define UART1_MSR_DELTA_DCD ((uint8_t)(1<<3)) /*!< Set upon state change of input DCD */
|
||||
#define UART1_MSR_CTS ((uint8_t)(1<<4)) /*!< Clear To Send State */
|
||||
#define UART1_MSR_DSR ((uint8_t)(1<<5)) /*!< Data Set Ready State */
|
||||
#define UART1_MSR_RI ((uint8_t)(1<<6)) /*!< Ring Indicator State */
|
||||
#define UART1_MSR_DCD ((uint8_t)(1<<7)) /*!< Data Carrier Detect State */
|
||||
#define UART1_MSR_BITMASK ((uint8_t)(0xFF)) /*!< MSR register bit-mask value */
|
||||
|
||||
/*********************************************************************//**
|
||||
* Macro defines for Macro defines for UART Scratch Pad Register
|
||||
**********************************************************************/
|
||||
#define UART_SCR_BIMASK ((uint8_t)(0xFF)) /*!< UART Scratch Pad bit mask */
|
||||
|
||||
/*********************************************************************//**
|
||||
* Macro defines for Macro defines for UART Auto baudrate control register
|
||||
**********************************************************************/
|
||||
#define UART_ACR_START ((uint32_t)(1<<0)) /**< UART Auto-baud start */
|
||||
#define UART_ACR_MODE ((uint32_t)(1<<1)) /**< UART Auto baudrate Mode 1 */
|
||||
#define UART_ACR_AUTO_RESTART ((uint32_t)(1<<2)) /**< UART Auto baudrate restart */
|
||||
#define UART_ACR_ABEOINT_CLR ((uint32_t)(1<<8)) /**< UART End of auto-baud interrupt clear */
|
||||
#define UART_ACR_ABTOINT_CLR ((uint32_t)(1<<9)) /**< UART Auto-baud time-out interrupt clear */
|
||||
#define UART_ACR_BITMASK ((uint32_t)(0x307)) /**< UART Auto Baudrate register bit mask */
|
||||
|
||||
/*********************************************************************//**
|
||||
* Macro defines for Macro defines for UART IrDA control register
|
||||
**********************************************************************/
|
||||
#define UART_ICR_IRDAEN ((uint32_t)(1<<0)) /**< IrDA mode enable */
|
||||
#define UART_ICR_IRDAINV ((uint32_t)(1<<1)) /**< IrDA serial input inverted */
|
||||
#define UART_ICR_FIXPULSE_EN ((uint32_t)(1<<2)) /**< IrDA fixed pulse width mode */
|
||||
#define UART_ICR_PULSEDIV(n) ((uint32_t)((n&0x07)<<3)) /**< PulseDiv - Configures the pulse when FixPulseEn = 1 */
|
||||
#define UART_ICR_BITMASK ((uint32_t)(0x3F)) /*!< UART IRDA bit mask */
|
||||
|
||||
/*********************************************************************//**
|
||||
* Macro defines for Macro defines for UART half duplex register
|
||||
**********************************************************************/
|
||||
#define UART_HDEN_HDEN ((uint32_t)(1<<0)) /**< enable half-duplex mode*/
|
||||
|
||||
/*********************************************************************//**
|
||||
* Macro defines for Macro defines for UART smart card interface control register
|
||||
**********************************************************************/
|
||||
#define UART_SCICTRL_SCIEN ((uint32_t)(1<<0)) /**< enable asynchronous half-duplex smart card interface*/
|
||||
#define UART_SCICTRL_NACKDIS ((uint32_t)(1<<1)) /**< NACK response is inhibited*/
|
||||
#define UART_SCICTRL_PROTSEL_T1 ((uint32_t)(1<<2)) /**< ISO7816-3 protocol T1 is selected*/
|
||||
#define UART_SCICTRL_TXRETRY(n) ((uint32_t)((n&0x07)<<5)) /**< number of retransmission*/
|
||||
#define UART_SCICTRL_GUARDTIME(n) ((uint32_t)((n&0xFF)<<8)) /**< Extra guard time*/
|
||||
|
||||
/*********************************************************************//**
|
||||
* Macro defines for Macro defines for UART synchronous control register
|
||||
**********************************************************************/
|
||||
#define UART_SYNCCTRL_SYNC ((uint32_t)(1<<0)) /**< enable synchronous mode*/
|
||||
#define UART_SYNCCTRL_CSRC_MASTER ((uint32_t)(1<<1)) /**< synchronous master mode*/
|
||||
#define UART_SYNCCTRL_FES ((uint32_t)(1<<2)) /**< sample on falling edge*/
|
||||
#define UART_SYNCCTRL_TSBYPASS ((uint32_t)(1<<3)) /**< to be defined*/
|
||||
#define UART_SYNCCTRL_CSCEN ((uint32_t)(1<<4)) /**< continuous running clock enable (master mode only)*/
|
||||
#define UART_SYNCCTRL_STARTSTOPDISABLE ((uint32_t)(1<<5)) /**< do not send start/stop bit*/
|
||||
#define UART_SYNCCTRL_CCCLR ((uint32_t)(1<<6)) /**< stop continuous clock*/
|
||||
|
||||
/*********************************************************************//**
|
||||
* Macro defines for Macro defines for UART Fractional divider register
|
||||
**********************************************************************/
|
||||
#define UART_FDR_DIVADDVAL(n) ((uint32_t)(n&0x0F)) /**< Baud-rate generation pre-scaler divisor */
|
||||
#define UART_FDR_MULVAL(n) ((uint32_t)((n<<4)&0xF0)) /**< Baud-rate pre-scaler multiplier value */
|
||||
#define UART_FDR_BITMASK ((uint32_t)(0xFF)) /**< UART Fractional Divider register bit mask */
|
||||
|
||||
/*********************************************************************//**
|
||||
* Macro defines for Macro defines for UART Tx Enable register
|
||||
**********************************************************************/
|
||||
#define UART1_TER_TXEN ((uint8_t)(1<<7)) /*!< Transmit enable bit */
|
||||
#define UART1_TER_BITMASK ((uint8_t)(0x80)) /**< UART Transmit Enable Register bit mask */
|
||||
#define UART0_2_3_TER_TXEN ((uint8_t)(1<<0)) /*!< Transmit enable bit */
|
||||
#define UART0_2_3_TER_BITMASK ((uint8_t)(0x01)) /**< UART Transmit Enable Register bit mask */
|
||||
|
||||
/*********************************************************************//**
|
||||
* Macro defines for Macro defines for UART1 RS485 Control register
|
||||
**********************************************************************/
|
||||
#define UART_RS485CTRL_NMM_EN ((uint32_t)(1<<0)) /*!< RS-485/EIA-485 Normal Multi-drop Mode (NMM)
|
||||
is disabled */
|
||||
#define UART_RS485CTRL_RX_DIS ((uint32_t)(1<<1)) /*!< The receiver is disabled */
|
||||
#define UART_RS485CTRL_AADEN ((uint32_t)(1<<2)) /*!< Auto Address Detect (AAD) is enabled */
|
||||
#define UART_RS485CTRL_SEL_DTR ((uint32_t)(1<<3)) /*!< If direction control is enabled
|
||||
(bit DCTRL = 1), pin DTR is used for direction control */
|
||||
#define UART_RS485CTRL_DCTRL_EN ((uint32_t)(1<<4)) /*!< Enable Auto Direction Control */
|
||||
#define UART_RS485CTRL_OINV_1 ((uint32_t)(1<<5)) /*!< This bit reverses the polarity of the direction
|
||||
control signal on the RTS (or DTR) pin. The direction control pin
|
||||
will be driven to logic "1" when the transmitter has data to be sent */
|
||||
#define UART_RS485CTRL_BITMASK ((uint32_t)(0x3F)) /**< RS485 control bit-mask value */
|
||||
|
||||
/*********************************************************************//**
|
||||
* Macro defines for Macro defines for UART1 RS-485 Address Match register
|
||||
**********************************************************************/
|
||||
#define UART_RS485ADRMATCH_BITMASK ((uint8_t)(0xFF)) /**< Bit mask value */
|
||||
|
||||
/*********************************************************************//**
|
||||
* Macro defines for Macro defines for UART1 RS-485 Delay value register
|
||||
**********************************************************************/
|
||||
/* Macro defines for UART1 RS-485 Delay value register */
|
||||
#define UART_RS485DLY_BITMASK ((uint8_t)(0xFF)) /** Bit mask value */
|
||||
|
||||
/*********************************************************************//**
|
||||
* Macro defines for Macro defines for UART FIFO Level register
|
||||
**********************************************************************/
|
||||
#define UART_FIFOLVL_RXFIFOLVL(n) ((uint32_t)(n&0x0F)) /**< Reflects the current level of the UART receiver FIFO */
|
||||
#define UART_FIFOLVL_TXFIFOLVL(n) ((uint32_t)((n>>8)&0x0F)) /**< Reflects the current level of the UART transmitter FIFO */
|
||||
#define UART_FIFOLVL_BITMASK ((uint32_t)(0x0F0F)) /**< UART FIFO Level Register bit mask */
|
||||
|
||||
|
||||
|
||||
void rt_hw_uart_init(void);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user