Hi,
I have the following simple booloader...
void boot_test(void) BOOTLOADER_SECTION;
void boot_test(void)
{
long k = 0;
cli();
DDRB |= 0x90;
DDRE |= 0x18;
LEDS_ON_GREEN();
#if (1)
// If I include this loop, the boot loader never gets to main.
for (k = 0; k < 10; k++) {
LEDS_ON_YELLOW();
}
#endif
sei();
return;
}
void main( void )
{
long k;
while(1) {
LEDS_TOGGLE_RED();
for (k = 0; k < 64000; k++){};
}
}
The makefile linker flags are:
LDFLAGS += -Wl,--section-start=.bootloader=$(BOOTLOADER_START)
where
BOOTLOADER_START_2 = 0x1F000
BOOTLOADER_START = $(BOOTLOADER_START_2)
Now, when I include the for loop in the boot_test function then I never get to main.
I see the GREEN led go ON, then the YELLOW, but never see the RED toggling.
As soon as I remove the for loop (by setting #if(0)), the GREEN goes ON then the
RED starts toggling, as I expected.
make all provides the following outputs:
.bootloader 140 126976
The address shows that the bootloader is being put in the right section of FLASH.
And the fact that the RED flashes when there is no 'for' loop in the boot_test
function, indicates that the boot code is kind of working.
Could somebody please indicate what may be wrong when I include the for loop?
Your help would be much appreciated.
Thanks
Khusro
Sent from the AVR - gcc forum at Nabble.com: My first booloader is not working.
[Prev in Thread]
Current Thread
[Next in Thread]
[avr-gcc-list] My first booloader is not working.,
Khusro Saleem (sent by Nabble.com)<=