mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-20 05:13:46 -07:00
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:
parent
715d74c5be
commit
1b2c893632
4 changed files with 34 additions and 9 deletions
|
@ -692,9 +692,8 @@ void UsbPacketReceived(BYTE *packet, int len)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppMain(void)
|
void __attribute__((noreturn)) AppMain(void)
|
||||||
{
|
{
|
||||||
memset(BigBuf,0,sizeof(BigBuf));
|
|
||||||
SpinDelay(100);
|
SpinDelay(100);
|
||||||
|
|
||||||
if(common_area.magic != COMMON_AREA_MAGIC || common_area.version != 1) {
|
if(common_area.magic != COMMON_AREA_MAGIC || common_area.version != 1) {
|
||||||
|
|
|
@ -13,7 +13,7 @@ DWORD BigBuf[12000];
|
||||||
|
|
||||||
/// appmain.h
|
/// appmain.h
|
||||||
void ReadMem(int addr);
|
void ReadMem(int addr);
|
||||||
void AppMain(void);
|
void __attribute__((noreturn)) AppMain(void);
|
||||||
void SamyRun(void);
|
void SamyRun(void);
|
||||||
void DbpIntegers(int a, int b, int c);
|
void DbpIntegers(int a, int b, int c);
|
||||||
void DbpString(char *str);
|
void DbpString(char *str);
|
||||||
|
|
|
@ -13,15 +13,26 @@ SECTIONS
|
||||||
*(.eh_frame)
|
*(.eh_frame)
|
||||||
*(.glue_7)
|
*(.glue_7)
|
||||||
*(.glue_7t)
|
*(.glue_7t)
|
||||||
*(.version_information)
|
|
||||||
} >osimage
|
|
||||||
.rodata : {
|
|
||||||
*(.rodata)
|
*(.rodata)
|
||||||
*(.rodata*)
|
*(.rodata*)
|
||||||
|
*(.version_information)
|
||||||
} >osimage
|
} >osimage
|
||||||
.data : { *(.data) } >ram
|
__end_of_text__ = .;
|
||||||
__bss_start__ = .;
|
|
||||||
.bss : { *(.bss) } >ram
|
.data : {
|
||||||
|
__data_start__ = .;
|
||||||
|
__data_src_start__ = __end_of_text__;
|
||||||
|
*(.data)
|
||||||
|
*(.data.*)
|
||||||
|
__data_end__ = .;
|
||||||
|
} >ram AT>osimage
|
||||||
|
|
||||||
|
.bss : {
|
||||||
|
__bss_start__ = .;
|
||||||
|
*(.bss)
|
||||||
|
*(.bss.*)
|
||||||
|
} >ram
|
||||||
|
. = ALIGN(32 / 8);
|
||||||
__bss_end__ = .;
|
__bss_end__ = .;
|
||||||
|
|
||||||
.commonarea (NOLOAD) : {
|
.commonarea (NOLOAD) : {
|
||||||
|
|
|
@ -6,7 +6,22 @@
|
||||||
#include <proxmark3.h>
|
#include <proxmark3.h>
|
||||||
#include "apps.h"
|
#include "apps.h"
|
||||||
|
|
||||||
|
extern char __data_start__, __data_src_start__, __data_end__, __bss_start__, __bss_end__;
|
||||||
void __attribute__((section(".startos"))) Vector(void)
|
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();
|
AppMain();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue