can we execute the code in ram memory in lpc915...if yes,how?
Do you really mean C251 - or should that be C51?
The 8051 CPU knows nothing about "RAM" - all it knows is its CODE, XDATA, and other address spaces.
An 8051 CPU can only execute from CODE space; if you have RAM in your CODE space, then it will execute from RAM!
But remember that the 8051 architecture has no way to write to CODE space - so you will have to think up some "cunning trick" to get your code into that RAM...
eg, see: www.8052.com/.../182555 (and follow the whole thread).
ok forget the ram memory....suppose i hav a program between the code space 00h-0600h...i need to write a function in between which should start at 0700h..how do i go about it....??
Why do you "need" it to be at that specific address?
Or any specific address?
See the posts in this thread http://www.keil.com/forum/19104/ about "We constanly suffer from people that don't want to describe what problem they have"
www.catb.org/.../smart-questions.html
i hav a program in the code space between 00 to 600h that keeps erasing the flash and reprograms it....i dont want a particular portion of my code to be erased...so i got to put that at a different space,say 700h....how do i go abt it?
In other words, you have a so-called "Bootloader" (or "Boot-loader").
This is a very common arrangement indeed - a bit of searching with those keywords should find you plenty of examples...
no no..i need to know if we can shift the control of the processor from one address location to another within the same source code..
is it ok to use
#pragma asm ORG 0x700h #pragma endasm
???is there anything else i need to specify for the compiler to generate assembler code??
no no.
No ... to what?
shift the control of the processor from one address location to another within the same source code..
Of course you can. That's exactly what happens every time you call another function.
Look, man, it's becoming painfully evident that you're desperately trying to achieve something. But nobody can help you if you just keep throwing random crumbs of jumbled information about that goal around, without letting anyone get a glimpse of the whole picture.
The stuff you've said so far makes little to no sense at all. So you really need to step back, relax, and start telling the story from the beginning.
Hi,
according to what i understood i think u want to copy some specific code from ROM to RAM area and execute from there right ?
If that's the case I think 1st you got to copy the code from ROM to RAM, have a function pointer pointing to the RAM location (eg 0x700 ) and call the function pointer.
For doing the above things its better if you have the code to be copied from ROM inside a function.
Then make the following modifications in the linker file. 1. Assign a (ROM) address for this function in the linker file. 2. Reserve some RAM location starting from the 0x700 (based on the example, but could be any RAM address) for copying the ROM code. Note the reserved RAM memory must to enough to store the entire function.
Hope this helps Do correct me if I am wrong.
the only way to execute from RAM in a '51 is by negative ORing !PSEN and !RD. This can only be done with external memory the lpc915 can not access external memory
Erik
You are wrong!
"according to what i understood i think u want to copy some specific code from ROM to RAM"
Look again - he abandoned that idea after the very first reply (in his second post):
On 17-Jun-2011 at 13:54, erkk wan Posted: "ok forget the ram memory"
"If that's the case I think 1st you got to copy the code from ROM to RAM"
Again, please re-read my first reply carefully: This has nothing to do with RAM or ROM - it's a matter of CODE and XDATA memory spaces.
Not the only method - some variants have specific means for remapping XDATA to CODE space...
My apologies. Thanks from Correcting :)