]> cvs.zerfleddert.de Git - proxmark3-svn/blobdiff - armsrc/start.c
Create a stamp file for download completion so that it won't have to be redone later
[proxmark3-svn] / armsrc / start.c
index de2dd2f639c3e0d8c8cf86c963f6a9583c3729d8..0466a92fdb28eef430e0d26805f2471a4afb2eee 100644 (file)
@@ -6,7 +6,22 @@
 #include <proxmark3.h>\r
 #include "apps.h"\r
 \r
+extern char __data_start__, __data_src_start__,  __data_end__, __bss_start__, __bss_end__;\r
 void __attribute__((section(".startos"))) Vector(void)\r
 {\r
+       /* Stack should have been set up by the bootloader */\r
+       char *src, *dst, *end;\r
+       \r
+       /* Set up (that is: clear) BSS. */\r
+       dst = &__bss_start__;\r
+       end = &__bss_end__;\r
+       while(dst < end) *dst++ = 0;\r
+       \r
+       /* Set up data segment: Copy from flash to ram */\r
+       src = &__data_src_start__;\r
+       dst = &__data_start__;\r
+       end = &__data_end__;\r
+       while(dst < end) *dst++ = *src++;\r
+       \r
        AppMain();\r
 }\r
Impressum, Datenschutz