![](templates/subSilver/images/CCSLogo.jpg) |
![CCS C Software and Maintenance Offers](templates/subSilver/images/forumAd6.jpg) |
View previous topic :: View next topic |
Author |
Message |
sebdey
Joined: 11 Sep 2003 Posts: 17 Location: Switzerland
|
Fill hex file with 0xFFs.. |
Posted: Tue Jan 17, 2006 2:23 am |
|
|
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 ! |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah Guest
|
|
Posted: Tue Jan 17, 2006 4:50 am |
|
|
Depends on how old your compiler is.
On the newer versions, a look in the 'readme' file, for '#fill_rom', will help.
Best Wishes |
|
![](templates/subSilver/images/spacer.gif) |
sebdey
Joined: 11 Sep 2003 Posts: 17 Location: Switzerland
|
|
Posted: Tue Jan 17, 2006 6:34 am |
|
|
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 |
|
![](templates/subSilver/images/spacer.gif) |
|
|
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
|