pallavibsh
Newbie level 6
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:
* 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.
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: