EmbeddedRelated.com
Forums
Memfault Beyond the Launch

Running code from Ethernet and USB RAM

Started by "h.belig" January 7, 2009
Did anybody ever run program code from the ethernet or usb RAM of LPC2468?

I am using EA's LPC2486-16 OEM Board and Rowley`s "CrossStudio for ARM".
I modified the flash_placement file and created sections for these 2
16KB RAM areas.
When I start debugging, I reach the subroutine that is placed in that
ram section. I also can do some steps in the routine (assembler
instructions), but then I get an "undef" exception (or an "abort"
exception when I tested with another project).

According to the errata sheet the ethernet ram cannot be used because
of an issue with silicon revision '-'. I have got revision 'B', which
should not have this problem.

Can anybody advice?

Henry

An Engineer's Guide to the LPC2100 Series

Hi,

I suggest you try this simple program. I used an LPC2378 board, not a 2486
(no idea what a 2486 is). 2478? I used the Olimex LPC2478-STK and it's
just fine on that too. Make sure you do indeed have rev. B silicon.

void main(void)
{
void *p;

int i;
typedef void (*void_fn)(void);
unsigned long *ethernet_ram = (unsigned long *)0x7FE00000;

// Run lots of ARM NOPs.
for (i = 0; i < 1024; ++i)
ethernet_ram[i] = 0xE1A00000;
ethernet_ram[i] = 0xE12FFF1E;
((void_fn)ethernet_ram)();

// Run lots of Thumb NOPs.
for (i = 0; i < 1024; ++i)
ethernet_ram[i] = 0x46C046C0;
ethernet_ram[i] = 0x47704770;
((void_fn)((char *)ethernet_ram+1))();

debug_printf("OK!");
}
> -----Original Message-----
> From: l... [mailto:l...] On Behalf
Of
> h.belig
> Sent: 07 January 2009 15:10
> To: l...
> Subject: [lpc2000] Running code from Ethernet and USB RAM
>
> Did anybody ever run program code from the ethernet or usb RAM of LPC2468?
>
> I am using EA's LPC2486-16 OEM Board and Rowley`s "CrossStudio for ARM".
> I modified the flash_placement file and created sections for these 2
> 16KB RAM areas.
> When I start debugging, I reach the subroutine that is placed in that
> ram section. I also can do some steps in the routine (assembler
> instructions), but then I get an "undef" exception (or an "abort"
> exception when I tested with another project).
>
> According to the errata sheet the ethernet ram cannot be used because
> of an issue with silicon revision '-'. I have got revision 'B', which
> should not have this problem.
>
> Can anybody advice?
>
> Henry
>
--- In l..., "Paul Curtis" wrote:
>
> Hi,
>
> I suggest you try this simple program. I used an LPC2378 board, not
a 2486
> (no idea what a 2486 is). 2478? I used the Olimex LPC2478-STK and it's
> just fine on that too. Make sure you do indeed have rev. B silicon.
>
> void main(void)
> {
> void *p;
>
> int i;
> typedef void (*void_fn)(void);
> unsigned long *ethernet_ram = (unsigned long *)0x7FE00000;
>
> // Run lots of ARM NOPs.
> for (i = 0; i < 1024; ++i)
> ethernet_ram[i] = 0xE1A00000;
> ethernet_ram[i] = 0xE12FFF1E;
> ((void_fn)ethernet_ram)();
>
> // Run lots of Thumb NOPs.
> for (i = 0; i < 1024; ++i)
> ethernet_ram[i] = 0x46C046C0;
> ethernet_ram[i] = 0x47704770;
> ((void_fn)((char *)ethernet_ram+1))();
>
> debug_printf("OK!");
> }
> > -----Original Message-----
> > From: l... [mailto:l...] On
Behalf
> Of
> > h.belig
> > Sent: 07 January 2009 15:10
> > To: l...
> > Subject: [lpc2000] Running code from Ethernet and USB RAM
> >
> > Did anybody ever run program code from the ethernet or usb RAM of
LPC2468?
> >
> > I am using EA's LPC2486-16 OEM Board and Rowley`s "CrossStudio for
ARM".
> > I modified the flash_placement file and created sections for these 2
> > 16KB RAM areas.
> > When I start debugging, I reach the subroutine that is placed in that
> > ram section. I also can do some steps in the routine (assembler
> > instructions), but then I get an "undef" exception (or an "abort"
> > exception when I tested with another project).
> >
> > According to the errata sheet the ethernet ram cannot be used because
> > of an issue with silicon revision '-'. I have got revision 'B', which
> > should not have this problem.
> >
> > Can anybody advice?
> >
> > Henry
> >

