Link script file

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

Link script file

1,202 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by jubiamathew on Wed Jul 22 03:52:55 MST 2015
We are using LPC3250 processor on a custom board with Mobile DDR connected to DYCS0 (address range 0x8000 0000 to 0x9FFF FFFF). Can you provide a sample linker script file wherein the code and data can be mapped to both internal and external SDRAM.
0 Kudos
15 Replies

988 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by jubiamathew on Wed Jul 22 21:38:45 MST 2015

Quote: TheFallGuy
You don't say whether you are using Managed Linker Scripts, or not.

Then the question of 'whether you are using Managed Linker Scripts' is irrelevant.
We need a sample linker script file where this is done. When we try to use our own linkscripts as explained in FAQ, the program control is not branching to 'main'.
What I want is to place code and data of specific object files in IRAM and SDRAM.



0 Kudos

988 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by jubiamathew on Wed Jul 29 23:59:17 MST 2015
We have written the script and is able to run the code from SDRAM. Thank You very much.
0 Kudos

988 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Fri Jul 24 04:17:50 MST 2015
Yes, you can use the script to setup your external memory controller.

The script is GDB and is documented in the documentation (Help->Help Contents). To setup your controller, you need to place your commands before the ${load} macro. I would recommend using the "source" command, as described below


Some useful GDB commands (to get you started)
source filename.gdb      - read further commands from filename.gdb (I would recommend adding this to the script and placing the script file in your project, making it easy to use the standard editor and share the file amongst multiple projects)

set *address = value      - write value to address. e.g. set *0x40052478 = 0x39
0 Kudos

988 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by jubiamathew on Fri Jul 24 02:53:21 MST 2015
No, we don't need a flash driver. We need to run the code using the debugger wherein the code partially resides in off-chip RAM.
After burning the code to FLASH memory, it has the bootloader which will configure the clock parameters such that the loading to off-chip RAM will be proper.
But while debugging through emulator, where should this initialization code be put.
Is it using 'Edit scripts' option as indicated in the attached screenshot? If so, where is the syntax available for the commands?
0 Kudos

988 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by TheFallGuy on Fri Jul 24 00:17:59 MST 2015
Do you need to write a 'flash driver'?
https://www.lpcware.com/content/faq/lpcxpresso/user-loadable-flash-drivers

However, what is going to happen in your device when it is shipping? If it is a RAM-only device, how are you going to boot it?
0 Kudos

988 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by jubiamathew on Thu Jul 23 21:38:16 MST 2015
It is compiling after changing to '*main.o'.
Needed one more clarification. Where should we have the initialization of processor clock control registers and SDRAM control registers(EMC registers). Shouldn't this happen before loading the executable to the target memory?
0 Kudos

988 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Thu Jul 23 06:25:28 MST 2015
You want to use something like
*foo.o(.text*)


You may also find this useful:
*(EXCLUDE_FILE(*foo.o *bar.o) .text*)

0 Kudos

988 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by jubiamathew on Thu Jul 23 05:41:58 MST 2015
*(.text*) in ld file puts includes complete code. What should be the syntax in ld file to denote code from one file
main.o(.text) is giving error.
0 Kudos

988 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Thu Jul 23 02:08:13 MST 2015
Sorry, but I do not know Keil.

I can  help you with advice on how to fix a GNU (LPCXpresso) linker script.

GNU Linker scripts are fully described in the documentation (Help->Help contents). You can use one generated by the Managed Linker Script as a starting point.
0 Kudos

988 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by jubiamathew on Thu Jul 23 02:02:20 MST 2015
Attached is the scatter file from Keil uvision for the same project.
Can we get a linker script corresponding to this memory mapping. We are not able to map the sections properly.
The execution is creating undefined exception.
IROM1 starts at 0x00000000 and IROM2 starts at 0x80000000. Both sections contain code and data 
0 Kudos

988 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Wed Jul 22 23:45:47 MST 2015
You can certainly do this with Managed Linker scripts, although it is currently inconvenient (we will shortly be releasing an improvement which greatly simplifies this).

However, if you post your linker script we can provide some advice on where you have gone wrong.
0 Kudos

988 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by jubiamathew on Wed Jul 22 21:39:33 MST 2015
Then the question of 'whether you are using Managed Linker Scripts' is irrelevant.
We need a sample linker script file where this is done. When we try to use our own linkscripts as explained in FAQ, the program control is not branching to 'main'.
What I want is to place code and data of specific object files in IRAM and SDRAM.
0 Kudos

988 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by TheFallGuy on Wed Jul 22 05:44:52 MST 2015
AFAIK, the generated scripts only place code/data in the first flash and/or ram sections, which is why there are macros to tell it to put it in different sections. Also, make sure you define your external memory using the memory editor.
0 Kudos

988 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by jubiamathew on Wed Jul 22 05:30:08 MST 2015
What I understood from these FAQs is that the external SDRAM will not be used with Managed Linker Scripts. Is this correct?
0 Kudos

988 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by TheFallGuy on Wed Jul 22 04:34:11 MST 2015
You don't say whether you are using Managed Linker Scripts, or not. However, these FAQs may give you a clue
https://www.lpcware.com/content/faq/lpcxpresso/coderodata-different-flash-blocks
https://www.lpcware.com/content/faq/lpcxpresso/data-different-ram-blocks
https://www.lpcware.com/content/faq/lpcxpresso/own-linker-scripts

0 Kudos