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

Fill hex file with 0xFFs..

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



Joined: 11 Sep 2003
Posts: 17
Location: Switzerland

View user's profile Send private message

Fill hex file with 0xFFs..
PostPosted: Tue Jan 17, 2006 2:23 am     Reply with quote

Is there any options in CCS that would permit to create an hex file with all unused memory locations set to FFh instead of having the unused memory location ignored in the hex file.

For example, this is a part of a conventional hex file created by CCS:

Quote:

(...)
:0C06E000A6B2FED7FF0084D50001000C7C
:040800000EEF2FF0D8
(...)


The memory between addresses 6E0h (not exactly 6E0h)... and 800h is not used by my program, would it be possible to tell the compiler to fill the hex file with FFh when the memory is not used, i.e. to have

Quote:

(...)
:1006D000040EA66E550EA76EAA0EA76EA682000087
:1006E000A6B2FED7FF0084D50001000CFFFFFFFFFFFF
:1006F000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
:10070000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
...
:100800000EEF2FF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
(...)


The aim is to prevent having unused old code fragments in my memory when downloading new code with a bootloader.

Thanks !
Ttelmah
Guest







PostPosted: Tue Jan 17, 2006 4:50 am     Reply with quote

Depends on how old your compiler is.
On the newer versions, a look in the 'readme' file, for '#fill_rom', will help.

Best Wishes
sebdey



Joined: 11 Sep 2003
Posts: 17
Location: Switzerland

View user's profile Send private message

PostPosted: Tue Jan 17, 2006 6:34 am     Reply with quote

Thanks, that did it, BUT....

The problem now is following (maybe a compiler bug...):

I place the #fill_rom directive in my header:
Code:

#include <18F4620.h>
#device *=16,ADC=8
//On sait que l'on va utiliser les addresses 0x000-0x7FF pour le bootloader, on d�place donc
//le vecteur de reset et les interruptions au bon endroit
#build(reset=0x800,interrupt=0x808)

// On indique que toute la m�moire inutilis�e doit �tre remplie avec des FF (donc effac�e...)
#fill_rom 0xFFFF

// On utilise le WDT, contr�l� par software, avec un postscaler de 512 -> P�riode ~2[s]
#fuses HS,WDT512,NOWDT,NOBROWNOUT,NOLVP,NOPROTECT,NOWRT,PUT,NOPBADEN,NOFCMEN,NOIESO
#use delay(clock=20000000)


Then, I declare some memory addresses to hold data for my application:
Code:

#define   T_NUM_ADDR         0x0F540            
#define   T_CANAL_ADDR      0x0F542            
#define   T_TYPE_ADDR         0x0F544            
#define   T_IMPACT1_ADDR      0x0F546            
#define   T_IMPACT2_ADDR      0x0F548            
#define   T_IMPACT3_ADDR      0x0F54A            

//Zone m�moire (caract�ristiques de la cible + autres) */
#define   MEM_END_ADDR      0x0FFFF


Then is the application code (...)

At the end of my code I initialize the values that the memory should contain at the location defined above:
Code:

// On r�serve de la place pour m�moriser des donn�es (dans la m�moire flash car ces donn�es
// ne vont changer que tr�s rarement...)

#ORG T_NUM_ADDR,MEM_END_ADDR

#ROM T_NUM_ADDR = {TARGET_NUM}
#ROM T_CANAL_ADDR = {TARGET_CANAL}
#ROM T_TYPE_ADDR = {TARGET_TYPE}
#ROM T_IMPACT1_ADDR = {TARGET_IMPACT1}
#ROM T_IMPACT2_ADDR = {TARGET_IMPACT2}
#ROM T_IMPACT3_ADDR = {TARGET_IMPACT3}


The problem is that when I use the #fill_rom statement, these values will be overwritten by FFh in the Hex file. With #fill_rom commented out, the hex file contains the right values at the right address

I use Ver. 3.228
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