]> git.zerfleddert.de Git - proxmark3-svn/commitdiff
Add a ramfunc section in the data segment, which will be copied to ram on startup.
authorhenryk@ploetzli.ch <henryk@ploetzli.ch@ef4ab9da-24cd-11de-8aaa-f3a34680c41f>
Fri, 8 Oct 2010 10:23:04 +0000 (10:23 +0000)
committerhenryk@ploetzli.ch <henryk@ploetzli.ch@ef4ab9da-24cd-11de-8aaa-f3a34680c41f>
Fri, 8 Oct 2010 10:23:04 +0000 (10:23 +0000)
Add a RAMFUNC function attribute to have functions copied to and run from ram.
Fix "blew circular buffer" error in hf 14a snoop by executing SnoopIso14443a from ram (eats about 3.5k of ram)

armsrc/apps.h
armsrc/iso14443a.c
armsrc/ldscript

index c3d3bae12414468442534877245958525d1ed332..5ecd1753c8cf8a2c390456c23b41a4e3ae4c0f33 100644 (file)
@@ -20,6 +20,10 @@ typedef unsigned char byte_t;
 // maybe processed in some way.
 uint32_t BigBuf[8000];
 
+// This may be used (sparingly) to declare a function to be copied to
+// and executed from RAM
+#define RAMFUNC __attribute((long_call, section(".ramfunc")))
+
 /// appmain.h
 void ReadMem(int addr);
 void __attribute__((noreturn)) AppMain(void);
@@ -97,7 +101,7 @@ void ReadSTMemoryIso14443(uint32_t parameter,uint32_t dwLast);
 void SnoopIso14443(void);
 
 /// iso14443a.h
-void SnoopIso14443a(void);
+void RAMFUNC SnoopIso14443a(void);
 void SimulateIso14443aTag(int tagType, int TagUid);    // ## simulate iso14443a tag
 void ReaderIso14443a(UsbCommand * c, UsbCommand * ack);
 void ReaderMifare(uint32_t parameter);
index c3f6647b4a52559d432c4dcb4664039482a56a5e..dd0f2689acb37351e7cf4d043552df95270e97b7 100644 (file)
@@ -146,7 +146,7 @@ static struct {
     uint8_t   *output;
 } Uart;
 
-static int MillerDecoding(int bit)
+static RAMFUNC int MillerDecoding(int bit)
 {
        int error = 0;
        int bitright;
@@ -410,7 +410,7 @@ static struct {
     uint8_t   *output;
 } Demod;
 
-static int ManchesterDecoding(int v)
+static RAMFUNC int ManchesterDecoding(int v)
 {
        int bit;
        int modulation;
@@ -607,7 +607,7 @@ static int ManchesterDecoding(int v)
 // triggering so that we start recording at the point that the tag is moved
 // near the reader.
 //-----------------------------------------------------------------------------
-void SnoopIso14443a(void)
+void RAMFUNC SnoopIso14443a(void)
 {
 //     #define RECV_CMD_OFFSET         2032    // original (working as of 21/2/09) values
 //     #define RECV_RES_OFFSET         2096    // original (working as of 21/2/09) values
index 70be53b5436053d667ce4d7b13d249b4f4c5fac9..dcb04bf0983d569ee1a21754a9c66237b2e76634 100644 (file)
@@ -47,6 +47,7 @@ SECTIONS
        .data : {
                *(.data)
                *(.data.*)
+               *(.ramfunc)
                . = ALIGN(4);
        } >ram AT>osimage :data
 
Impressum, Datenschutz