summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxieyangrun <[email protected]>2017-08-31 10:50:23 +0800
committerxieyangrun <[email protected]>2017-08-31 10:51:17 +0800
commitb9ec9d64b8b57f80efd75cf7547dfb7cef80938d (patch)
tree81f7cf2614e39d65dc85cdc14dff01dfe84cdec2
parent01c43e8bedac0da6c601e382eb1458920a86c0fd (diff)
finsh init change to application thread
-rw-r--r--bsp/samd21/applications/application.c9
-rw-r--r--bsp/samd21/applications/startup.c80
2 files changed, 45 insertions, 44 deletions
diff --git a/bsp/samd21/applications/application.c b/bsp/samd21/applications/application.c
index 186ee8ac4a..d89bdd2a60 100644
--- a/bsp/samd21/applications/application.c
+++ b/bsp/samd21/applications/application.c
@@ -83,6 +83,13 @@ void rt_init_thread_entry(void* parameter)
rt_device_t dev;
rt_kprintf("SYSTEM running at %uhz\n", SystemCoreClock);
+
+#ifdef RT_USING_FINSH
+ /* init finsh */
+ finsh_system_init();
+ finsh_set_device("uart1");
+#endif
+
LED_Init();
configure_extint_channel();
configure_extint_callbacks();
@@ -90,7 +97,7 @@ void rt_init_thread_entry(void* parameter)
#ifndef TEST_UART_RX
sleep_timer_init();
- // sleep_timer_start(1500);
+ // sleep_timer_start(1500);
while (1)
{
diff --git a/bsp/samd21/applications/startup.c b/bsp/samd21/applications/startup.c
index 8717d95dca..b8c2c83d0d 100644
--- a/bsp/samd21/applications/startup.c
+++ b/bsp/samd21/applications/startup.c
@@ -49,11 +49,11 @@ extern int __bss_end;
*******************************************************************************/
void assert_failed(uint8_t* file, uint32_t line)
{
- rt_kprintf("\n\r Wrong parameter value detected on\r\n");
- rt_kprintf(" file %s\r\n", file);
- rt_kprintf(" line %d\r\n", line);
+ rt_kprintf("\n\r Wrong parameter value detected on\r\n");
+ rt_kprintf(" file %s\r\n", file);
+ rt_kprintf(" line %d\r\n", line);
- while (1) ;
+ while (1) ;
}
#endif
@@ -62,66 +62,60 @@ void assert_failed(uint8_t* file, uint32_t line)
*/
void rtthread_startup(void)
{
- /* init board */
- rt_board_init();
+ /* init board */
+ rt_board_init();
- /* show version */
- rt_show_version();
+ /* show version */
+ rt_show_version();
- /* init tick */
- rt_system_tick_init();
+ /* init tick */
+ rt_system_tick_init();
- /* init kernel object */
- rt_system_object_init();
+ /* init kernel object */
+ rt_system_object_init();
- /* init timer system */
- rt_system_timer_init();
+ /* init timer system */
+ rt_system_timer_init();
#ifdef RT_USING_HEAP
- #ifdef __CC_ARM
- rt_system_heap_init((void*)&Image$$RW_IRAM1$$ZI$$Limit, (void*)CHIP_SRAM_END);
- #elif __ICCARM__
- rt_system_heap_init(__segment_end("HEAP"), (void*)CHIP_SRAM_END);
- #else
- /* init memory system */
- rt_system_heap_init((void*)&__bss_end, (void*)CHIP_SRAM_END);
- #endif
+ #ifdef __CC_ARM
+ rt_system_heap_init((void*)&Image$$RW_IRAM1$$ZI$$Limit, (void*)CHIP_SRAM_END);
+ #elif __ICCARM__
+ rt_system_heap_init(__segment_end("HEAP"), (void*)CHIP_SRAM_END);
+ #else
+ /* init memory system */
+ rt_system_heap_init((void*)&__bss_end, (void*)CHIP_SRAM_END);
+ #endif
#endif
- /* init scheduler system */
- rt_system_scheduler_init();
+ /* init scheduler system */
+ rt_system_scheduler_init();
- /* init application */
- rt_application_init();
-
-#ifdef RT_USING_FINSH
- /* init finsh */
- finsh_system_init();
- finsh_set_device("uart1");
-#endif
+ /* init application */
+ rt_application_init();
/* init timer thread */
rt_system_timer_thread_init();
- /* init idle thread */
- rt_thread_idle_init();
+ /* init idle thread */
+ rt_thread_idle_init();
- /* start scheduler */
- rt_system_scheduler_start();
+ /* start scheduler */
+ rt_system_scheduler_start();
- /* never reach here */
- return ;
+ /* never reach here */
+ return ;
}
int main(void)
{
- /* disable interrupt first */
- rt_hw_interrupt_disable();
+ /* disable interrupt first */
+ rt_hw_interrupt_disable();
- /* startup RT-Thread RTOS */
- rtthread_startup();
+ /* startup RT-Thread RTOS */
+ rtthread_startup();
- return 0;
+ return 0;
}
/*@}*/