| Author |
Message |
|
|
Posted: Mar 10, 2009 - 06:21 AM |
|

Joined: Apr 04, 2008
Posts: 55
Location: india
|
|
i wrote a bootloader on atmega64(4K words).
i have 4 switches connected to int0-3.
i want to jmp to bootloader if i press any one of the switch. for that i wrote ISRs for all int0-3 to jmp(0x7000);
but if application burning failed and ISRs are not written to flash. then if i press switch it wont jmp() to bootloader. so i decided to burn ISRs code first by using
Code:
void boot(void) __attribute__ ((section (".myimportant")));
and while linking
Code:
-Wl,--section-start=.bootloader=0x000FF.
but it is giving error as overlap sections .data and .myimportant |
|
|
| |
|
|
|
|
|
Posted: Mar 10, 2009 - 10:22 AM |
|


Joined: Jul 18, 2005
Posts: 62245
Location: (using avr-gcc in) Finchingfield, Essex, England
|
|
I haven't a clue what it is you are trying to do here (and buttons on INT's is never a great idea because of bounce so I'd disable the INT sources before the JMPs) but I cannot help noticing you are locating that function to '.myimportant' but your LDFLAGS addition is positioning '.bootloader'
Cliff
PS I'll move this GCC specific question to that forum. |
_________________
|
| |
|
|
|
|
|
Posted: Mar 10, 2009 - 11:08 AM |
|

Joined: Apr 04, 2008
Posts: 55
Location: india
|
|
sorry i i typed wrongly
Code:
-Wl,--section-start=.myimportant=0x000FF.
i wrote code to overcome switch bounce problem. it is working fine. |
|
|
| |
|
|
|
|
|
Posted: Mar 10, 2009 - 11:19 AM |
|


Joined: Jul 18, 2005
Posts: 62245
Location: (using avr-gcc in) Finchingfield, Essex, England
|
|
But you cannot position that at 0x00FF as that will overlay .vectors or some other component of .text. A typical linker script is:
Code:
MEMORY
{
text (rx) : ORIGIN = 0, LENGTH = 128K
data (rw!x) : ORIGIN = 0x800060, LENGTH = 0xffa0
etc...
SECTIONS
{
etc..
/* Internal text space or external memory. */
.text :
{
*(.vectors)
KEEP(*(.vectors))
/* For data that needs to reside in the lower 64k of progmem. */
*(.progmem.gcc*)
*(.progmem*)
. = ALIGN(2);
__trampolines_start = . ;
/* The jump trampolines for the 16-bit limited relocs will reside here. */
*(.trampolines)
*(.trampolines*)
__trampolines_end = . ;
/* For future tablejump instruction arrays for 3 byte pc devices.
We don't relax jump/call instructions within these sections. */
*(.jumptables)
*(.jumptables*)
/* For code that needs to reside in the lower 128k progmem. */
*(.lowtext)
*(.lowtext*)
__ctors_start = . ;
*(.ctors)
__ctors_end = . ;
__dtors_start = . ;
*(.dtors)
__dtors_end = . ;
KEEP(SORT(*)(.ctors))
KEEP(SORT(*)(.dtors))
/* From this point on, we don't bother about wether the insns are
below or above the 16 bits boundary. */
*(.init0) /* Start here after reset. */
KEEP (*(.init0))
*(.init1)
KEEP (*(.init1))
*(.init2) /* Clear __zero_reg__, set up stack pointer. */
KEEP (*(.init2))
*(.init3)
KEEP (*(.init3))
*(.init4) /* Initialize data and BSS. */
KEEP (*(.init4))
*(.init5)
KEEP (*(.init5))
*(.init6) /* C++ constructors. */
KEEP (*(.init6))
*(.init7)
KEEP (*(.init7))
*(.init8)
KEEP (*(.init8))
*(.init9) /* Call main(). */
KEEP (*(.init9))
*(.text)
. = ALIGN(2);
*(.text.*)
. = ALIGN(2);
*(.fini9) /* _exit() starts here. */
KEEP (*(.fini9))
*(.fini8)
KEEP (*(.fini8))
*(.fini7)
KEEP (*(.fini7))
*(.fini6) /* C++ destructors. */
KEEP (*(.fini6))
*(.fini5)
KEEP (*(.fini5))
*(.fini4)
KEEP (*(.fini4))
*(.fini3)
KEEP (*(.fini3))
*(.fini2)
KEEP (*(.fini2))
*(.fini1)
KEEP (*(.fini1))
*(.fini0) /* Infinite loop after program termination. */
KEEP (*(.fini0))
_etext = . ;
} > text
If the goal here is simply to pre-load the vectors with that JMP 7000 code before actual app code is programmed into the app space then just write a completely separate program that just has the four INTn ISR routines and program that in first.
But I think you may have misunderstood the usual operation of a bootloader. You'd usually have the BOOTRST fuse programmed so that in the absence of anything in the app space (could be an interrupted reprogramming for example) it always starts at some safe, complete, known, whole code. The bootloader then looks for trigger to say that a new download is to be done and if that is not received it validates the contents of the app section somehow (often a CRC) and when it's happy that there is some runnable code there it jumps into it at 0x0000. But otherwise nothing below the BLS boundary will be executed.
It *looks* as if you are somehow trying to work around the idea of using BOOTRST (or maybe you didn't know of its existence?) but what you are attempting does not sound like the right approach.
Cliff |
_________________
|
| |
|
|
|
|
|
Posted: Mar 10, 2009 - 11:36 AM |
|

Joined: Apr 04, 2008
Posts: 55
Location: india
|
|
thanks for great information and guidance.
i'll try first option you mentions as writing a small program with 4isrs.
i would like to sure that if my application has size above 224pages then the bootlodear accepts 224 pages and NACKs if we try to send 225page.
then the 224pages of application is
Quote:
safe, complete, known, whole code
then it starts executing the application ( may ISR are not burned. they may be in 225page) |
|
|
| |
|
|
|
|
|