 |
| Author |
Message |
|
|
Posted: May 29, 2012 - 11:06 AM |
|

Joined: May 28, 2012
Posts: 9
|
|
Hi all,
Coming to the topic am doing a project same as yours upgrading a FIRMWARE on Atmega64a microcontroller.
1. Am using a gsm SIM900 using AT-commands i.e AT+FTP commands will receive file through server.
2. And i have written a code testing for a condition if data received (updated new firmware version) write it to flash.
The code what i have written is as follows :
code:
uint8_t buf[256];
int page= 0x0000;
#define SPM_PAGESIZE 256
int pos=0;
void boot_program_page (uint32_t page, uint8_t *buf)
{
uint16_t i;
cli(); // Disable interrupts.
boot_page_erase (page);
boot_spm_busy_wait (); // Wait until the memory is erased.
for (i=0; i<SPM_PAGESIZE; i+=2)
{
/*uint16_t w = *buf++;
w += (*buf++) << 8;*/
boot_page_fill (page + i,buf[i]);
}
boot_page_write (page);
boot_spm_busy_wait();
sei(); //enable interrupts
}
/***************************** main **********************************************/
int main(void)
{
void (*funcptr)( void ) = 0x0000; // Set up function pointer to RESET vector.
inituart(); // Initialize UART.
_delay_ms(4000);
start_timer(4);
while(!(timer_expired) && (pos<128))
{
recchar();
}
stop_timer();
if(pos > 0)
{ //if rx data enter in BLS.
boot_program_page(page, buf);
}
else
{
boot_spm_busy_wait();
boot_rww_enable ();
funcptr(); // Jump to Reset vector 0x0000 in Application Section.
}
return 0;
}
// receiving data through UART.
unsigned char recchar(void)
{
while(!(UART_STATUS_REG & (1 << RECEIVE_COMPLETE_BIT))); // wait for data
buf[pos++]=UART_DATA_REG;
return 0;
}
* my problem is am not able to jump to Bootloading section and BOOTRST is set, BOOTSZ=0,0 and in makefile :
LDFLAGS += -Wl,-section-start=.bootloader =0xF800 ( bootloader location 1k bootloader).
all these things what i did is it correct is any correction required? and not able to jump to BLS. |
|
|
| |
|
|
|
|
|
Posted: May 29, 2012 - 11:29 AM |
|


Joined: Jul 23, 2001
Posts: 2437
Location: Osnabrueck, Germany
|
|
And again you have opened a new thread for the very same topic.
Stick to one thread! |
_________________ Stefan Ernst
|
| |
|
|
|
|
|
|
|