--- /dev/null
+/*****************************************************************
+ * Program starts here.
+ * overwriting this label in the user program
+ * causes removing all startup code except __do_global_ctors
+ *****************************************************************/
+ .section .init0, "ax", @progbits
+ .weak _reset_vector__
+ .func _reset_vector__
+
+ .p2align 1,0
+_reset_vector__:
+
+; stack can be initialized in main() prologue,
+; but setting stack pointer here allows to call subroutines
+; from startup code and call constructors of statically allocated C++ objects.
+; Stack pointer will have the same value entering main() as here,
+; so -mno-stack-init can be used to reduce code size.
+; initial stack value can be set in ld script as __stack symbol
+; (end of RAM by default), or via -defsym __stack=<address> ld option
+; or via -Wl,defsym,__stack=<address> gcc option, or by redefining
+; __init_stack function as fololws:
+;
+;#if defined (__cplusplus)
+;extern "C"
+;#endif
+;__attribute__((__naked__)) __attribute__((section(".init2"))) void __init_stack()
+;{
+; asm volatile("\tmov\t#stack_addr, r1\n");
+;}
+;
+ /* request following functions to be linked if library _reset_vector__ used */
+
+ .global __init_stack
+
+ .global __low_level_init
+ .global __do_copy_data
+ .global __do_clear_bss
+ .global __jump_to_main
+
+ .endfunc