From f8afab609ae79005171c844e032cef1accf67944 Mon Sep 17 00:00:00 2001 From: "fengzi.rtt" Date: Fri, 23 Dec 2011 07:22:36 +0000 Subject: [PATCH] update lm4f232 startup files for PDL r8246. git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1874 bbd45198-f89e-11dd-88c7-29a3b14d5316 --- .../Libraries/startup/arm/start_rvds.S | 23 ++++++++-- bsp/lm4f232/Libraries/startup/gcc/start_gcc.c | 34 +++++++++++--- bsp/lm4f232/drivers/board.c | 14 ++---- bsp/lm4f232/rtconfig.py | 46 +------------------ 4 files changed, 53 insertions(+), 64 deletions(-) diff --git a/bsp/lm4f232/Libraries/startup/arm/start_rvds.S b/bsp/lm4f232/Libraries/startup/arm/start_rvds.S index 0fa43770f2..6878f7859d 100644 --- a/bsp/lm4f232/Libraries/startup/arm/start_rvds.S +++ b/bsp/lm4f232/Libraries/startup/arm/start_rvds.S @@ -19,7 +19,7 @@ ; CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL ; DAMAGES, FOR ANY REASON WHATSOEVER. ; -; This is part of revision 8049 of the EK-LM4F232 Firmware Package. +; This is part of revision 8264 of the EK-LM4F232 Firmware Package. ; ;****************************************************************************** @@ -89,7 +89,7 @@ __Vectors DCD StackMem + Stack ; Top of Stack DCD Reset_Handler ; Reset Handler DCD NmiSR ; NMI Handler - DCD HardFault_Handler ; Hard Fault Handler + DCD HardFault_Handler ; Hard Fault Handler DCD IntDefaultHandler ; The MPU fault handler DCD IntDefaultHandler ; The bus fault handler DCD IntDefaultHandler ; The usage fault handler @@ -144,7 +144,7 @@ __Vectors DCD IntDefaultHandler ; CAN0 DCD IntDefaultHandler ; CAN1 DCD IntDefaultHandler ; CAN2 - DCD rt_hw_eth_handler ; Ethernet + DCD IntDefaultHandler ; Ethernet DCD IntDefaultHandler ; Hibernate DCD IntDefaultHandler ; USB0 DCD IntDefaultHandler ; PWM Generator 3 @@ -250,6 +250,23 @@ __Vectors ;****************************************************************************** EXPORT Reset_Handler Reset_Handler + ; + ; Enable the floating-point unit. This must be done here to handle the + ; case where main() uses floating-point and the function prologue saves + ; floating-point registers (which will fault if floating-point is not + ; enabled). Any configuration of the floating-point unit using + ; DriverLib APIs must be done here prior to the floating-point unit + ; being enabled. + ; + ; Note that this does not use DriverLib since it might not be included + ; in this project. + ; + MOVW R0, #0xED88 + MOVT R0, #0xE000 + LDR R1, [R0] + ORR R1, #0x00F00000 + STR R1, [R0] + ; ; Call the C library enty point that handles startup. This will copy ; the .data section initializers from flash to SRAM and zero fill the diff --git a/bsp/lm4f232/Libraries/startup/gcc/start_gcc.c b/bsp/lm4f232/Libraries/startup/gcc/start_gcc.c index cca7508b50..2742aee7c5 100644 --- a/bsp/lm4f232/Libraries/startup/gcc/start_gcc.c +++ b/bsp/lm4f232/Libraries/startup/gcc/start_gcc.c @@ -18,10 +18,13 @@ // CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL // DAMAGES, FOR ANY REASON WHATSOEVER. // -// This is part of revision 8049 of the EK-LM4F232 Firmware Package. +// This is part of revision 8264 of the EK-LM4F232 Firmware Package. // //***************************************************************************** +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" + //***************************************************************************** // // Forward declaration of the default fault handlers. @@ -32,11 +35,16 @@ static void NmiSR(void); static void FaultISR(void); static void IntDefaultHandler(void); +//***************************************************************************** +// +// External declaration for the interrupt handler used by the application. +// +//***************************************************************************** /* RT-Thread interface */ static void HardFault_Handler(void); static void PendSV_Handler(void); static void rt_hw_timer_handler(void); - +static void rt_hw_uart_isr_1(void); //***************************************************************************** // // The entry point for the application. @@ -64,7 +72,7 @@ void (* const g_pfnVectors[])(void) = // The initial stack pointer ResetISR, // The reset handler NmiSR, // The NMI handler - HardFault_Handler, // The hard fault handler + HardFault_Handler, // The hard fault handler IntDefaultHandler, // The MPU fault handler IntDefaultHandler, // The bus fault handler IntDefaultHandler, // The usage fault handler @@ -75,14 +83,14 @@ void (* const g_pfnVectors[])(void) = IntDefaultHandler, // SVCall handler IntDefaultHandler, // Debug monitor handler 0, // Reserved - PendSV_Handler, // The PendSV handler - rt_hw_timer_handler, // The SysTick handler + PendSV_Handler, // The PendSV handler + rt_hw_timer_handler, // The SysTick handler IntDefaultHandler, // GPIO Port A IntDefaultHandler, // GPIO Port B IntDefaultHandler, // GPIO Port C IntDefaultHandler, // GPIO Port D IntDefaultHandler, // GPIO Port E - IntDefaultHandler, // UART0 Rx and Tx + rt_hw_uart_isr_1, // UART0 Rx and Tx IntDefaultHandler, // UART1 Rx and Tx IntDefaultHandler, // SSI0 Rx and Tx IntDefaultHandler, // I2C0 Master and Slave @@ -268,6 +276,20 @@ ResetISR(void) " strlt r2, [r0], #4\n" " blt zero_loop"); + // + // Enable the floating-point unit. This must be done here to handle the + // case where main() uses floating-point and the function prologue saves + // floating-point registers (which will fault if floating-point is not + // enabled). Any configuration of the floating-point unit using DriverLib + // APIs must be done here prior to the floating-point unit being enabled. + // + // Note that this does not use DriverLib since it might not be included in + // this project. + // + HWREG(NVIC_CPAC) = ((HWREG(NVIC_CPAC) & + ~(NVIC_CPAC_CP10_M | NVIC_CPAC_CP11_M)) | + NVIC_CPAC_CP10_FULL | NVIC_CPAC_CP11_FULL); + // // Call the application's entry point. // diff --git a/bsp/lm4f232/drivers/board.c b/bsp/lm4f232/drivers/board.c index cadb00e5ff..1e4b53f110 100644 --- a/bsp/lm4f232/drivers/board.c +++ b/bsp/lm4f232/drivers/board.c @@ -77,17 +77,11 @@ void rt_hw_eth_handler(void) void rt_hw_board_init() { - // - // The FPU should be enabled because some compilers will use floating- - // point registers, even for non-floating-point code. If the FPU is not - // enabled this will cause a fault. This also ensures that floating- - // point operations could be added to this application and would work - // correctly and use the hardware floating-point unit. Finally, lazy - // stacking is enabled for interrupt handlers. This allows floating- - // point instructions to be used within interrupt handlers, but at the - // expense of extra stack usage. // - FPUEnable(); + // Enable lazy stacking for interrupt handlers. This allows floating-point + // instructions to be used within interrupt handlers, but at the expense of + // extra stack usage. + // FPULazyStackingEnable(); // set sysclock to 80M diff --git a/bsp/lm4f232/rtconfig.py b/bsp/lm4f232/rtconfig.py index 903a5e9281..32abf1f37f 100644 --- a/bsp/lm4f232/rtconfig.py +++ b/bsp/lm4f232/rtconfig.py @@ -14,11 +14,8 @@ if CROSS_TOOL == 'gcc': elif CROSS_TOOL == 'keil': PLATFORM = 'armcc' EXEC_PATH = 'E:/Keil' -elif CROSS_TOOL == 'iar': - PLATFORM = 'iar' - IAR_PATH = 'E:/Program Files/IAR Systems/Embedded Workbench 6.0' -# + BUILD = 'debug' if PLATFORM == 'gcc': @@ -75,45 +72,4 @@ elif PLATFORM == 'armcc': 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' - - DEVICE = ' -D USE_STDPERIPH_DRIVER' + ' -D STM32F10X_HD' - CFLAGS = DEVICE - 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' - CFLAGS += ' --cpu=Cortex-M3' - CFLAGS += ' -e' - CFLAGS += ' --fpu=None' - 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' - AFLAGS += ' --cpu Cortex-M3' - AFLAGS += ' --fpu None' - - LFLAGS = ' --config stm32f10x_flash.icf' - LFLAGS += ' --redirect _Printf=_PrintfTiny' - LFLAGS += ' --redirect _Scanf=_ScanfSmall' - LFLAGS += ' --entry __iar_program_start' - - EXEC_PATH = IAR_PATH + '/arm/bin/' - POST_ACTION = '' -- GitLab