The default SRAM address for the LPC1778 is at address 0x10000000 - 0x1000FFFF.
Is it possible to relocate the SRAM to be used, to address 0x28000000 - 0x28FFFFFF(SPIFI memory mapped access space)under target options in uVision by just specifying the new address for IRAM1?
Note: I wont be using SPIFI.
Its not the code I'm worried about. The code can remain in the Onchip Flash(ROM). Its the stack and the global and static variables that I'm worried about. Since my application is very large, 64Kb for the SRAM may be insufficient as coding process progresses. Since the SPIFI buffer space is unused and is a very large memory region, i can move the SRAM location there.
I ran a test in uVision for 2 cases and simulated the result.I created a global static variable "static U8 test=0", incremented it in 2 different functions f1() and f2() and checked where it was placed in the simulator memory1 window:
Case1: Under target option, IRAM1 is 0x10000000 Result: Variable test was placed @ 0x10000012. f1() variables were placed @ 0x10000010(i.e stack was @ 0x10000000 onwards. Value of variable test was preserved after both function calls.
Case1: Under target option, IRAM1 is 0x28000000 Result: Variable test was placed @ 0x28000000. f1() variables were placed @ 0x28000010(i.e stack was @ 0x28000000 onwards. Value of variable test was preserved after both function calls.
Hence my doubt, as per simulation, its possible to relocate SRAM(location of stack and global,static variables) to a different location.
Note: I just want to relocate where the stack resides and global variables and static variables are stored.
Corrections: Its Case 1 and Case 2 Under Case 2, it is "Variable test was placed @ 0x28000012" not 0x28000000
What I said before still stands:
Just changing the details under the target options isn't going to do anything to tell the processor to relocate it.
To reposition stack and data to another region, you'd be better off customizing the scatter file.
If what your saying holds true. How is Keil allocating the variables to the specified location just by changing them in target options?
How is Keil allocating the variables to the specified location just by changing them in target options?
For the third time I say:
Now, to be sure:
The target options DO NOT CAUSE ANY REMAPPING TO BE DONE BY THE CPU!
And in case you are unsure why I said this, it is because you said in the original post:
Is it possible to relocate the SRAM to be used ...
Are you trying to relocate SRAM? or does the SRAM already exist at that location? I suspect you are confusing the terminology.
Changing details in the target options tells the linker to position code/data in specified regions.
If this is not giving you sufficient control, then you will have to look at the scatter file.
Yes that's what i meant in the "note" part in my reply above. I just want to relocate the stack and variables. I dont want them to be by default be placed on the onchip SRAM. I want to mimic the SRAM at a different location by changing it in the target options.
I want to mimic the SRAM at a different location by changing it in the target options.
You need to get the terminology right.
You're not mimicking SRAM, you're not relocating SRAM. You're just trying to position data and stack at RAM in a specific location different to where it was before.
So long as there is RAM in those locations and it's not being used for any other purpose, then you should simply be able to set the project options to locate those items at those locations.