Beispiel #1
0
//------------------------------------------------------------------------------
// Copy flash function to RAM.
//------------------------------------------------------------------------------
void Upgrade(void)
{
  unsigned char *flash_start_ptr;           // Initialize pointers
  unsigned char *flash_end_ptr;
  unsigned char *RAM_start_ptr;

  if (CheckUpgrade() != 0xff)
    return;

  //Initialize flash and ram start and end address
  flash_start_ptr = (unsigned char *)__segment_begin("FLASHCODE");
  flash_end_ptr = (unsigned char *)__segment_end("FLASHCODE");
  RAM_start_ptr = (unsigned char *)__segment_begin("RAMCODE");

  //calculate function size
  unsigned long function_size = (unsigned long)(flash_end_ptr) - (unsigned long)(flash_start_ptr);

  // Copy flash function to RAM
  printf("Copy From %p to %p size=%ld\n", flash_start_ptr, RAM_start_ptr, function_size);
  memcpy(RAM_start_ptr,flash_start_ptr,function_size);

  motor_on(0, 0);
  printf("Jump to %p\n", FlashFirmware);

  // remove the flag of firmware
  struct _header h;
  SPI_FLASH_BufferRead((void*)&h, FIRMWARE_BASE, sizeof(h));
  SPI_FLASH_BufferWrite((void*)&h, FIRMWARE_BASE + h.length + 2 * sizeof(h), sizeof(h));

  FlashFirmware();
}
Beispiel #2
0
/**
 * This function will startup RT-Thread RTOS.
 */
void rtthread_startup(void)
{
	/* init hardware interrupt */
	rt_hw_interrupt_init();

	/* init board */
	rt_hw_board_init();

	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
#ifdef __CC_ARM
	rt_system_heap_init((void*)&Image$$RW_IRAM1$$ZI$$Limit, (void*)0x204000);
#elif __ICCARM__
    rt_system_heap_init(__segment_end("HEAP"), (void*)0x204000);
#else
	rt_system_heap_init((void*)&__bss_end, (void*)0x204000);
#endif
#endif

	/* init scheduler system */
	rt_system_scheduler_init();

#ifdef RT_USING_HOOK /* if the hook is used */
	/* set idle thread hook */
	rt_thread_idle_sethook(rt_hw_led_flash);
#endif

#ifdef RT_USING_DEVICE
	/* init hardware serial device */
	rt_hw_serial_init();
#endif

	/* init application */
	rt_application_init();

#ifdef RT_USING_FINSH
	/* init finsh */
	finsh_system_init();
	finsh_set_device("uart1");
#endif

	/* init idle thread */
	rt_thread_idle_init();

	/* start scheduler */
	rt_system_scheduler_start();

	/* never reach here */
	return ;
}
Beispiel #3
0
/**
 * This function will initial M487 board.
 */
void rt_hw_board_init(void)
{
    clock_init();

#ifdef RT_USING_HEAP
#ifdef __CC_ARM
    rt_system_heap_init((void*)&Image$$RW_IRAM1$$ZI$$Limit, (void*)SRAM_END);
#elif __ICCARM__
    rt_system_heap_init(__segment_end("HEAP"), (void*)SRAM_END);
#else
    /* init memory system */
    rt_system_heap_init((void*)&__bss_end, (void*)&__ram_top);
#endif
#endif /* RT_USING_HEAP */

    rt_hw_uart_init();

#ifdef RT_USING_CONSOLE
    rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
#endif

    SysTick_Config(SystemCoreClock / RT_TICK_PER_SECOND);
	
	NVIC_SetPriorityGrouping(7);
	
#ifdef RT_USING_COMPONENTS_INIT
    rt_components_board_init();
#endif
}
/*! \brief Initializes the heap.
 */
