I'm trying to learn how to write an I2C slave bootloader for Attiny85. What I have so far is a small C test program based on USI TWI Slave by Don Blake that works when it is flashed from address 0. It only blinks a LED to show that it is running and communicates with an I2C master answering to a few "custom commands". If I flash it in a higher memory location with, for example "--section-start = .text = 1800", it starts blinking (it was a surprise for me the first time), but it hangs up as soon as it is "polled" by the I2C master.
I would need to know what the basic steps are, and how they are done to get me started on this. While I have had some experience with Z80 asm in the past, I would prefer to do this completely in C, if possible.
What (I think) I know so far is that the memory gets filled with 0xFF from the beginning and up to position 1800, so the AVR is simply wasting time with NOPs until it reaches the beginning of the code (it took me a while to discover this, that's why my surprise when the program simply started blinking at the high address without first redirecting the reset vector).
I also understand that the next step would be to make that the interruption vectors used by TWI Slave (USI start & overflow) point to their corresponding ISRs.
If these two assumptions are correct, how do I do that? What is the easiest way to redirect the interrupt vector table? Can this be done completely in C? Should I need to do something else? (I have read that some modify the linker script, which I don't know how)
Thank you for your help!