Fix data segement. You may now use stuff like int foo = 1; in global context (as opposed to both int foo = 0; which is bss and const int foo = 1; which is rodata) without having the sky come

crashing down
This commit is contained in:
henryk@ploetzli.ch 2009-09-08 15:40:22 +00:00
commit 1b2c893632
4 changed files with 34 additions and 9 deletions

View file

@ -6,7 +6,22 @@
#include <proxmark3.h>
#include "apps.h"
extern char __data_start__, __data_src_start__, __data_end__, __bss_start__, __bss_end__;
void __attribute__((section(".startos"))) Vector(void)
{
/* Stack should have been set up by the bootloader */
char *src, *dst, *end;
/* Set up (that is: clear) BSS. */
dst = &__bss_start__;
end = &__bss_end__;
while(dst < end) *dst++ = 0;
/* Set up data segment: Copy from flash to ram */
src = &__data_src_start__;
dst = &__data_start__;
end = &__data_end__;
while(dst < end) *dst++ = *src++;
AppMain();
}