static void init_heap(void)
{
#ifdef _DEBUG
#if __GNUC__ && __AVR32__

    // Import the location of the heap.
    extern void __heap_start__;
    extern void __heap_end__;

    U32 *p_heap_word;

    // Initialize the heap.
    for (p_heap_word = &__heap_start__; (void *)p_heap_word < &__heap_end__; p_heap_word++)
        *p_heap_word = DEFAULT_HEAP_INIT_WORD;

#elif __ICCAVR32__

    // Import the location of the heap.
#pragma segment = "HEAP"

    U32 *p_heap_word;

    // Initialize the heap.
    for (p_heap_word = __segment_begin("HEAP"); (void *)p_heap_word < __segment_end("HEAP"); p_heap_word++)
        *p_heap_word = DEFAULT_HEAP_INIT_WORD;

#endif
#endif
}
Beispiel #5
0
struct page_s* find_uri(char* href)
{
  char uri[32];
  int i;
  for(i=0; i<sizeof uri - 1 && href[i] && href[i]!='?'; ++i) uri[i] = href[i];  // 3.11.2010 by LBS (introduced in wtimer project)
  uri[i] = 0;
  struct page_s *page;
  for(page = __segment_begin("HTML_HEADERS"); (void*)page < __segment_end("HTML_HEADERS"); ++page)
  {
    if(strcmp(page->name, uri) == 0)
    {
      if((page->flags & HTML_FLG_CGI) == 0)
      {
#if defined( HTML_RES_IS_IN_CPU_FLASH )
        // unsigned char *page_sig = (void*)(HTML_RES_START + (unsigned)page->addr - 2);
        unsigned char *page_sig = (unsigned char*)(page->addr) - 2; // 30.10.2011
        if(page_sig[0] != 0x59 || page_sig[1] != 0x95) return 0;
#elif defined( HTML_RES_IS_IN_EEPROM )
#error "Data in ext. memory is not supported in this http2 version!"
        /*
        unsigned char page_sig[2];
        EEPROM_READ(html_base + (unsigned)page->addr - 2, page_sig, sizeof page_sig);
        if(page_sig[0] != 0x59 || page_sig[1] != 0x95) return 0;
        */
#else
#error "Define HTML_RES_IS_IN_xxxxx macro in http2_def.h!"
#endif
      }
      return page;
    }
  }
  return 0;
}
Beispiel #6
0
/**
 * 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
#if STM32_EXT_SRAM
    rt_system_heap_init((void*)STM32_EXT_SRAM_BEGIN, (void*)STM32_EXT_SRAM_END);
#else
#ifdef __CC_ARM
    rt_system_heap_init((void*)&Image$$RW_IRAM1$$ZI$$Limit, (void*)STM32_SRAM_END);
#elif __ICCARM__
    rt_system_heap_init(__segment_end("HEAP"), (void*)STM32_SRAM_END);
#else
    /* init memory system */
    rt_system_heap_init((void*)&__bss_end, (void*)STM32_SRAM_END);
#endif
#endif
#endif

    /* init scheduler system */
    rt_system_scheduler_init();

    /* init all device */
    rt_device_init_all();

    /* init application */
    rt_application_init();

#ifdef RT_USING_FINSH
    /* init finsh */
    finsh_system_init();
    finsh_set_device(FINSH_DEVICE_NAME);
#endif

	rt_system_timer_thread_init();

    /* init idle thread */
    rt_thread_idle_init();

    /* start scheduler */
    rt_system_scheduler_start();

    /* never reach here */
    return ;
}
/**
 * This function will startup RT-Thread RTOS.
 */
