Пример #1
0
int main()
{
	pFunction Jump_To_Application;
	uint32_t JumpAddress;

	SystemInit();		/* 配置系统时钟为72M */	
	NVIC_Configuration();

	watchdog_init();
	delay_init(72);	//72M
	w25x64_init();

	InitSerial();
	Signel_led_init();
	TIM_init();
	SerialPutString("BootLoader Runing...\n");
	SerialPutString("BootLoader for ");
	SerialPutString(SYSTEM_NAME);
	SerialPutString("\n");
	ymodem();

	iap();
	SerialPutString("Load App!\n");

	TIM_Cmd(TIM2,DISABLE);
	if (((*(__IO uint32_t*)APP_LOCATION) & 0x2FFE0000 ) == 0x20000000)
	{
		JumpAddress = *(__IO uint32_t*) (APP_LOCATION + 4);
		Jump_To_Application = (pFunction) JumpAddress;
		__set_MSP(*(__IO uint32_t*) APP_LOCATION);
		Jump_To_Application();
	}
	return 0;
}
Пример #2
0
/*
 * UserInitializationCallout
 *
 * This function is invoked at the immediate beginning of application
 * initialization. It is the very first function to be executed at system
 * startup.
 * User supplied implementation of this function should be restricted to
 * things like memory initialization, early hardware duties, etc.
 */
void
UserInitializationCalloutf( void )
{
/* Activate this invocation to initialize the example simple TIM.  */
  #if ESCHER_SYS_MAX_XTUML_TIMERS > 0
  TIM_init();
  #endif
  /* Insert implementation specific code here.  */
  SYS_USER_CO_PRINTF( "UserInitializationCallout\n" )
}
Пример #3
0
int main(int argc, char *argv[])
{
  //BOOTLOADER_reset();

  int r;
  __enable_irq();
  //NVIC_SetVectorTable(NVIC_VectTab_FLASH, 0x4000); // make sure that
  // interrupts work
  clock_init(); // hey, you can overclock later here. maybe.



  JSON_init();
  USART_Config();
  TIM_init();

  LCD_Configuration();
  LCD_Initialization();
  LCD_Clear(LCD_Black);

  USART_PutString(HOST_USART,"***** INIT DONE *****\n");

  while(1) {

    r = JSON_render();

    // todo: better error reporting
    if(r == 3) {
      // no free bufs
      continue;
    } else if(r != 0) {
      JSON_init(); // reset buffers in case of errors
      char abuf[32];
      itoa(abuf, r, 10);
      USART_PutString(HOST_USART, abuf);
      USART_PutChar(HOST_USART, 'N');
      USART_PutChar(HOST_USART, '\n');
    }
    //USART1_PutChar('A');
    __asm__("WFI"); // sleep for a bit.
  }
  return 0;
}
Пример #4
0
void
UserInitializationCalloutf( c_t * argv0 )
{
  /* Starting with the argv[0], add the path to the DocBook DTD.
     Also use only forward slashes.  */
  char * continuation;
  i_t i = 0;
  Escher_strcpy( DTD, argv0 );
  continuation = strstr( DTD, "docgen" );
  Escher_strcpy( continuation, "docgen/docbook/docbook-xml-4.5/docbookx.dtd" );
  for ( i = 0; i < 256, 0 != DTD[ i ]; i++ ) {
    DTD[ i ] = ( DTD[ i ] == '\\' ) ? '/' : DTD[ i ];
  }
  /* Activate this invocation to initialize the example simple TIM.  */
  #if ESCHER_SYS_MAX_XTUML_TIMERS > 0
  TIM_init();
  #endif
  /* Insert implementation specific code here.  */
  SYS_USER_CO_PRINTF( "UserInitializationCallout\n" )
}