Hi Henry,

just for your information. Even if you get the code to run from bith
of the SRAMS, connected to the AHB busses, the code will be MUCH
slower than running from internal Flash or the other 64K SRAM. It
loads through "bus-bridges" to be mirrored into the code space. You
can still gt the benefit of easier debugging using the AHB SRAM but it
is not going to be real-time.
You get 100% speed from the 64k SRAM, >90% from internal Flash
probably around 50% from AHB SRAM and less than that from external
memory.

Bob
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Need a consultant with in depth LPC2000 knowledge? -> Let me know!
http://www.lpc2000.com
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Hi,

As I remember, it is mentionned in an errata sheet of one of the lpc23xx family that the code execution out of the ethernet RAM is not possible.
May be it concerns your chip too.

Kurt

www.synics.ch

To: l...From: l...@yahoo.comDate: Wed, 7 Jan 2009 18:50:21 +0000Subject: [lpc2000] Re: Running code from Ethernet and USB RAM

--- In l..., "Paul Curtis" wrote:>> Hi,> > I suggest you try this simple program. I used an LPC2378 board, nota 2486> (no idea what a 2486 is). 2478? I used the Olimex LPC2478-STK and it's> just fine on that too. Make sure you do indeed have rev. B silicon.> > void main(void)> {> void *p;> > int i;> typedef void (*void_fn)(void);> unsigned long *ethernet_ram = (unsigned long *)0x7FE00000;> > // Run lots of ARM NOPs.> for (i = 0; i < 1024; ++i)> ethernet_ram[i] = 0xE1A00000;> ethernet_ram[i] = 0xE12FFF1E;> ((void_fn)ethernet_ram)();> > // Run lots of Thumb NOPs.> for (i = 0; i < 1024; ++i)> ethernet_ram[i] = 0x46C046C0;> ethernet_ram[i] = 0x47704770;> ((void_fn)((char *)ethernet_ram+1))();> > debug_printf("OK!");> }> > > > -----Original Message-----> > From: l... [mailto:l...] OnBehalf> Of> > h.belig> > Sent: 07 January 2009 15:10> > To: l...> > Subject: [lpc2000] Running code from Ethernet and USB RAM> > > > Did anybody ever run program code from the ethernet or usb RAM ofLPC2468?> > > > I am using EA's LPC2486-16 OEM Board and Rowley`s "CrossStudio forARM".> > I modified the flash_placement file and created sections for these 2> > 16KB RAM areas.> > When I start debugging, I reach the subroutine that is placed in that> > ram section. I also can do some steps in the routine (assembler> > instructions), but then I get an "undef" exception (or an "abort"> > exception when I tested with another project).> > > > According to the errata sheet the ethernet ram cannot be used because> > of an issue with silicon revision '-'. I have got revision 'B', which> > should not have this problem.> > > > Can anybody advice?> > > > Henry> > Hi Henry,just for your information. Even if you get the code to run from bithof the SRAMS, connected to the AHB busses, the code will be MUCHslower than running from internal Flash or the other 64K SRAM. Itloads through "bus-bridges" to be mirrored into the code space. Youcan still gt the benefit of easier debugging using the AHB SRAM but itis not going to be real-time. You get 100% speed from the 64k SRAM, >90% from internal Flashprobably around 50% from AHB SRAM and less than that from externalmemory. Bob-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+Need a consultant with in depth LPC2000 knowledge? -> Let me know!http://www.lpc2000.com-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+


Hello,
and thank you for the replies.

1. Sorry for having caused confusion: The board is LPC2468-16 OEM.
Your program, Paul, behaves as expected. So there should be another
reason.

I created a new projekt with only 1 function to execute in USB RAM.
It is very simple. This is main.c:

typedef unsigned long DWORD;
void CopyMem(DWORD *QuellAdr, DWORD *ZielAdr, DWORD
Length)__attribute__ ((section(".usbfast")));

void CopyMem(DWORD *QuellAdr, DWORD *ZielAdr, DWORD Length) {
DWORD *PtSrc, *PtDest, Len, i;
PtSrc = QuellAdr;
PtDest = ZielAdr;
for (i=0; i < Length; i++) {*PtDest++ = *PtSrc++; }
}

main() {
CopyMem((DWORD *)0x80000000, (DWORD *)0x40000100, 30);

}

Now, when I step through CopyMem(..) in interleave mode (the function
has been loaded to 0x7FD00000), I see this:

void CopyMem(DWORD *QuellAdr, DWORD *ZielAdr, DWORD Length) {
E1A0C00D mov r12, sp
E92DD800 stmfd sp!, {r11-r12, lr-pc}
E24CB004 sub r11, r12, #0x00000004
E24DD01C sub sp, sp, #0x0000001C
E50B0020 str r0, [r11, #-0x020]
E50B1024 str r1, [r11, #-0x024]
E50B2028 str r2, [r11, #-0x028]
DWORD *PtSrc, *PtDest, Len, i;
PtSrc = QuellAdr;

// the following register values are displayed by the debugger
// before the next command is executed:
// r3=0x7fd00000, r11=0x40000840,
// the following command is not executed, instead the 'undef'
// exception is reached
E51B3020 ldr r3, [r11, #-0x020]

I can't understand why it should not be possible to load r3 with the
contents of address 0x40000820. That is internal SRAM.
Does anybody know?
2. Yes, I wanted to see whether the speed of execution would be faster
than in internal flash. That is because there is not enough free SRAM
at 0x40000000 left for me.
Very interesting information!

Henry

--- In l..., "lpc2100_fan" wrote:
>
> --- In l..., "Paul Curtis" wrote:
> >
> > Hi,
> >
> > I suggest you try this simple program. I used an LPC2378 board, not
> a 2486
> > (no idea what a 2486 is). 2478? I used the Olimex LPC2478-STK
and it's
> > just fine on that too. Make sure you do indeed have rev. B silicon.
> >
> > void main(void)
> > {
> > void *p;
> >
> > int i;
> > typedef void (*void_fn)(void);
> > unsigned long *ethernet_ram = (unsigned long *)0x7FE00000;
> >
> > // Run lots of ARM NOPs.
> > for (i = 0; i < 1024; ++i)
> > ethernet_ram[i] = 0xE1A00000;
> > ethernet_ram[i] = 0xE12FFF1E;
> > ((void_fn)ethernet_ram)();
> >
> > // Run lots of Thumb NOPs.
> > for (i = 0; i < 1024; ++i)
> > ethernet_ram[i] = 0x46C046C0;
> > ethernet_ram[i] = 0x47704770;
> > ((void_fn)((char *)ethernet_ram+1))();
> >
> > debug_printf("OK!");
> > }
> >
> >
> > > -----Original Message-----
> > > From: l... [mailto:l...] On
> Behalf
> > Of
> > > h.belig
> > > Sent: 07 January 2009 15:10
> > > To: l...
> > > Subject: [lpc2000] Running code from Ethernet and USB RAM
> > >
> > > Did anybody ever run program code from the ethernet or usb RAM of
> LPC2468?
> > >
> > > I am using EA's LPC2486-16 OEM Board and Rowley`s "CrossStudio for
> ARM".
> > > I modified the flash_placement file and created sections for these 2
> > > 16KB RAM areas.
> > > When I start debugging, I reach the subroutine that is placed in
that
> > > ram section. I also can do some steps in the routine (assembler
> > > instructions), but then I get an "undef" exception (or an "abort"
> > > exception when I tested with another project).
> > >
> > > According to the errata sheet the ethernet ram cannot be used
because
> > > of an issue with silicon revision '-'. I have got revision 'B',
which
> > > should not have this problem.
> > >
> > > Can anybody advice?
> > >
> > > Henry
> > >
>
> Hi Henry,
>
> just for your information. Even if you get the code to run from bith
> of the SRAMS, connected to the AHB busses, the code will be MUCH
> slower than running from internal Flash or the other 64K SRAM. It
> loads through "bus-bridges" to be mirrored into the code space. You
> can still gt the benefit of easier debugging using the AHB SRAM but it
> is not going to be real-time.
> You get 100% speed from the 64k SRAM, >90% from internal Flash
> probably around 50% from AHB SRAM and less than that from external
> memory.
>
> Bob
> -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
> Need a consultant with in depth LPC2000 knowledge? -> Let me know!
> http://www.lpc2000.com
> -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
>