void rtthread_startup(void)
{
	app_getGUID();
	/* initialize board */
	rt_hw_board_init();
	
	/* show version */
	rt_show_version();
	
	rt_kprintf(" device id:%x %x %x %x\n",devguid[0],devguid[1],devguid[2],devguid[3]);

#ifdef RT_USING_HEAP
	/* initialize memory system */
	#ifdef __CC_ARM
		rt_system_heap_init((void*)&Image$$RW_IRAM1$$ZI$$Limit, (void*)(0x10000000 + 1024*64));
	#elif __ICCARM__
	    rt_system_heap_init(__segment_end("HEAP"), (void*)(0x10000000 + 1024*64));
	#else
		rt_system_heap_init((void*)&__bss_end, (void*)(0x10000000 + 1024*64));
	#endif
#endif

	/* initialize scheduler system */
	rt_system_scheduler_init();
#ifdef RT_USING_DFS
	/* init sdcard driver */
#ifdef RT_USE_SDIO
	rt_hw_sdcard_init();
#else
	rt_hw_msd_init();
#endif
#endif
	/* initialize application */
	rt_application_init();

#ifdef RT_USING_FINSH
	/* initialize finsh */
	finsh_system_init();
	finsh_set_device( FINSH_DEVICE_NAME );
#endif

    /* initialize timer */
    rt_system_timer_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 ;
}
Beispiel #8
0
static  void  AppTaskCreate (void)
{
    OS_ERR  error = OS_ERR_NONE;

    struct OSTaskCreate_Arg* task_find;
    struct OSTaskCreate_Arg* task_end;

    task_find = __segment_begin("APP_TASK_DEFINE");
    task_end = __segment_end("APP_TASK_DEFINE");


    for(; task_find < task_end; task_find ++)
    {

        OSTaskCreate((OS_TCB     *)task_find->p_tcb,
                        (CPU_CHAR   *)task_find->p_name,
                        (OS_TASK_PTR )task_find->p_task,
                        (void       *)task_find->p_arg,
                        (OS_PRIO     )task_find->prio,
                        (CPU_STK    *)task_find->p_stk_base,
                        (CPU_STK_SIZE)task_find->stk_limit,
                        (CPU_STK_SIZE)task_find->stk_size,
                        (OS_MSG_QTY  )task_find->q_size,
                        (OS_TICK     )task_find->time_quanta,
                        (void       *)task_find->p_ext,
                        (OS_OPT      )task_find->opt,
                        (OS_ERR     *)&error );


        if(error != OS_ERR_NONE)
        {
            goto ERROR_HANDLE;
        }

    }


    return;


    ERROR_HANDLE:

    switch(error)
    {
    case OS_ERR_NONE:
        break;

    default:
        while(1);
        break;

    }
}
Beispiel #9
0
/**
 * 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
#ifdef __ICCM16C__
    rt_system_heap_init(__segment_begin("DATA16_HEAP"),__segment_end("DATA16_HEAP"));
#endif
#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();

#ifdef RT_USING_FINSH
	/* init finsh */
	finsh_system_init();
	finsh_set_device("uart0");
#endif

    /* 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 ;
}
Beispiel #10
0
/**
 * This function will startup RT-Thread RTOS.
 */
void rtthread_startup(void)
{
    /* init board */
    rt_hw_board_init();

    /* show version */
    rt_show_version();

#ifdef RT_USING_HEAP
#if STM32_EXT_SRAM
	
    rt_system_heap_init((void*)STM32_EXT_SRAM_BEGIN, (void*)STM32_EXT_SRAM_END);
	  //rt_system_heap_init((void*)(0x10000000), (void*)(0x10000000 + UTIL_CCM_HEAP_SIZE*4));
#else
#ifdef __CC_ARM
    rt_system_heap_init((void*)&Image$$RW_IRAM1$$ZI$$Limit, (void*)STM32_SRAM_END);
#elif __ICCARM__
    rt_system_heap_init(__segment_end("HEAP"), (void*)STM32_SRAM_END);
#else
    /* init memory system */
    rt_system_heap_init((void*)&__bss_end, (void*)STM32_SRAM_END);
#endif
#endif  /* STM32_EXT_SRAM */
#endif /* RT_USING_HEAP */

    /* init scheduler system */
    rt_system_scheduler_init();
		
    /* initialize timer */
    rt_system_timer_init();		

    /* init timer thread */
    rt_system_timer_thread_init();

    /* init application */
    rt_application_init();

    /* init idle thread */
    rt_thread_idle_init();

    /* start scheduler */
    rt_system_scheduler_start();

    /* never reach here */
    return ;
}
Beispiel #11
0
int LoadConfigData(const wchar_t *path,const wchar_t *fname)
{
  int f;
  char *buf;
  int result=-1;
  void *cfg;
  FSTAT _fstat;
  unsigned int rlen;

  cfg=(char *)__segment_begin("CONFIG_C");

  unsigned int len=(char *)__segment_end("CONFIG_C")-(char *)__segment_begin("CONFIG_C");

  if ((buf=new char[len]))
  {
    if (fstat(path,fname,&_fstat)!=-1)
    {
      if ((f=_fopen(path,fname,0x001,0x180,0))>=0)
      {
        rlen=fread(f,buf,len);
        fclose(f);
        if (rlen!=_fstat.fsize || rlen!=len)  goto L_SAVENEWCFG;
        memcpy(cfg,buf,len);
        result=0;
      }
    }
    else
    {
    L_SAVENEWCFG:
      if ((f=_fopen(path,fname,0x204,0x180,0))>=0)
      {
        if (fwrite(f,cfg,len)==len) result=0;
        fclose(f);
      }
    }
    delete buf;
  }
  if (result>=0)
  {
    successed_config_path=path;
    successed_config_name=fname;
  }
  return(result);
}
Beispiel #12
0
/**
 * 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
	/* initialize memory system */
	#ifdef __CC_ARM
		/*rt_system_heap_init((void*)&Image$$RW_IRAM1$$ZI$$Limit, (void*)0x10004000);*/
		rt_system_heap_init((void*)0x2007C000, (void*)(0x2007C000 + 0x4000));
	
	#elif __ICCARM__
	    rt_system_heap_init(__segment_end("HEAP"), (void*)0x10004000);
	#else
		rt_system_heap_init((void*)&__bss_end, (void*)0x10004000);
	#endif
