Merge pull request #84 from marshmellow42/master
[legacy-proxmark3.git] / armsrc / start.c
blobd7332bda5682255bb03e4d306e87763d97218a51
1 //-----------------------------------------------------------------------------
2 // Jonathan Westhues, Mar 2006
3 //
4 // This code is licensed to you under the terms of the GNU GPL, version 2 or,
5 // at your option, any later version. See the LICENSE.txt file for the text of
6 // the license.
7 //-----------------------------------------------------------------------------
8 // Just vector to AppMain(). This is in its own file so that I can place it
9 // with the linker script.
10 //-----------------------------------------------------------------------------
12 #include "proxmark3.h"
13 #include "apps.h"
15 extern char __data_start__, __data_src_start__, __data_end__, __bss_start__, __bss_end__;
16 void __attribute__((section(".startos"))) Vector(void)
18 /* Stack should have been set up by the bootloader */
19 char *src, *dst, *end;
21 /* Set up (that is: clear) BSS. */
22 dst = &__bss_start__;
23 end = &__bss_end__;
24 while(dst < end) *dst++ = 0;
26 /* Set up data segment: Copy from flash to ram */
27 src = &__data_src_start__;
28 dst = &__data_start__;
29 end = &__data_end__;
30 while(dst < end) *dst++ = *src++;
32 AppMain();