I need a bit help in bootloader topic. I'm using a Mega328P. My code contains a char variable, e.g.:char letter='c'. I want to refresh this variable throug UART communication, and burn the new variable in the flash. I like to use the bootloader with a condition, for example if PC4 high do not exit bootloader, if low, exit, thus when I power-on the AVR while a jumper attached to PC4 and Vcc, I could program the AVR through UART, if the jumper is not attached while powering-on the AVR, it would jump to my application code.
I read the datasheet of the AVR, AVR109, and almost everything I found on the internet (include avrfreaks too), but I'm still really confused how to do it. Could somebody help me with an example code how to solve this (in C language)?