#endif

	/* initialize scheduler system */
	rt_system_scheduler_init();

	/* initialize application */
	rt_application_init();
    
	/* initialize timer */
    rt_system_timer_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 ;
}
Beispiel #13
0
/**
 * This function will initial NUC472 board.
 */
void rt_hw_board_init(void)
{
    clock_init();

#ifdef RT_USING_HEAP
#ifdef __CC_ARM
    rt_system_heap_init((void*)&Image$$RW_IRAM1$$ZI$$Limit, (void*)SRAM_END);
#elif __ICCARM__
    rt_system_heap_init(__segment_end("HEAP"), (void*)SRAM_END);
#else
    /* init memory system */
    rt_system_heap_init((void*)&__bss_end, (void*)SRAM_END);
#endif
#endif /* RT_USING_HEAP */

    rt_hw_usart_init();

    rt_console_set_device(RT_CONSOLE_DEVICE_NAME);

    SysTick_Config(SystemCoreClock / RT_TICK_PER_SECOND);
}
Beispiel #14
0
static  void  AppSemCreate (void)
{
    OS_ERR  error = OS_ERR_NONE;

    struct OSSemCreate_Arg* sem_find;
    struct OSSemCreate_Arg* sem_end;

    sem_find = __segment_begin("APP_SEM_DEFINE");
    sem_end = __segment_end("APP_SEM_DEFINE");

    for(; sem_find < sem_end; sem_find ++)
    {
        OSSemCreate  ((OS_SEM      *)sem_find->p_sem,
                      (CPU_CHAR    *)sem_find->p_name,
                      (OS_SEM_CTR   )sem_find->cnt,
                      (OS_ERR      *)&error);

        if(error != OS_ERR_NONE)
        {
            goto ERROR_HANDLE;
        }

    }

    return;


    ERROR_HANDLE:

    switch(error)
    {
    case OS_ERR_NONE:
        break;

    default:
        while(1);
        break;

    }
}
Beispiel #15
0
/**
 * This function will startup RT-Thread RTOS.
 */
void rtthread_startup(void)
{
    /* init board */
    rt_hw_board_init();

    /* show version */
    rt_show_version();

#ifdef RT_USING_HEAP
#if STM32_EXT_SRAM
    rt_system_heap_init((void*)STM32_EXT_SRAM_BEGIN, (void*)STM32_EXT_SRAM_END);
#else
#ifdef __CC_ARM
    rt_system_heap_init((void*)&Image$$RW_IRAM1$$ZI$$Limit, (void*)STM32_SRAM_END);
#elif __ICCARM__
    //初始化系统堆空间(除去编译时分配的全局变量、静态局部变量外的其他剩余内存被设置为系统堆空间,被系统管理起来)
    rt_system_heap_init(__segment_end("HEAP"), (void*)STM32_SRAM_END);
#else
    /* init memory system */
    rt_system_heap_init((void*)&__bss_end, (void*)STM32_SRAM_END);
#endif
#endif  /* STM32_EXT_SRAM */
#endif /* RT_USING_HEAP */

    rt_system_scheduler_init();//系统调度器初始化

    rt_system_timer_init();//系统定时器初始化

    rt_system_timer_thread_init();//系统软件定时器线程初始化
    
    rt_application_init();//应用程序初始化
       
    rt_thread_idle_init();//初始化空闲线程

    rt_system_scheduler_start();//开始线程调度此后便进入各个线程的无限循环

    /* never reach here */
    return ;
}
Beispiel #16
0
/**
 * This function will startup RT-Thread RTOS.
 */
