I wanted to programm a bootloader for in-application programming. If an application was programmed with the bootloader, the bootloader starts the application. If i want to programm a new application, the old application tranfers control to the bootloader with an interrupt call (_trap_0x7F). What must i attend when i jump tho the bootloader with a software interrupt? The interrupt function calls not the main() function but an other function in my bootloader programm.
Sorry, i use the C166 toolset!
At the start of your bootloader have some code that says if R1 == some prescribed value, and the last reset was a software reset (check the SYSSTAT register), then set R1 = 0 and vector off to your application code. So: * At initial power on, SYSSTAT will indicate a hardware reset. The bootloader is then able to check if an application is available. * It it is, it sets R1 to the aforementioned prescribed value, and throws a software reset. This should get the application going. * When in the application, to get back to the bootloader, you just have to reset with R1 set to something other than your chosen value. I chose R1 for this because (for my setup at least) it isn't cleared by reset. But any location in RAM that isn't cleared by reset will do.