Hi,

I tried this code:

void test_me(void)
{
int i;
typedef void (*void_fn)(void);
register unsigned long *ethernet_ram = (unsigned long *)0x7FE00000;

// Run lots of ARM NOPs.
for (i = 0; i < 1024; ++i)
ethernet_ram[i] = 0xE51B3020; // ldr r3, [r11, -32]
ethernet_ram[i] = 0xE12FFF1E;
__asm volatile (" ldr r11, =0x40000840");
__asm volatile (" ldr r3, =0x7fe00000");
__asm volatile (" bx r3"); // tail-call
}

Works just fine in Ethernet RAM.

--
Paul Curtis, Rowley Associates Ltd http://www.rowley.co.uk
CrossWorks for ARM, MSP430, AVR, MAXQ, and now Cortex-M3 processors
> -----Original Message-----
> From: l... [mailto:l...] On Behalf
Of
> h.belig
> Sent: 08 January 2009 10:43
> To: l...
> Subject: [lpc2000] Re: Running code from Ethernet and USB RAM
>
> Hello,
> and thank you for the replies.
>
> 1. Sorry for having caused confusion: The board is LPC2468-16 OEM.
> Your program, Paul, behaves as expected. So there should be another
> reason.
>
> I created a new projekt with only 1 function to execute in USB RAM.
> It is very simple. This is main.c:
>
> typedef unsigned long DWORD;
> void CopyMem(DWORD *QuellAdr, DWORD *ZielAdr, DWORD
> Length)__attribute__ ((section(".usbfast")));
>
> void CopyMem(DWORD *QuellAdr, DWORD *ZielAdr, DWORD Length) {
> DWORD *PtSrc, *PtDest, Len, i;
> PtSrc = QuellAdr;
> PtDest = ZielAdr;
> for (i=0; i < Length; i++) {*PtDest++ = *PtSrc++; }
> }
>
> main() {
> CopyMem((DWORD *)0x80000000, (DWORD *)0x40000100, 30);
>
> }
>
> Now, when I step through CopyMem(..) in interleave mode (the function
> has been loaded to 0x7FD00000), I see this:
>
> void CopyMem(DWORD *QuellAdr, DWORD *ZielAdr, DWORD Length) {
> E1A0C00D mov r12, sp
> E92DD800 stmfd sp!, {r11-r12, lr-pc}
> E24CB004 sub r11, r12, #0x00000004
> E24DD01C sub sp, sp, #0x0000001C
> E50B0020 str r0, [r11, #-0x020]
> E50B1024 str r1, [r11, #-0x024]
> E50B2028 str r2, [r11, #-0x028]
> DWORD *PtSrc, *PtDest, Len, i;
> PtSrc = QuellAdr;
>
> // the following register values are displayed by the debugger
> // before the next command is executed:
> // r3=0x7fd00000, r11=0x40000840,
>
>
> // the following command is not executed, instead the 'undef'
> // exception is reached
> E51B3020 ldr r3, [r11, #-0x020]
>
> I can't understand why it should not be possible to load r3 with the
> contents of address 0x40000820. That is internal SRAM.
> Does anybody know?
>
>
> 2. Yes, I wanted to see whether the speed of execution would be faster
> than in internal flash. That is because there is not enough free SRAM
> at 0x40000000 left for me.
> Very interesting information!
>
> Henry
>
>
>
>
> --- In l..., "lpc2100_fan" wrote:
> >
> > --- In l..., "Paul Curtis" wrote:
> > >
> > > Hi,
> > >
> > > I suggest you try this simple program. I used an LPC2378 board, not
> > a 2486
> > > (no idea what a 2486 is). 2478? I used the Olimex LPC2478-STK
> and it's
> > > just fine on that too. Make sure you do indeed have rev. B silicon.
> > >
> > > void main(void)
> > > {
> > > void *p;
> > >
> > > int i;
> > > typedef void (*void_fn)(void);
> > > unsigned long *ethernet_ram = (unsigned long *)0x7FE00000;
> > >
> > > // Run lots of ARM NOPs.
> > > for (i = 0; i < 1024; ++i)
> > > ethernet_ram[i] = 0xE1A00000;
> > > ethernet_ram[i] = 0xE12FFF1E;
> > > ((void_fn)ethernet_ram)();
> > >
> > > // Run lots of Thumb NOPs.
> > > for (i = 0; i < 1024; ++i)
> > > ethernet_ram[i] = 0x46C046C0;
> > > ethernet_ram[i] = 0x47704770;
> > > ((void_fn)((char *)ethernet_ram+1))();
> > >
> > > debug_printf("OK!");
> > > }
> > >
> > >
> > > > -----Original Message-----
> > > > From: l... [mailto:l...] On
> > Behalf
> > > Of
> > > > h.belig
> > > > Sent: 07 January 2009 15:10
> > > > To: l...
> > > > Subject: [lpc2000] Running code from Ethernet and USB RAM
> > > >
> > > > Did anybody ever run program code from the ethernet or usb RAM of
> > LPC2468?
> > > >
> > > > I am using EA's LPC2486-16 OEM Board and Rowley`s "CrossStudio for
> > ARM".
> > > > I modified the flash_placement file and created sections for these 2
> > > > 16KB RAM areas.
> > > > When I start debugging, I reach the subroutine that is placed in
> that
> > > > ram section. I also can do some steps in the routine (assembler
> > > > instructions), but then I get an "undef" exception (or an "abort"
> > > > exception when I tested with another project).
> > > >
> > > > According to the errata sheet the ethernet ram cannot be used
> because
> > > > of an issue with silicon revision '-'. I have got revision 'B',
> which
> > > > should not have this problem.
> > > >
> > > > Can anybody advice?
> > > >
> > > > Henry
> > > >
> >
> > Hi Henry,
> >
> > just for your information. Even if you get the code to run from bith
> > of the SRAMS, connected to the AHB busses, the code will be MUCH
> > slower than running from internal Flash or the other 64K SRAM. It
> > loads through "bus-bridges" to be mirrored into the code space. You
> > can still gt the benefit of easier debugging using the AHB SRAM but it
> > is not going to be real-time.
> > You get 100% speed from the 64k SRAM, >90% from internal Flash
> > probably around 50% from AHB SRAM and less than that from external
> > memory.
> >
> > Bob
> > -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
> > Need a consultant with in depth LPC2000 knowledge? -> Let me know!
> > http://www.lpc2000.com
> > -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
> >
>
>
>
>
>
>
Hello Paul,

thank you for the program.

I invoked both subroutines one after another. Your program is ok, mine
is not.

When I renamed my function from CopyMem to CopyMem1 everything was ok.
I have no idea why that solved the problem and how such issues can be
avoided. Is there a list of forbidden function names?
Does anybody has an explanation?

Henry

--- In l..., "lpc2100_fan" wrote:
>
> --- In l..., "Paul Curtis" wrote:
> >
> > Hi,
> >
> > I suggest you try this simple program. I used an LPC2378 board, not
> a 2486
> > (no idea what a 2486 is). 2478? I used the Olimex LPC2478-STK
and it's
> > just fine on that too. Make sure you do indeed have rev. B silicon.
> >
> > void main(void)
> > {
> > void *p;
> >
> > int i;
> > typedef void (*void_fn)(void);
> > unsigned long *ethernet_ram = (unsigned long *)0x7FE00000;
> >
> > // Run lots of ARM NOPs.
> > for (i = 0; i < 1024; ++i)
> > ethernet_ram[i] = 0xE1A00000;
> > ethernet_ram[i] = 0xE12FFF1E;
> > ((void_fn)ethernet_ram)();
> >
> > // Run lots of Thumb NOPs.
> > for (i = 0; i < 1024; ++i)
> > ethernet_ram[i] = 0x46C046C0;
> > ethernet_ram[i] = 0x47704770;
> > ((void_fn)((char *)ethernet_ram+1))();
> >
> > debug_printf("OK!");
> > }
> >
> >
> > > -----Original Message-----
> > > From: l... [mailto:l...] On
> Behalf
> > Of
> > > h.belig
> > > Sent: 07 January 2009 15:10
> > > To: l...
> > > Subject: [lpc2000] Running code from Ethernet and USB RAM
> > >
> > > Did anybody ever run program code from the ethernet or usb RAM of
> LPC2468?
> > >
> > > I am using EA's LPC2486-16 OEM Board and Rowley`s "CrossStudio for
> ARM".
> > > I modified the flash_placement file and created sections for these 2
> > > 16KB RAM areas.
> > > When I start debugging, I reach the subroutine that is placed in
that
> > > ram section. I also can do some steps in the routine (assembler
> > > instructions), but then I get an "undef" exception (or an "abort"
> > > exception when I tested with another project).
> > >
> > > According to the errata sheet the ethernet ram cannot be used
because
> > > of an issue with silicon revision '-'. I have got revision 'B',
which
> > > should not have this problem.
> > >
> > > Can anybody advice?
> > >
> > > Henry
> > > Hi Henry,
>
> just for your information. Even if you get the code to run from bith
> of the SRAMS, connected to the AHB busses, the code will be MUCH
> slower than running from internal Flash or the other 64K SRAM. It
> loads through "bus-bridges" to be mirrored into the code space. You
> can still gt the benefit of easier debugging using the AHB SRAM but it
> is not going to be real-time.
> You get 100% speed from the 64k SRAM, >90% from internal Flash
> probably around 50% from AHB SRAM and less than that from external
> memory.
>
> Bob
> -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
> Need a consultant with in depth LPC2000 knowledge? -> Let me know!
> http://www.lpc2000.com
> -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
>

Please ignore my last posting. That was overhasty.
I had forgotten to rename the line that assigns the section.
As a result CopyMem has been executed in internal flash.

So the problem still exists:
test_me() is fine, but CopyMem() is not.
Once again, this is main.c, this time with both functions:

typedef unsigned long DWORD;
void CopyMem2(DWORD *QuellAdr, DWORD *ZielAdr, DWORD Length)
__attribute__ ((section(".usbfast")));
void CopyMem2(DWORD *QuellAdr, DWORD *ZielAdr, DWORD Length) {
DWORD *PtSrc, *PtDest, Len, i;
PtSrc = QuellAdr;
PtDest = ZielAdr;
for (i=0; i < Length; i++) {
*PtDest++ = *PtSrc++;
}
}

void test_me(void) {
int i;
typedef void (*void_fn)(void);
register unsigned long *ethernet_ram=(unsigned long*)0x7fe00000;

// Run lots of ARM NOPs
for (i=0;i<1024;++i) ethernet_ram[i]=0xE51B3020; // ldr r3,[r11,-32]
ethernet_ram[i]=0xE12FFF1E;
__asm volatile (" ldr r11,=0x40000840");
__asm volatile (" ldr r3,=0x7fe00000");
__asm volatile (" bx r3"); // tail call
}

main() {
test_me();
CopyMem2((DWORD *)0x80000000, (DWORD *)0x40000100, 30);
}

Does anybody have an idea?

--- In l..., "h.belig" wrote:
>
> Hello Paul,
>
> thank you for the program.
>
> I invoked both subroutines one after another. Your program is ok, mine
> is not.
>
> When I renamed my function from CopyMem to CopyMem1 everything was ok.
> I have no idea why that solved the problem and how such issues can be
> avoided. Is there a list of forbidden function names?
> Does anybody has an explanation?
>
> Henry
>
> --- In l..., "lpc2100_fan" wrote:
> >
> > --- In l..., "Paul Curtis" wrote:
> > >
> > > Hi,
> > >
> > > I suggest you try this simple program. I used an LPC2378 board, not
> > a 2486
> > > (no idea what a 2486 is). 2478? I used the Olimex LPC2478-STK
> and it's
> > > just fine on that too. Make sure you do indeed have rev. B silicon.
> > >
> > > void main(void)
> > > {
> > > void *p;
> > >
> > > int i;
> > > typedef void (*void_fn)(void);
> > > unsigned long *ethernet_ram = (unsigned long *)0x7FE00000;
> > >
> > > // Run lots of ARM NOPs.
> > > for (i = 0; i < 1024; ++i)
> > > ethernet_ram[i] = 0xE1A00000;
> > > ethernet_ram[i] = 0xE12FFF1E;
> > > ((void_fn)ethernet_ram)();
> > >
> > > // Run lots of Thumb NOPs.
> > > for (i = 0; i < 1024; ++i)
> > > ethernet_ram[i] = 0x46C046C0;
> > > ethernet_ram[i] = 0x47704770;
> > > ((void_fn)((char *)ethernet_ram+1))();
> > >
> > > debug_printf("OK!");
> > > }
> > >
> > >
> > > > -----Original Message-----
> > > > From: l... [mailto:l...] On
> > Behalf
> > > Of
> > > > h.belig
> > > > Sent: 07 January 2009 15:10
> > > > To: l...
> > > > Subject: [lpc2000] Running code from Ethernet and USB RAM
> > > >
> > > > Did anybody ever run program code from the ethernet or usb RAM of
> > LPC2468?
> > > >
> > > > I am using EA's LPC2486-16 OEM Board and Rowley`s "CrossStudio for
> > ARM".
> > > > I modified the flash_placement file and created sections for
these 2
> > > > 16KB RAM areas.
> > > > When I start debugging, I reach the subroutine that is placed in
> that
> > > > ram section. I also can do some steps in the routine (assembler
> > > > instructions), but then I get an "undef" exception (or an "abort"
> > > > exception when I tested with another project).
> > > >
> > > > According to the errata sheet the ethernet ram cannot be used
> because
> > > > of an issue with silicon revision '-'. I have got revision 'B',
> which
> > > > should not have this problem.
> > > >
> > > > Can anybody advice?
> > > >
> > > > Henry
> > > >
> >
> > Hi Henry,
> >
> > just for your information. Even if you get the code to run from bith
> > of the SRAMS, connected to the AHB busses, the code will be MUCH
> > slower than running from internal Flash or the other 64K SRAM. It
> > loads through "bus-bridges" to be mirrored into the code space. You
> > can still gt the benefit of easier debugging using the AHB SRAM but it
> > is not going to be real-time.
> > You get 100% speed from the 64k SRAM, >90% from internal Flash
> > probably around 50% from AHB SRAM and less than that from external
> > memory.
> >
> > Bob
> > -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
> > Need a consultant with in depth LPC2000 knowledge? -> Let me know!
> > http://www.lpc2000.com
> > -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
>
h.belig wrote:
> Does anybody have an idea?

I haven't been following this thread closely, so I don't know if you've
posted your linker script -- is the ".usbfast" section actually in it?
Is it correct?

Also, is the CopyMem2 function placed there in the resulting map file?
(Which I assume you generate during the linker phase?).

Those are the only real differences that I can see, although I usually
place the __attribute__ on the function definition (never tried it with
a declaration -- does it need to be on both?).

Pete

Hello Henry,

have you tried to comment out the content of CopyMem2 ?
Or e.g. do a single access ? Or only a write access ? Or only a read
access ?

You have two addresses, which you access: one is RAM, the other i
don't know, is it a real address, which you can access ?

Can you perhaps copy only a few locations from SRAM to SRAM ?

Regards,

Martin

--- In l..., "h.belig" wrote:
>
> Please ignore my last posting. That was overhasty.
> I had forgotten to rename the line that assigns the section.
> As a result CopyMem has been executed in internal flash.
>
> So the problem still exists:
> test_me() is fine, but CopyMem() is not.
> Once again, this is main.c, this time with both functions:
>
> typedef unsigned long DWORD;
> void CopyMem2(DWORD *QuellAdr, DWORD *ZielAdr, DWORD Length)
> __attribute__ ((section(".usbfast")));
> void CopyMem2(DWORD *QuellAdr, DWORD *ZielAdr, DWORD Length) {
> DWORD *PtSrc, *PtDest, Len, i;
> PtSrc = QuellAdr;
> PtDest = ZielAdr;
> for (i=0; i < Length; i++) {
> *PtDest++ = *PtSrc++;
> }
> }
>
> void test_me(void) {
> int i;
> typedef void (*void_fn)(void);
> register unsigned long *ethernet_ram=(unsigned long*)0x7fe00000;
>
> // Run lots of ARM NOPs
> for (i=0;i<1024;++i) ethernet_ram[i]=0xE51B3020; // ldr r3,[r11,-32]
> ethernet_ram[i]=0xE12FFF1E;
> __asm volatile (" ldr r11,=0x40000840");
> __asm volatile (" ldr r3,=0x7fe00000");
> __asm volatile (" bx r3"); // tail call
> }
>
> main() {
> test_me();
> CopyMem2((DWORD *)0x80000000, (DWORD *)0x40000100, 30);
> }
>
> Does anybody have an idea?
>
> --- In l..., "h.belig" wrote:
> >
> > Hello Paul,
> >
> > thank you for the program.
> >
> > I invoked both subroutines one after another. Your program is ok, mine
> > is not.
> >
> > When I renamed my function from CopyMem to CopyMem1 everything was ok.
> > I have no idea why that solved the problem and how such issues can be
> > avoided. Is there a list of forbidden function names?
> > Does anybody has an explanation?
> >
> > Henry
> >
> >
> >
> >
> >
> > --- In l..., "lpc2100_fan" wrote:
> > >
> > > --- In l..., "Paul Curtis" wrote:
> > > >
> > > > Hi,
> > > >
> > > > I suggest you try this simple program. I used an LPC2378
board, not
> > > a 2486
> > > > (no idea what a 2486 is). 2478? I used the Olimex LPC2478-STK
> > and it's
> > > > just fine on that too. Make sure you do indeed have rev. B
silicon.
> > > >
> > > > void main(void)
> > > > {
> > > > void *p;
> > > >
> > > > int i;
> > > > typedef void (*void_fn)(void);
> > > > unsigned long *ethernet_ram = (unsigned long *)0x7FE00000;
> > > >
> > > > // Run lots of ARM NOPs.
> > > > for (i = 0; i < 1024; ++i)
> > > > ethernet_ram[i] = 0xE1A00000;
> > > > ethernet_ram[i] = 0xE12FFF1E;
> > > > ((void_fn)ethernet_ram)();
> > > >
> > > > // Run lots of Thumb NOPs.
> > > > for (i = 0; i < 1024; ++i)
> > > > ethernet_ram[i] = 0x46C046C0;
> > > > ethernet_ram[i] = 0x47704770;
> > > > ((void_fn)((char *)ethernet_ram+1))();
> > > >
> > > > debug_printf("OK!");
> > > > }
> > > >
> > > >
> > > > > -----Original Message-----
> > > > > From: l...
[mailto:l...] On
> > > Behalf
> > > > Of
> > > > > h.belig
> > > > > Sent: 07 January 2009 15:10
> > > > > To: l...
> > > > > Subject: [lpc2000] Running code from Ethernet and USB RAM
> > > > >
> > > > > Did anybody ever run program code from the ethernet or usb
RAM of
> > > LPC2468?
> > > > >
> > > > > I am using EA's LPC2486-16 OEM Board and Rowley`s
"CrossStudio for
> > > ARM".
> > > > > I modified the flash_placement file and created sections for
> these 2
> > > > > 16KB RAM areas.
> > > > > When I start debugging, I reach the subroutine that is placed in
> > that
> > > > > ram section. I also can do some steps in the routine (assembler
> > > > > instructions), but then I get an "undef" exception (or an
"abort"
> > > > > exception when I tested with another project).
> > > > >
> > > > > According to the errata sheet the ethernet ram cannot be used
> > because
> > > > > of an issue with silicon revision '-'. I have got revision 'B',
> > which
> > > > > should not have this problem.
> > > > >
> > > > > Can anybody advice?
> > > > >
> > > > > Henry
> > > > >
> > >
> > > Hi Henry,
> > >
> > > just for your information. Even if you get the code to run from bith
> > > of the SRAMS, connected to the AHB busses, the code will be MUCH
> > > slower than running from internal Flash or the other 64K SRAM. It
> > > loads through "bus-bridges" to be mirrored into the code space. You
> > > can still gt the benefit of easier debugging using the AHB SRAM
but it
> > > is not going to be real-time.
> > > You get 100% speed from the 64k SRAM, >90% from internal Flash
> > > probably around 50% from AHB SRAM and less than that from external
> > > memory.
> > >
> > > Bob
> > > -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
> > > Need a consultant with in depth LPC2000 knowledge? -> Let me know!
> > > http://www.lpc2000.com
> > > -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
> > >
>

Memfault Beyond the Launch