void rtthread_startup(void)
{
    /* init board */
    rt_hw_board_init();

    /* show version */
    rt_show_version();

#ifdef RT_USING_HEAP
#ifdef __CC_ARM
    rt_system_heap_init((void*)&Image$$RW_IRAM1$$ZI$$Limit, (void*)FM3_SRAM_END);
#elif __ICCARM__
    rt_system_heap_init(__segment_end("HEAP"), (void*)FM3_SRAM_END);
#else
    /* init memory system */
    rt_system_heap_init((void*)&__bss_end, (void*)FM3_SRAM_END);
#endif
#endif

    /* init scheduler system */
    rt_system_scheduler_init();

    /* init timer thread */
    rt_system_timer_thread_init();

    /* init application */
    rt_application_init();

    /* init idle thread */
    rt_thread_idle_init();

    /* start scheduler */
    rt_system_scheduler_start();

    /* never reach here */
    return ;
}
Beispiel #17
0
/*
 * Low-level initialization routine called during startup, before the main
 * function.
 */
int __low_level_init(void)
{
	#if configHEAP_INIT
		#pragma segment = "HEAP"
		portBASE_TYPE *pxMem;
	#endif

	/* Enable exceptions. */
	ENABLE_ALL_EXCEPTIONS();

	/* Initialize interrupt handling. */
	INTC_init_interrupts();

	#if configHEAP_INIT
	{
		/* Initialize the heap used by malloc. */
		for( pxMem = __segment_begin( "HEAP" ); pxMem < ( portBASE_TYPE * ) __segment_end( "HEAP" ); )
		{
			*pxMem++ = 0xA5A5A5A5;
		}
	}
	#endif

	/* Code section present if and only if the debug trace is activated. */
	#if configDBG
	{
		static const gpio_map_t DBG_USART_GPIO_MAP =
		{
			{ configDBG_USART_RX_PIN, configDBG_USART_RX_FUNCTION },
			{ configDBG_USART_TX_PIN, configDBG_USART_TX_FUNCTION }
		};

		static const usart_options_t DBG_USART_OPTIONS =
		{
			.baudrate = configDBG_USART_BAUDRATE,
			.charlength = 8,
			.paritytype = USART_NO_PARITY,
			.stopbits = USART_1_STOPBIT,
			.channelmode = USART_NORMAL_CHMODE
		};

		/* Initialize the USART used for the debug trace with the configured parameters. */
		extern volatile avr32_usart_t *volatile stdio_usart_base;
		stdio_usart_base = configDBG_USART;
		gpio_enable_module( DBG_USART_GPIO_MAP,
		                    sizeof( DBG_USART_GPIO_MAP ) / sizeof( DBG_USART_GPIO_MAP[0] ) );
		usart_init_rs232(configDBG_USART, &DBG_USART_OPTIONS, configCPU_CLOCK_HZ);
	}
	#endif

	/* Request initialization of data segments. */
	return 1;
}
/*-----------------------------------------------------------*/

