diff --git a/bsp/tm4c129x/applications/application.c b/bsp/tm4c129x/applications/application.c index 984e6221573a44d23904baa9377c1cdc3ea32284..0ed8ab21d49af06ffd62d42ae19758dc90dca969 100644 --- a/bsp/tm4c129x/applications/application.c +++ b/bsp/tm4c129x/applications/application.c @@ -13,23 +13,13 @@ */ #include -#include #include -#ifdef RT_USING_LWIP -#include "drv_eth.h" -#endif /* thread phase init */ void rt_init_thread_entry(void *parameter) { /* Initialization RT-Thread Components */ rt_components_init(); -#ifdef RT_USING_FINSH - finsh_set_device(RT_CONSOLE_DEVICE_NAME); -#endif -#ifdef RT_USING_LWIP - rt_hw_tiva_eth_init(); -#endif } int rt_application_init(void) @@ -42,3 +32,4 @@ int rt_application_init(void) return 0; } + diff --git a/bsp/tm4c129x/applications/board.c b/bsp/tm4c129x/applications/board.c index 2953e76c58dae162a6e033d67c7a72c4b330f539..b0b3bd649adc94def15ee54a70ee216be0ec50b5 100644 --- a/bsp/tm4c129x/applications/board.c +++ b/bsp/tm4c129x/applications/board.c @@ -15,9 +15,9 @@ #include #include - +#include #include "board.h" -#include "drv_uart.h" + #include "driverlib/interrupt.h" #include "driverlib/sysctl.h" @@ -61,23 +61,27 @@ extern void HardFault_Handler(void); */ void rt_hw_board_init() { - MAP_IntMasterDisable(); + //init low level drivers. e.g. cpu uart etc. + rt_components_board_init(); + //redirect RTT stdio to CONSOLE device + rt_console_set_device(RT_CONSOLE_DEVICE_NAME); +} + +int rt_hw_cpu_init(void) +{ + MAP_IntMasterDisable(); IntRegister(FAULT_HARD, HardFault_Handler); IntRegister(FAULT_PENDSV, PendSV_Handler); IntRegister(FAULT_SYSTICK, SysTick_Handler); - // // 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. - // MAP_FPULazyStackingEnable(); - // // Set the clocking to run directly from the external crystal/oscillator. // TODO: The SYSCTL_XTAL_ value must be changed to match the value of the // crystal on your board. - // SysClock = MAP_SysCtlClockFreqSet( (SYSCTL_XTAL_25MHZ | SYSCTL_OSC_MAIN | SYSCTL_USE_PLL | SYSCTL_CFG_VCO_480), SYS_CLOCK_DEFAULT); @@ -89,13 +93,11 @@ void rt_hw_board_init() /* set pend exception priority */ //IntPrioritySet(FAULT_PENDSV, (1 << 5) - 1); - - /*init uart device*/ - rt_hw_uart_init(); - //redirect RTT stdio to CONSOLE device - rt_console_set_device(RT_CONSOLE_DEVICE_NAME); - // - // Enable interrupts to the processor. - // - MAP_IntMasterEnable(); + + /*Enable interrupts to the processor.*/ + MAP_IntMasterEnable(); + return 0; } +// rt_hw_cpu_init should be run before any other INIT_BOARD_EXPORT +// We use INIT_EXPORT here and set the sequence index to "0.xxxx" +INIT_EXPORT(rt_hw_cpu_init, "0.post"); \ No newline at end of file diff --git a/bsp/tm4c129x/drivers/drv_eth.c b/bsp/tm4c129x/drivers/drv_eth.c index 1355f533cfed574538c55e46284a7bbd366363cb..9d68a5d718f33cd652f6fd6dbc1dd63d3b231ecd 100644 --- a/bsp/tm4c129x/drivers/drv_eth.c +++ b/bsp/tm4c129x/drivers/drv_eth.c @@ -146,6 +146,8 @@ extern void lwIPHostGetTime(u32_t *time_s, u32_t *time_ns); #include "lwipopts.h" #include "drv_eth.h" +#include + /** * A structure used to keep track of driver state and error counts. */ @@ -1378,7 +1380,7 @@ static struct pbuf* eth_dev_rx(rt_device_t dev) return (result == RT_EOK)? (struct pbuf*)temp : RT_NULL; } -rt_err_t rt_hw_tiva_eth_init(void) +int rt_hw_tiva_eth_init(void) { rt_err_t result; @@ -1406,6 +1408,11 @@ rt_err_t rt_hw_tiva_eth_init(void) result = eth_device_init(&(eth_dev->parent), "e0"); return result; } +// eth_device_init using malloc +// We use INIT_COMPONENT_EXPORT insted of INIT_BOARD_EXPORT +INIT_COMPONENT_EXPORT(rt_hw_tiva_eth_init); + + #if 0 #ifdef RT_USING_FINSH #include "finsh.h" diff --git a/bsp/tm4c129x/drivers/drv_eth.h b/bsp/tm4c129x/drivers/drv_eth.h index 5f27139d5f6fcb483d4056b391d076e1ce0c3e8a..54431405fe0797ce399c0b8b0e763c3cb0a18792 100644 --- a/bsp/tm4c129x/drivers/drv_eth.h +++ b/bsp/tm4c129x/drivers/drv_eth.h @@ -15,6 +15,6 @@ #ifndef __TIVA_ETH_H__ #define __TIVA_ETH_H__ -rt_err_t rt_hw_tiva_eth_init(void); +int rt_hw_tiva_eth_init(void); #endif diff --git a/bsp/tm4c129x/drivers/drv_uart.c b/bsp/tm4c129x/drivers/drv_uart.c index 20ce0db22495f8d231b8a011e7c569c8e7b66481..73652789914bd092fbdd19d8ee8bc055159de5e4 100644 --- a/bsp/tm4c129x/drivers/drv_uart.c +++ b/bsp/tm4c129x/drivers/drv_uart.c @@ -18,7 +18,7 @@ #include #include "board.h" -//#include +#include #include "inc/hw_memmap.h" #include "driverlib/sysctl.h" @@ -220,4 +220,4 @@ int rt_hw_uart_init(void) #endif return 0; } -//INIT_BOARD_EXPORT(rt_hw_uart_init); +INIT_BOARD_EXPORT(rt_hw_uart_init); diff --git a/bsp/tm4c129x/libraries/SConscript b/bsp/tm4c129x/libraries/SConscript index 02874cac120f1b541b1db68ccfd29030dc396ed0..8b48a34c7d9f0dad25c75173a0b0431cf90f3272 100644 --- a/bsp/tm4c129x/libraries/SConscript +++ b/bsp/tm4c129x/libraries/SConscript @@ -14,8 +14,6 @@ elif rtconfig.CROSS_TOOL == 'keil': src += ['startup/startup_rvmdk.S'] elif rtconfig.CROSS_TOOL == 'iar': src += ['startup/startup_ewarm.c'] -elif rtconfig.CROSS_TOOL == 'ccs': - src += ['startup/startup_ccs.c'] CPPPATH = [cwd, cwd + '/inc', cwd + '/driverlib'] diff --git a/bsp/tm4c129x/rtconfig.h b/bsp/tm4c129x/rtconfig.h index 9d76c80f062587f5cd9cf65a1d6b3c09f115cb24..c00e4537ad6c517913106a13a09a2eb6f8831984 100644 --- a/bsp/tm4c129x/rtconfig.h +++ b/bsp/tm4c129x/rtconfig.h @@ -180,19 +180,19 @@ // #define RT_LWIP_DNS // -#define RT_LWIP_PBUF_NUM 4 +#define RT_LWIP_PBUF_NUM 8 // -#define RT_LWIP_TCP_PCB_NUM 3 +#define RT_LWIP_TCP_PCB_NUM 5 // -#define RT_LWIP_TCP_SND_BUF 4086 +#define RT_LWIP_TCP_SND_BUF 8192 // -#define RT_LWIP_TCP_WND 2048 +#define RT_LWIP_TCP_WND 8192 // // #define RT_LWIP_SNMP // -// #define RT_LWIP_DHCP + #define RT_LWIP_DHCP // -#define RT_LWIP_TCP_SEG_NUM 12 +#define RT_LWIP_TCP_SEG_NUM 24 // #define RT_LWIP_TCPTHREAD_PRIORITY 12 // diff --git a/bsp/tm4c129x/rtconfig.py b/bsp/tm4c129x/rtconfig.py index 93e3f3e2572d0e3693bc28d7ba1c97f68d3e5787..ba3fc51c935fa3f28535dcd7ff12a62133d0cbe7 100644 --- a/bsp/tm4c129x/rtconfig.py +++ b/bsp/tm4c129x/rtconfig.py @@ -29,8 +29,8 @@ elif CROSS_TOOL == 'iar': if os.getenv('RTT_EXEC_PATH'): EXEC_PATH = os.getenv('RTT_EXEC_PATH') -BUILD = 'debug' -#BUILD = 'release' +#BUILD = 'debug' +BUILD = 'release' if PLATFORM == 'gcc': # tool-chains diff --git a/bsp/tm4c129x/template.uvproj b/bsp/tm4c129x/template.uvproj index 1a84ba0131e2121ce95ee231f19e574c1298610f..342711d8becf303f8f6ef8f866df48bf593d4a25 100644 --- a/bsp/tm4c129x/template.uvproj +++ b/bsp/tm4c129x/template.uvproj @@ -12,26 +12,26 @@ ARM-ADS - TM4C129XNCZAD + TM4C1294NCPDT Texas Instruments Keil.TM4C_DFP.1.0.0 http://www.keil.com/pack/ IROM(0x00000000,0x100000) IRAM(0x20000000,0x040000) CPUTYPE("Cortex-M4") FPU2 CLOCK(120000000) ELITTLE - UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0TM4C129_1024 -FS00 -FL0100000 -FP0($$Device:TM4C129XNCZAD$Flash\TM4C129_1024.FLM)) - 7096 - $$Device:TM4C129XNCZAD$Device\Include\TM4C129\TM4C129.h + UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0TM4C129_1024 -FS00 -FL0100000 -FP0($$Device:TM4C1294NCPDT$Flash\TM4C129_1024.FLM)) + 7088 + $$Device:TM4C1294NCPDT$Device\Include\TM4C129\TM4C129.h - -DTM4C129XNCZAD + -DTM4C1294NCPDT - $$Device:TM4C129XNCZAD$SVD\TM4C129\TM4C129XNCZAD.svd + $$Device:TM4C1294NCPDT$SVD\TM4C129\TM4C1294NCPDT.svd 0 0 @@ -52,7 +52,7 @@ 0 0 1 - 0 + 1 .\ 1 0 @@ -148,7 +148,7 @@ 1 0 - 3 + 6 @@ -162,7 +162,7 @@ - BIN\lmidk-agdi.dll + Segger\JL2CM3.dll diff --git a/bsp/tm4c129x/tm4c_rom.icf b/bsp/tm4c129x/tm4c_rom.icf index b09595243de9075c614a190ae3372505c6cfa0fc..c5838c98ea1a7a037c812ff08302b07cde74623f 100644 --- a/bsp/tm4c129x/tm4c_rom.icf +++ b/bsp/tm4c129x/tm4c_rom.icf @@ -77,4 +77,5 @@ place at start of SRAM { section VTABLE }; // place in SRAM { readwrite, block HEAP }; keep { section FSymTab }; -keep { section VSymTab }; \ No newline at end of file +keep { section VSymTab }; +keep { section .rti_fn* }; \ No newline at end of file