> Actually i cannot boot from boat loader,
It doesn't matter. I'm saying ANY code you load and run under a debugger can't do lots of things that will upset the debugger. So you can't do them then. You can only do them on code loaded into FLASH and run from there, later in your product development.
> it has to be done using debugger. Is there any reference for this?
You seem to be doing it already. What do you want to know - specifically?
For more examples of coding, just read every Freescale App Note, and download every sample project you can find. I haven't found anything more organized than that, but then I've never used Code Warrior either. That should come with some sort of example platform layer, loaders, drivers and so on.
Tom