Run code from Ram lpc4350 Hitex eval board

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Run code from Ram lpc4350 Hitex eval board

390 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Meyer on Fri Sep 13 01:34:44 MST 2013
Hi LpcTeam,

I have problems running my code from internal Ram. I have made changes in the linker script:

INCLUDE "lib.ld"
INCLUDE "4350_mem_Ram.ld"

ENTRY(ResetISR)

SECTIONS
{

/* MAIN TEXT SECTION */
.text : ALIGN(4)
{
FILL(0xff)
KEEP(*(.isr_vector))

/* Global Section Table */
. = ALIGN(4) ;
__section_table_start = .;
__data_section_table = .;
LONG(LOADADDR(.data));
LONG(    ADDR(.data)) ;
LONG(  SIZEOF(.data));
LONG(LOADADDR(.data_RAM2));
LONG(    ADDR(.data_RAM2)) ;
LONG(  SIZEOF(.data_RAM2));
LONG(LOADADDR(.data_RAM3));
LONG(    ADDR(.data_RAM3)) ;
LONG(  SIZEOF(.data_RAM3));
LONG(LOADADDR(.data_RAM4));
LONG(    ADDR(.data_RAM4)) ;
LONG(  SIZEOF(.data_RAM4));
LONG(LOADADDR(.data_RAM5));
LONG(    ADDR(.data_RAM5)) ;
LONG(  SIZEOF(.data_RAM5));
__data_section_table_end = .;
__bss_section_table = .;
LONG(    ADDR(.bss));
LONG(  SIZEOF(.bss));
LONG(    ADDR(.bss_RAM2));
LONG(  SIZEOF(.bss_RAM2));
LONG(    ADDR(.bss_RAM3));
LONG(  SIZEOF(.bss_RAM3));
LONG(    ADDR(.bss_RAM4));
LONG(  SIZEOF(.bss_RAM4));
LONG(    ADDR(.bss_RAM5));
LONG(  SIZEOF(.bss_RAM5));
__bss_section_table_end = .;
__section_table_end = . ;
/* End of Global Section Table */


*(.after_vectors*)

*(.text*)
*(.rodata .rodata.*)
. = ALIGN(4);

} > RamLoc128

/*
* for exception handling/unwind - some Newlib functions (in common
* with C++ and STDC++) use this.
* Use KEEP so not discarded with --gc-sections
*/
.ARM.extab : ALIGN(4)
{
KEEP(*(.ARM.extab* .gnu.linkonce.armextab.*))
} > RamLoc128
__exidx_start = .;

.ARM.exidx : ALIGN(4)
{
KEEP(*(.ARM.exidx* .gnu.linkonce.armexidx.*))
} > RamLoc128
__exidx_end = .;

_etext = .;


.data_RAM2 : ALIGN(4)
{
   FILL(0xff)
*(.data.$RAM2*)
*(.data.$RamLoc72*)
   . = ALIGN(4) ;
} > RamLoc72 AT>RamLoc128

.data_RAM3 : ALIGN(4)
{
   FILL(0xff)
*(.data.$RAM3*)
*(.data.$RamAHB32*)
   . = ALIGN(4) ;
} > RamAHB32 AT>RamLoc128

.data_RAM4 : ALIGN(4)
{
   FILL(0xff)
*(.data.$RAM4*)
*(.data.$RamAHB16*)
   . = ALIGN(4) ;
} > RamAHB16 AT>RamLoc128

.data_RAM5 : ALIGN(4)
{
   FILL(0xff)
*(.data.$RAM5*)
*(.data.$RamAHB_ETB16*)
   . = ALIGN(4) ;
} > RamAHB_ETB16 AT>RamLoc128

/* MAIN DATA SECTION */

.uninit_RESERVED : ALIGN(4)
{
KEEP(*(.bss.$RESERVED*))
. = ALIGN(4) ;
_end_uninit_RESERVED = .;
} > RamLoc72

.data : ALIGN(4)
{
FILL(0xff)
_data = .;
*(vtable)
*(.data*)
. = ALIGN(4) ;
_edata = .;
} > RamLoc72 AT>RamLoc128


.bss_RAM2 : ALIGN(4)
{
*(.bss.$RAM2*)
*(.bss.$RamLoc72*)
   . = ALIGN(4) ;
} > RamLoc72

.bss_RAM3 : ALIGN(4)
{
*(.bss.$RAM3*)
*(.bss.$RamAHB32*)
   . = ALIGN(4) ;
} > RamAHB32

.bss_RAM4 : ALIGN(4)
{
*(.bss.$RAM4*)
*(.bss.$RamAHB16*)
   . = ALIGN(4) ;
} > RamAHB16

.bss_RAM5 : ALIGN(4)
{
*(.bss.$RAM5*)
*(.bss.$RamAHB_ETB16*)
   . = ALIGN(4) ;
} > RamAHB_ETB16

/* MAIN BSS SECTION */
.bss : ALIGN(4)
{
_bss = .;
*(.bss*)
*(COMMON)
. = ALIGN(4) ;
_ebss = .;
PROVIDE(end = .);
} > RamLoc72

PROVIDE(_pvHeapStart = .);
/* Es kann nicht im externen Sdram platziert werden, weil der Sdram vor der Nutzung initialiersiert werden soll */
PROVIDE(_vStackTop = __top_RamLoc72 - 0);
}
On the debug command I load the code into ram. The code runs but no interrupts. The Isr Vector table must be overwritten by bootloader?

Please help me
Thx
0 Kudos
3 Replies

285 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by bavarian on Mon Sep 30 06:08:04 MST 2013
It is possible to execute a script in LPCXpresso, this script then needs to init the SDRAM before the code (that has been linked to the SDRAM) is loaded.

Look here:  http://www.lpcware.com/content/forum/how-to-debug-code-in-external-sdramlpc1776

The SDRAM init code as µVision script for the Hitex board is attached, I don't have one for LPCXpresso yet.

A relocation of the code from flash to SDRAM is of course also possible. The code to be relocated needs to be linked to SDRAM, please don't forget the reset vector relocation
As soon as you have the code in SDRAM and execute from there, you can do with the external flash whatever you like.

Regards,
NXP Support.
0 Kudos

285 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Meyer on Mon Sep 16 02:59:58 MST 2013
Hi Lpcxpresso-Support,

Although I do not know where the error was, but it works for internal Ram. But if i want to use the external Sdram i got an error. I Guess it is cause the sdram isn´t initialized. Is there a script which init the emc for the sdram? Is there a way to write my own script ? As with Seggers J link? Another possibility would be to execute the code from the flash. I init the emc for the sdram and after that I copy the code from Flash to Sdram. Do I have the option to read/write from flash during code execution?
0 Kudos

285 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Sat Sep 14 05:54:28 MST 2013
Does your code actually map the vector table into RAM? And have you looked at the examples for the Hitex board supplied in LPCXpresso? IIRC some of these are built to run from RAM. There should be no need to modify linker scripts by hand to cope with running from RAM.

And at a general level, I assume that you have read the LPC43 related LPCXpresso FAQs, starting off with...

http://support.code-red-tech.com/CodeRedWiki/LPC1850_4350_Support

If you need more assistance, I suggest that you provide more precise details of what you are doing.

Regards
LPCXpresso Support
0 Kudos