Example #1
0
_start (void)
{
	__initialize_data(&_sidata, &_sdata, &_edata);
	__initialize_bss(&_sbss, &_ebss);
	main();

	for(;;);
}
Example #2
0
_start(void)
{

	// Initialise hardware right after reset, to switch clock to higher
	// frequency and have the rest of the initialisations run faster.
	//
	// Mandatory on platforms like Kinetis, which start with the watch dog
	// enabled and require an early sequence to disable it.
	//
	// Also useful on platform with external RAM, that need to be
	// initialised before filling the BSS section.

	__initialize_hardware_early();

	// Use Old Style DATA and BSS section initialisation,
	// that will manage a single BSS sections.

#if defined(DEBUG) && (OS_INCLUDE_STARTUP_GUARD_CHECKS)
	__data_begin_guard = DATA_GUARD_BAD_VALUE;
	__data_end_guard = DATA_GUARD_BAD_VALUE;
#endif

#if !defined(OS_INCLUDE_STARTUP_INIT_MULTIPLE_RAM_SECTIONS)
	// Copy the DATA segment from Flash to RAM (inlined).
	__initialize_data(&_sidata, &_sdata, &_edata);
#else

	// Copy the data sections from flash to SRAM.
	for (unsigned int* p = &__data_regions_array_start;
			p < &__data_regions_array_end;)
	{
		unsigned int* from = (unsigned int *) (*p++);
		unsigned int* region_begin = (unsigned int *) (*p++);
		unsigned int* region_end = (unsigned int *) (*p++);

		__initialize_data (from, region_begin, region_end);
	}

#endif

#if defined(DEBUG) && (OS_INCLUDE_STARTUP_GUARD_CHECKS)
	if ((__data_begin_guard != DATA_BEGIN_GUARD_VALUE)
			|| (__data_end_guard != DATA_END_GUARD_VALUE))
	{
		for (;;)
			;
	}
#endif

#if defined(DEBUG) && (OS_INCLUDE_STARTUP_GUARD_CHECKS)
	__bss_begin_guard = BSS_GUARD_BAD_VALUE;
	__bss_end_guard = BSS_GUARD_BAD_VALUE;
#endif

#if !defined(OS_INCLUDE_STARTUP_INIT_MULTIPLE_RAM_SECTIONS)
	// Zero fill the BSS section (inlined).
	__initialize_bss(&__bss_start__, &__bss_end__);
#else

	// Zero fill all bss segments
	for (unsigned int *p = &__bss_regions_array_start;
			p < &__bss_regions_array_end;)
	{
		unsigned int* region_begin = (unsigned int*) (*p++);
		unsigned int* region_end = (unsigned int*) (*p++);
		__initialize_bss (region_begin, region_end);
	}
#endif

#if defined(DEBUG) && (OS_INCLUDE_STARTUP_GUARD_CHECKS)
	if ((__bss_begin_guard != 0) || (__bss_end_guard != 0))
	{
		for (;;)
			;
	}
#endif

	// Hook to continue the initialisations. Usually compute and store the
	// clock frequency in the global CMSIS variable, cleared above.
	__initialize_hardware();

	// Get the argc/argv (useful in semihosting configurations).
	int argc;
	char** argv;
	__initialize_args(&argc, &argv);

	// Call the standard library initialisation (mandatory for C++ to
	// execute the constructors for the static objects).
	__run_init_array();

	// Call the main entry point, and save the exit code.
	int code = main(argc, argv);

	// Run the C++ static destructors.
	__run_fini_array();

	_exit(code);

	// Should never reach this, _exit() should have already
	// performed a reset.
	for (;;)
		;
}
Example #3
0
_start(void)
{

  // Use Old Style Data and BSS section initialization,
  // that will initialize a single BSS sections.

#if defined(DEBUG) && defined(OS_INCLUDE_STARTUP_GUARD_CHECKS)
  __bss_begin_guard = BSS_GUARD_BAD_VALUE;
  __bss_end_guard = BSS_GUARD_BAD_VALUE;
#endif

  // Zero fill the bss segment
  __initialize_bss(&__bss_start__, &__bss_end__);

#if defined(DEBUG) && defined(OS_INCLUDE_STARTUP_GUARD_CHECKS)
  if ((__bss_begin_guard != 0) || (__bss_end_guard != 0))
    {
      for (;;)
        ;
    }
#endif

#if defined(DEBUG) && defined(OS_INCLUDE_STARTUP_GUARD_CHECKS)
  __data_begin_guard = DATA_GUARD_BAD_VALUE;
  __data_end_guard = DATA_GUARD_BAD_VALUE;
#endif

  // Copy the data segment from Flash to RAM.
  // When using startup files, this code is executed via the preinit array.
  __initialize_data(&_sidata, &_sdata, &_edata);

#if defined(DEBUG) && defined(OS_INCLUDE_STARTUP_GUARD_CHECKS)
  if ((__data_begin_guard != DATA_BEGIN_GUARD_VALUE) || (__data_end_guard != __data_end_guard))
    {
      for (;;)
        ;
    }
#endif

  __initialize_hardware();

  // Get the args (useful in semihosting configurations).
  int argc;
  char** argv;
  __initialize_args(&argc, &argv);

  // Call the standard library initialisation (mandatory for C++ to
  // execute the constructors for the static objects).
  __run_init_array();

  // Call the main entry point, and save the exit code.
  int code = main(argc, argv);

  // Run the C++ static destructors.
  __run_fini_array();

  _exit(code);

  // Should never reach this, _exit() should have already
  // performed a reset.
  for (;;)
    ;
}