Hi Hesam Akbarian,
Actually, you can realize the code not modified by configure some items.
If you just want the main function not be modified, please write your code below the comments like:
/* User includes (#include below this line is not maintained by Processor Expert) */
/* Write your local variable definition here */
/* Write your code here */
Then your main code will not be modified even you generate the PE code again.
But if you don't want the CPU.c or component.c not be changed, please do like the following:

Just choose "Don't write generated component modules", the the according code will be lock when you generate the new PE code.
I hope my answer will help you!
If you still have question, please let me know!
Best regards!
Jingjing