/* Added as there is no such function in FreeRTOS. */
void *pvPortRealloc( void *pv, size_t xWantedSize )
{
void *pvReturn;

	vTaskSuspendAll();
	{
		pvReturn = realloc( pv, xWantedSize );
	}
	xTaskResumeAll();

	return pvReturn;
}
Beispiel #18
0
void os_Start()
{

	/* disable interrupt first */
	os_interrupt_Disable();
	/* init tick */
	rt_system_tick_init();
	/* init kernel object */
	rt_system_object_init();
	/* init timer system */
	rt_system_timer_init();
#ifdef RT_USING_HEAP
#if EXTSRAM_ENABLE
	#ifdef __CC_ARM
		rt_system_heap_init((void*)&Image$$RW_RAM1$$ZI$$Limit, (void*)(EXTSRAM_BASE_ADR + EXTSRAM_SIZE));
	#elif __ICCARM__
		rt_system_heap_init(__segment_end("HEAP"), (void*)(EXTSRAM_BASE_ADR + EXTSRAM_SIZE));
	#else
		/* init memory system */
		rt_system_heap_init((void*)&__bss_end, (void*)(EXTSRAM_BASE_ADR + EXTSRAM_SIZE));
	#endif
#else	
	#ifdef __CC_ARM
		rt_system_heap_init((void*)&Image$$RW_IRAM1$$ZI$$Limit, (void*)(MCU_SRAM_BASE_ADR + MCU_SRAM_SIZE));
	#elif __ICCARM__
		rt_system_heap_init(__segment_end("HEAP"), (void*)(MCU_SRAM_BASE_ADR + MCU_SRAM_SIZE));
	#else
		/* init memory system */
		rt_system_heap_init((void*)&__bss_end, (void*)(MCU_SRAM_BASE_ADR + MCU_SRAM_SIZE));
	#endif
#endif
#endif
	/* init scheduler system */
	rt_system_scheduler_init();
	/* init console to support rt_kprintf */
#ifdef RT_USING_CONSOLE
#ifdef RT_USING_DEVICE
	rt_hw_console_init();
#endif
	rt_console_set_device("uart1");
	/* show version */
	rt_show_version();
#endif
#ifdef RT_USING_DEVICE
	/* init hardware serial device */
	rt_device_init_all();
#endif
#ifdef RT_USING_FINSH
	/* init finsh */
	finsh_system_init();
#ifdef RT_USING_DEVICE
	finsh_set_device("uart1");
#endif
#endif
	/* init timer thread */
	rt_system_timer_thread_init();
	/* init idle thread */
	rt_thread_idle_init();
	/* init application */
	os_thd_Create(OsEntry, 200);
	/* start scheduler */
	rt_system_scheduler_start();

}
Beispiel #19
0
/**
 * This function will startup RT-Thread RTOS.
 */
void rtthread_startup(void)
{
	/* 初始化硬件平台相关:时钟设置、中断设置、系统滴答设置、串口设置 */
	rt_hw_board_init();

	/* init tick */
	rt_system_tick_init();

	/* 内核对象初始化 */
	rt_system_object_init();

	/* 系统定时器初始化 */
	rt_system_timer_init();

	/* 如果使用动态内存分配,则配置之 */
#ifdef RT_USING_HEAP
#if STM32_EXT_SRAM
	rt_system_heap_init((void*)STM32_EXT_SRAM_BEGIN, (void*)STM32_EXT_SRAM_END);
#else
	#ifdef __CC_ARM
		rt_system_heap_init((void*)&Image$$RW_IRAM1$$ZI$$Limit, (void*)STM32_SRAM_END);
	#elif __ICCARM__
	    rt_system_heap_init(__segment_end("HEAP"), (void*)STM32_SRAM_END);
	#else
		/* init memory system */
		rt_system_heap_init((void*)&__bss_end, (void*)STM32_SRAM_END);
	#endif
#endif
#endif

	/* 系统调度器初始化 */
	rt_system_scheduler_init();

#ifdef RT_USING_DFS
	/* init sdcard driver */
#if STM32_USE_SDIO
	rt_hw_sdcard_init();
#else
	rt_hw_msd_init();
#endif
#endif

	/*下面可加入用户所需的相关初始化 */

	/*上面可加入用户所需的相关初始化 */


    /* 实时时钟初始化 */
#if(0)
    rt_hw_rtc_init();
#endif

	/* 系统设备对象初始化 */
	rt_device_init_all();

	/* 用户应用初始化 */
	rt_application_init();

#ifdef RT_USING_FINSH
	/* init finsh */
	finsh_system_init();
	finsh_set_device("uart1");
#endif

    /* 初始化软件定时器 */
    rt_system_timer_thread_init();

	/* 初始化空闲线程 */
	rt_thread_idle_init();

	/* 开始线程调度 此后便进入各个线程的无限循环 */
	rt_system_scheduler_start();

	/* never reach here */
	return ;
}
Beispiel #20
0
/***************************************************************************//**
 * @brief
 *  Startup RT-Thread
 *
 * @details
 *
 * @note
 *
 ******************************************************************************/
