[Top][All Lists]

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

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

From: Georg-Johann Lay
Subject: Re: [avr-gcc-list] Parm to application
Date: Sun, 26 Aug 2012 09:53:29 +0200
User-agent: Thunderbird (Windows/20100228)

Parthasaradhi Nayani schrieb:
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[])

Reserve a piece of RAM that does not depend on how the application
is compiled, for example at the start of .data (bump .data to a later
location) or at the top of the stack (initialize SP to RAMEND-offset).

In the boot loader, write the data to that reserved space.

In the application, write a startup function for section .init8,
preferably as naked assembler, that reads that data and prepares
it according to the ABI, i.e. pass argc in r24/25 etc.

Then call main (int, char*[]) and receive the arguments.

It should also be okay to call main from .init8 by hand if
you prefer C, e.g.

  main (argc, argv);
  _exit (0);


  main (argc, argv, env);
  _exit (0);


reply via email to

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