[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 13:31:54 +0200
User-agent: Thunderbird (Windows/20100228)

Parthasaradhi Nayani schrieb:
From: Georg-Johann Lay

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.

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);

Hello Johann,

Thank you for your reply. Yes this was one approach that is possible,
but it is pretty much dependent on absolute address. Passing arguments
to main is actually not possible in a bare bone system right?

An outline of a possible approach is above.  You'll have to call main
from the startup code or fallthu to .init9.

*Any* LDS depends on absolute addresses, and likewise any address
computation.  There is nothing like position independent data or
dynamic linking or GOT tables or MMU on AVR...

Just use symbolic addresses as usual, put them in dedicates sections,
and arrange your linker script and/or command options and startup
code to (co)operate with them.


  int x __attribute__((section (".bootdata")));

you can use x in the known way, it's only about locating .bootdata
to whatever location you deem appropriate.  Read the linker manual.

or is there any method?

See above

I would actually prefer to call application main with parameters
from boot section.

Calling main from boot does not sound sane.  How do you know the
address of main?  How do you run startup code to initialize .data
and .bss, setup SP, call constructors, etc.?  How do you reset the
hardware like communication I/O?


reply via email to

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