Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

upgrading a FIRMWARE on Atmega64a microcontroller.

Status
Not open for further replies.

pallavibsh

Newbie level 6
Joined
May 9, 2012
Messages
11
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,370
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:


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
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.
 
Last edited by a moderator:

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top