[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] Parm to application

From: Wim Lewis
Subject: Re: [avr-gcc-list] Parm to application
Date: Sun, 26 Aug 2012 00:59:17 -0700
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:12.0) Gecko/20120428 Thunderbird/12.0.1

On 8/25/12 10:35 PM, Parthasaradhi Nayani wrote:
> Hello all,
> I have a boot loader and an application on a Mega168. As boot loader and
> application are two different entities, is there any way the boot loader
> can pass a parameter to application code? Would like something like main
> (int argc, char *argv[]). Any suggestions please? Thank you.

The problem I see is that the boot loader doesn't necessarily run every
time the mcu is started (unless BOOTRST is set).

You could define a static variable in SRAM or EEPROM which the
bootloader could write some information to, if you wanted a simple way
to communicate from the bootloader to the main application, but you'd
also have to detect the common case where the bootloader didn't run
first and RAM has random or old data in it. (Similarly the bootloader
could put some special values in registers; you'd have to modify the
startup routine not to clobber them.)

You might be better off stepping back and considering whether the
problem you are trying to solve really requires communication between
the bootloader and the main program at all.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]