I have an application for my ARM7 which is usually burned to FLASH, and then on execution it is copied to RAM (to run a little faster). But I remember that my professor once said that I should run my program from RAM because you can only burn the FLASH that many times. So my question is - is there some special way of burning the program so it can be executed directly from RAM (not by copying from FLASH)? I know I could use some custom bootloader, but that's not an option. I can use SAM-BA loader but to my understanding it is used for flashing the device, it cannot be used to execute any code from RAM, and if it could, is writing directly to RAM possible?
SAM-BA is a boot loader, so if you have samba you really dont need to re-invent another one. Just use it. Jtag usually works as well for being able to load programs into ram and running them. Eventually though I assume your application will need to be run from flash once you turn this into a project/gadget or whatever. not required but assumed. you could wrap your ram version with a small copy to ram program.
I recommend you use sam-ba or whatever to wipe the user flash so that samba doesnt try to load that and to insure the chip is in a known state. Not sure about samba but it is possible that once the bootloader fails to detect a program in flash it might up the clocks or setup peripherals (uart) that it might not have if it had copied flash, so you may still end up in a situation that your tested in ram program works but once you copy it from a flash based program or run it from flash it may not work. some flash cycles may be required to finish testing. or you can make your own bootloader that samba runs and then you are in a known state. My preference is a dumb xmodem thing, bootloader does just enough to setup the uart and start waiting for an xmodem download, then downloads to a known address in ram. then replace the xmodem downloader with the copy to ram and run. that way there are no surprises.