}
}
-void AppMain(void)
+void __attribute__((noreturn)) AppMain(void)
{
- memset(BigBuf,0,sizeof(BigBuf));
SpinDelay(100);
if(common_area.magic != COMMON_AREA_MAGIC || common_area.version != 1) {
\r
/// appmain.h\r
void ReadMem(int addr);\r
-void AppMain(void);\r
+void __attribute__((noreturn)) AppMain(void);\r
void SamyRun(void);\r
void DbpIntegers(int a, int b, int c);\r
void DbpString(char *str);\r
*(.eh_frame)\r
*(.glue_7)\r
*(.glue_7t)\r
- *(.version_information)\r
- } >osimage\r
- .rodata : { \r
*(.rodata) \r
*(.rodata*) \r
+ *(.version_information)\r
} >osimage\r
- .data : { *(.data) } >ram\r
- __bss_start__ = .;\r
- .bss : { *(.bss) } >ram\r
+ __end_of_text__ = .;\r
+ \r
+ .data : {\r
+ __data_start__ = .;\r
+ __data_src_start__ = __end_of_text__; \r
+ *(.data)\r
+ *(.data.*)\r
+ __data_end__ = .;\r
+ } >ram AT>osimage\r
+ \r
+ .bss : {\r
+ __bss_start__ = .; \r
+ *(.bss)\r
+ *(.bss.*) \r
+ } >ram\r
+ . = ALIGN(32 / 8);\r
__bss_end__ = .;\r
\r
.commonarea (NOLOAD) : {\r
#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