CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

serial bootloader

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
kmp84



Joined: 02 Feb 2010
Posts: 353

View user's profile Send private message

serial bootloader
PostPosted: Sat Mar 28, 2020 8:32 am     Reply with quote

Hello,

I'm using CCS's serial bootloader with pic18F45K22.
How to erase user program memory before load new hex file?

Something like this?

Code:
 

      printf("\r\nErasing flash on: %s!\r\n",getenv("DEVICE"));
     
      for(i=(LOADER_END+1); i<getenv("PROGRAM_MEMORY"); i+=getenv("FLASH_ERASE_SIZE")){   
         erase_program_eeprom(i);   // Erase User Flash memory!
      }



Best Regards!
Ttelmah



Joined: 11 Mar 2010
Posts: 19515

View user's profile Send private message

PostPosted: Sat Mar 28, 2020 9:18 am     Reply with quote

You don't.

The normal write_program_memory function, will erase a
page when you write to the first byte in a page.
Quote:

Whenever this function is about to write to a location that is a multiple of FLASH_ERASE_SIZE then an erase is performed on the whole block.

The bootloader has a little extra code to deal with some special conditions,
but normally relies on this.
kmp84



Joined: 02 Feb 2010
Posts: 353

View user's profile Send private message

PostPosted: Sat Mar 28, 2020 10:52 am     Reply with quote

Hi Mr.Ttelmah,

I'm searching method for calculating checksum for bootloader region and application region. That was purpose for clearing all application mem. region.

Thanks,
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group