Re: Executing code in boot page from application page
2008-04-09 by Don Kinzer
--- In AVR-Chat@yahoogroups.com, Lee <lde99881@...> wrote: > Yes RAMPZ is used in the ATMEga128 and I have > previously tried setting that before "call"ing The RAMPZ register is only used for the elpm instruction. The EIND register is used for eicall/eijmp instructions, both are available only on devices with more thatn 128K bytes of Flash. I don't remember if you said which device you're using but if it has more than 128K bytes of flash you'll need to use eicall to call your bootloader dispatch table entries. > I used "call" rather then jmp, because I need to > return to the application program. I suspected so. However, I was referring to the instructions that you placed in your jump table. If you don't plan to lock the boot section to make it unreadble from the application section, you can use a table of addresses in the bootloader. If you do plan to lock the boot section, you'll need to make a table of jumps in the bootloader. I use this technique in my applications and it works flawlessly. There have been several threads on AVR Freaks on this topic, some including example code. Don Kinzer ZBasic Microcontrollers http://www.zbasic.net