Mega's stk500bootloader

12 views
Skip to first unread message

Garrett Smith

unread,
Jan 2, 2018, 12:24:33 PM1/2/18
to Developers
For a project of mine. I needed a fast startup time. I at first simply removed the boot loader from my mega and loading them via ISP. However the task of loading software via ISP is inconvenient at times so I look at modifying the boot loader to start faster on power on.  I have now added this code early in the boot-loader (before the watchdog support).
(mcuStatusReg&_BV(PORF))
{
UART_STATUS_REG &= 0xfd;
boot_rww_enable();
asm volatile(
"clr r30 \n\t"
"clr r31 \n\t"
"ijmp \n\t"
);

}
...

It is functional and suits my needs. However while working I came across a possible issue with the original code. My first attempts had used similar code to the watchdog code calling the method app_start(). It did not function. On power_on the code would on reaching that statement stop executing the bootloader yet not begin executing the application code. I eventually changed my code to use the code that executes the application when the boot loader times out. Yet, my earlier trial raise the question if the watchdog support code functions. Has anyone tested it? I have never had the need to use the watchdog timer and have not tested the code.
I attached the full modified code if anyone wants to see it.
stk500boot.c
Reply all
Reply to author
Forward
0 new messages