9691c659c8
1. fix heap management for stm32f0xx(SRAM=8k) 2. add USART1, USART2 driver for stm32f051R8 3. fix finsh support for stm32f0x 4. fix board components initial for stm32f0x and open debug msg 5. add led driver(pc9) and test thread for stm32f0discovery board 6. add init thread for stm32f0x do components initial 7. add rcc initial for stm32f0x in rt_hw_board_init() 8. add print rcc freq information function the console output example is: SYSCLK_Frequency is 48000000HZ PCLK_Frequency is 48000000HZ HCLK_Frequency is 48000000HZ CECCLK_Frequency is 32786HZ ADCCLK_Frequency is 14000000HZ USART1CLK_Frequency is 48000000HZ I2C1CLK_Frequency is 8000000HZ SystemCoreClock is 48000000HZ initialize rti_start:0 done \ | / - RT - Thread Operating System / | \ 1.2.0 build Nov 15 2013 2006 - 2013 Copyright by rt-thread team do components intialization. initialize rti_board_end:0 done initialize rt_hw_led_init:32768 done initialize finsh_system_init:0 done finsh>>
122 lines
2.6 KiB
C
122 lines
2.6 KiB
C
/*
|
|
* File : startup.c
|
|
* This file is part of RT-Thread RTOS
|
|
* COPYRIGHT (C) 2006, 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://openlab.rt-thread.com/license/LICENSE
|
|
*
|
|
* Change Logs:
|
|
* Date Author Notes
|
|
* 2006-08-31 Bernard first implementation
|
|
* 2013-11-15 bright modify for stm32f0xx version and components initial
|
|
*/
|
|
|
|
#include <rthw.h>
|
|
#include <rtthread.h>
|
|
|
|
#include "board.h"
|
|
|
|
/**
|
|
* @addtogroup STM32
|
|
*/
|
|
|
|
/*@{*/
|
|
|
|
extern int rt_application_init(void);
|
|
#ifdef RT_USING_FINSH
|
|
extern void finsh_system_init(void);
|
|
extern void finsh_set_device(const char* device);
|
|
#endif
|
|
|
|
#ifdef __CC_ARM
|
|
extern int Image$$RW_IRAM1$$ZI$$Limit;
|
|
#define STM32_SRAM_BEGIN (&Image$$RW_IRAM1$$ZI$$Limit)
|
|
#elif __ICCARM__
|
|
#pragma section="HEAP"
|
|
#define STM32_SRAM_BEGIN (__segment_end("HEAP"))
|
|
#else
|
|
extern int __bss_end;
|
|
#define STM32_SRAM_BEGIN (&__bss_end)
|
|
#endif
|
|
|
|
/*******************************************************************************
|
|
* Function Name : assert_failed
|
|
* Description : Reports the name of the source file and the source line number
|
|
* where the assert error has occurred.
|
|
* Input : - file: pointer to the source file name
|
|
* - line: assert error line source number
|
|
* Output : None
|
|
* Return : None
|
|
*******************************************************************************/
|
|
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);
|
|
|
|
while (1) ;
|
|
}
|
|
|
|
/**
|
|
* This function will startup RT-Thread RTOS.
|
|
*/
|
|
void rtthread_startup(void)
|
|
{
|
|
/* init board */
|
|
rt_hw_board_init();
|
|
|
|
/* show version */
|
|
rt_show_version();
|
|
|
|
/* init tick */
|
|
rt_system_tick_init();
|
|
|
|
/* init kernel object */
|
|
rt_system_object_init();
|
|
|
|
/* init timer system */
|
|
rt_system_timer_init();
|
|
|
|
#ifdef RT_USING_HEAP
|
|
rt_system_heap_init((void*)STM32_SRAM_BEGIN, (void*)STM32_SRAM_END);
|
|
#endif
|
|
|
|
/* init scheduler system */
|
|
rt_system_scheduler_init();
|
|
|
|
#ifdef RT_USING_DEVICE
|
|
/* init all device */
|
|
rt_device_init_all();
|
|
#endif
|
|
|
|
/* init application */
|
|
rt_application_init();
|
|
|
|
/* init timer thread */
|
|
rt_system_timer_thread_init();
|
|
|
|
/* init 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;
|
|
}
|
|
|
|
/*@}*/
|