Forum Menu




 


Log in Problems?
New User? Sign Up!
AVR Freaks Forum Index

Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
scoe
PostPosted: Jul 20, 2012 - 12:21 PM
Rookie


Joined: Nov 23, 2007
Posts: 31
Location: Zagreb

Hi,

What i cant find anywhere is what kind of byte array is given as parameter to boot_page_write.
If i have for example have following hex:
Code:

:10010000214601360121470136007EFE09D2190140
:100110002146017EB7C20001FF5F16002148011988
:10012000194E79234623965778239EDA3F01B2CAA7

and lets say that page size is 128bytes.

what do i need to fill in boot_page_fill with ?

If i got it right it will go like this:
Code:

boot_page_erase (0x0100);
//wait
boot_page_fill({0x4621, 0x3601, 0x4721, ..., 0x0119});
boot_page_write (0x0100);

then same thing for other two addresses ?
 
 View user's profile Send private message  
Reply with quote Back to top
clawson
PostPosted: Jul 20, 2012 - 02:09 PM
10k+ Postman


Joined: Jul 18, 2005
Posts: 62371
Location: (using avr-gcc in) Finchingfield, Essex, England

You need to learn how to process Intel Hex. You may find it easier to convert to binary first. But basically it is:
Code:
uint8_t data[] = { 0x21, 0x46, 0x01, 0x36, 0x01, 0x21, 0x47, 0x01, 0x36, 0x00, 0x7E, 0xFE, 0x09, 0xD2, 0x19, 0x01,
0x21, 0x46, 0x01, 0x7E, 0xB7, 0xC2, 0x00, 0x01, 0xFF, 0x5F, 0x16, 0x00, 0x21, 0x48, 0x01, 0x19,
0x19, 0x4E, 0x79, 0x23, 0x46, 0x23, 0x96, 0x57, 0x78, 0x23, 0x9E, 0xDA, 0x3F, 0x01, 0xB2, 0xCA };

uint16_t page_adr = 0x0010;

for (i=0; i<NUM_ELEMENTS(data); i+=2) {
  boot_page_fill(page_adr+i, (data[i+1]<<8) | data[i]);
}

_________________
 
 View user's profile Send private message  
Reply with quote Back to top
scoe
PostPosted: Jul 20, 2012 - 04:19 PM
Rookie


Joined: Nov 23, 2007
Posts: 31
Location: Zagreb

Thanx. I think i got it now.
 
 View user's profile Send private message  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT + 1 Hour
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2006 The PNphpBB Group
Credits