Akshay,
Generally, the difference between a program loaded through CCS vs. a program loaded from a boot mode is the GEL file.
There is usually a GEL file associated with your Target Configuration, and when the debugger is logically connected and when a program is loaded, things will run automatically run to initialize parts of the device and/or board.
The solution may be:
1. Remove the GEL script from the Target Configuration, load the program, and see if it works right or works like the Flash does.
2. If the program fails like the boot mode does, then the problem is that there is additional initialization needed. This initialization is being done in the GEL file and needs to be copied into the program so it will be done in the boot process or by the program at the beginning of main().
You may want to go to the Wiki and search for "debugging boot" (no quotes) to find a topic that can help with debugging boot issues.
Regards,
RandyP