avr-gcc-list
[Top][All Lists]
Advanced

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

Re[2]: [avr-gcc-list] bootloader and irq vectors


From: Marlin Unruh
Subject: Re[2]: [avr-gcc-list] bootloader and irq vectors
Date: Thu, 19 May 2005 17:22:20 -0600

  I found my problem by viewing the .lss file. The function I thought
  was at 0x3800 is not the one located there. I have several files,
  assemble and C, related to the bootloader. How do I force a given
  function to a fixed address? I have created a section (.section
  .bootloader) and have viewed the hex file, I have code from 0x0000
  -> 0x1c30 and at 0x3c00+ as expected.

  I also created a section (.section .gateway) in the last 256 bytes
  of the bootloader section (smallest the compiler would allow). I am
  using functions in the bootloader from the application area. The
  idea of the .gateway section is to create a pseudo fixed vector
  table that I will NOT alter once I release the bootloader (although
  it can be appended to). I can alter the code in the bootloader later
  without breaking the addresses from the application area. Or alter
  the application code without needing to know the 'real' addresses of
  the functions in the bootloader.

  For example:
  
  In the application code I call a function named 'foo()' which calls
  a function in the .gateway section called _foo() which calls a
  function in the .bootloader section called _foo_(). I can alter and
  re-compile the .bootloader later and the calls from the application
  code are still good.

> How are you planning to initiate the firmware upgrade?  Maybe this is where
> your problem is hiding and since you don't describe this I can't see it.

  I plan to put a message out via the SPI-CAN bus interface and wait a
  little while for a response from a connected PC RS232-CAN dongle. If
  no response, jump to reset vector 0x0000.

--
 Thank you!
 Marlin

Thursday, May 19, 2005, 4:11:13 PM, Graham wrote:

> Marlin Unruh wrote:


>> I am writing a bootloader on for an ATmega16, and an ATmega163. I am
>> planning to up-grade the application flash via a CAN bus chip on the
>> SPI port.
>>
>> I do NOT want the vector table in the bootloader section because the
>> vectors will change with firmware up-grades. I also do NOT want to
>> jump to the bootloader from the application section in case the
>> application section gets trashed doing an up-grade.
>>
>> Is this impossible? Any ideas.

> Maybe I don't understand your problem, but this doesn't seem at all hard to
> me.  Leave the vector table in the application section.  Set the fuse to
> have the MCU start up in the bootloader section.  In the bootloader code,
> look around to see if you're really supposed to be there (to load new
> firmware) and, if not, jump to the application.  Set the lock bits so that
> the bootloader cannot be changed.

> How are you planning to initiate the firmware upgrade?  Maybe this is where
> your problem is hiding and since you don't describe this I can't see it.

> Graham.

> _______________________________________________
> AVR-GCC-list mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/avr-gcc-list





reply via email to

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