void rtthread_startup(void)
{
    /* init board */
    rt_hw_board_init();

#ifdef RT_USING_HEAP
    #ifdef __CC_ARM
    rt_system_heap_init((void*)&Image$$RW_IRAM1$$ZI$$Limit, (void*)EFM32_SRAM_END);
    #elif __ICCARM__
    rt_system_heap_init(__segment_end("HEAP"), (void*)EFM32_SRAM_END);
    #else
    /* init memory system */
    rt_system_heap_init((void*)&__bss_end__, (void*)EFM32_SRAM_END);
    #endif
#endif

    /* enable interrupt */
    rt_hw_interrupt_enable(0x0UL);

    /* init drivers */
    rt_hw_driver_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();

    /* init scheduler system */
    rt_system_scheduler_init();

    /* init all devices */
    rt_device_init_all();

    /* init finsh */
#ifdef RT_USING_FINSH
    finsh_system_init();
    finsh_set_device(CONSOLE_DEVICE);
#endif

    /* Initialize gui server */
#ifdef RT_USING_RTGUI
    rtgui_system_server_init();
#endif

    /* init timer thread */
    rt_system_timer_thread_init();

    /* init idle thread */
    rt_thread_idle_init();

    /* init energy mode thread */
    efm32_emu_init();

    /* init application */
    rt_application_init();

    /* start scheduler */
    rt_system_scheduler_start();

    /* never reach here */
    return ;
}
Beispiel #21
0
/**
 * 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
#ifdef __CC_ARM
	rt_system_heap_init((void*)&Image$$RW_IRAM1$$ZI$$Limit, (void*)LM3S_SRAM_END);
#elif __ICCARM__
	rt_system_heap_init(__segment_end("HEAP"), (void*)LM3S_SRAM_END);
#else
	/* init memory system */
	rt_system_heap_init((void*)&__bss_end, (void*)LM3S_SRAM_END);
#endif
#endif

#ifdef RT_USING_MODULE
	/* init module system */
	rt_system_module_init();
#endif

	/* init scheduler system */
	rt_system_scheduler_init();

#ifdef RT_USING_LWIP
	eth_system_device_init();

	/* register ethernetif device */
	rt_hw_luminaryif_init();
#endif

	/* init hardware serial device */
	rt_hw_serial_init();
#ifdef RT_USING_DFS
	/* init sd card device */
	rt_hw_sdcard_init();
#endif

	/* init application */
	rt_application_init();

#ifdef RT_USING_FINSH
	/* init finsh */
	finsh_system_init();
#ifdef RT_USING_DEVICE
	finsh_set_device("uart1");
#endif
#endif

	/* init idle thread */
	rt_thread_idle_init();

	/* start scheduler */
	rt_system_scheduler_start();

	/* never reach here */
	return ;
}
Beispiel #22
0
/**
 * 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
#ifdef __CC_ARM
    rt_system_heap_init((void*)&Image$$RW_IRAM1$$ZI$$Limit, (void*)STM32_SRAM_END);
#elif __ICCARM__
    rt_system_heap_init(__segment_end("HEAP"), (void*)STM32_SRAM_END);
#else
    /* init memory system */
    rt_system_heap_init((void*)&__bss_end, (void*)STM32_SRAM_END);
#endif
#endif

    /* init scheduler system */
    rt_system_scheduler_init();

    /* initialize timer */
    rt_system_timer_init();

    /* init timer thread */
    rt_system_timer_thread_init();

    /* Add CPU usage to system */
    cpu_usage_init();

#ifdef RT_USING_COMPONENTS_INIT
    /* initialization RT-Thread Components */
    rt_components_init();
#endif

#ifdef  RT_USING_FINSH
    /* init finsh */
    finsh_system_init();
    finsh_set_device(RT_CONSOLE_DEVICE_NAME);
#endif

#ifdef RT_USING_COMPONENTS_INIT
    /* initialization RT-Thread Components */
    rt_components_init();
#endif

    /* init application */
    rt_application_init();

    /* init idle thread */
    rt_thread_idle_init();

    /* start scheduler */
    rt_system_scheduler_start();

    /* never reach here */
    return;
}