EmbeddedRelated.com
Forums

Problem using USB/Ethernet SRAM on LPC1768

Started by Simon Posnjak September 13, 2010
Hi all!

I am trying to use the SRAM on LPC1768. I modified the LD script and put
the attribute to the variables that I want to put in to it. Also I enabled the
power to the SRAM, but still it is not working. Am I doing something wrong?

LD script (the important sections):
***************************
...

MEMORY
{
rom (rx) : ORIGIN = 0x00006000, LENGTH = 512K
ram (rwx) : ORIGIN = 0x10000000, LENGTH = 32K

ram1(rwx) : ORIGIN = 0x20000000, LENGTH = 16k
ram2(rwx) : ORIGIN = 0x20004000, LENGTH = 16k
}

...
...

.emem1 :
{
*(.extramem1)
} >ram1 AT>rom

.emem2 :
{
*(.extramem2)
} >ram2 AT>rom

My C file:
********

uint8_t test1[12*1024] __attribute__ ((section (".extramem1")));

int main(void)
{
rd2_bsp_hdr_init();

debug_frmwrk_init();

memset (&test1[0], 0xA5, 1024); <-- HardFault here
_DBG("test1: ");_DBGH_(test1, 256);_DBG_(" ");

return (0);
}
My map file:
***********

.emem1 0x20000000 0x3000 load address 0x000227e0
*(.extramem1)
.extramem1 0x20000000 0x3000 ./src/rd2/rd2.o
0x20000000 test1

Regards Simon

An Engineer's Guide to the LPC2100 Series

Found it! The ram1/ram2 address was off. It should read:

MEMORY
{
rom (rx) : ORIGIN = 0x00006000, LENGTH = 512K
ram (rwx) : ORIGIN = 0x10000000, LENGTH = 32K

ram1(rwx) : ORIGIN = 0x2007C000, LENGTH = 16k
ram2(rwx) : ORIGIN = 0x20080000, LENGTH = 16k
}

Regards Simon

________________________________
From: Simon Posnjak
To: l...
Sent: Mon, September 13, 2010 12:24:38 PM
Subject: Problem using USB/Ethernet SRAM on LPC1768
Hi all!

I am trying to use the SRAM on LPC1768. I modified the LD script and put
the attribute to the variables that I want to put in to it. Also I enabled the
power to the SRAM, but still it is not working. Am I doing something wrong?

LD script (the important sections):
***************************
...

MEMORY
{
rom (rx) : ORIGIN = 0x00006000, LENGTH = 512K
ram (rwx) : ORIGIN = 0x10000000, LENGTH = 32K

ram1(rwx) : ORIGIN = 0x20000000, LENGTH = 16k
ram2(rwx) : ORIGIN = 0x20004000, LENGTH = 16k
}

...
...

.emem1 :
{
*(.extramem1)
} >ram1 AT>rom

.emem2 :
{
*(.extramem2)
} >ram2 AT>rom

My C file:
********

uint8_t test1[12*1024] __attribute__ ((section (".extramem1")));

int main(void)
{
rd2_bsp_hdr_init();

debug_frmwrk_init();

memset (&test1[0], 0xA5, 1024); <-- HardFault here
_DBG("test1: ");_DBGH_(test1, 256);_DBG_(" ");

return (0);
}
My map file:
***********

.emem1 0x20000000 0x3000 load address 0x000227e0
*(.extramem1)
.extramem1 0x20000000 0x3000 ./src/rd2/rd2.o
0x20000000 test1

Regards Simon