I'm using PCH compiler version 5.049 with a PIC18LF8722.
At the beginning, I'm using the checksum algorithm provided in the ex_checksum.c file for the PCH.
The code below shows a snippit of my main.h where I set the Fill_rom directive. I also show the #ID checksum_program directive
According to the on-line bug fix list at CCSINFO.COM, the issue with fill_rom and checksum was corrected in version 5.046.
The problem I'm having is that my code calculates the correct checksum when I DO NOT use the #FILL_ROM 0x00 directive. It DOES NOT calculate the checksum correctly when I use the FILL_ROM directive and rebuild the project. The ID Location always has the same checksum properly inserted at address 0x200000. This is all without using the debugger in the IDE.
If I use the Debugger mode, everything works OK WITH and WITHOUT the FILL_ROM directive.
My requirements are that I need to do a checksum at startup and compare it to the checksum inserted into the chip's ID LOCATION at compile time. I also need to insure that all my unused code space after my program is full of zeros (NOPs).
Any insight to what I'm doing wrong will be greatly appreciated.
Code:
// Includes
#include "18lF8722.h"
#ID checksum_program
/* FUSE SETTINGS */
#FUSES NOWDT //No Watchdog timer
#FUSES NOPROTECT //Code Not Protected From Reading
#FUSES MCLR
#FUSES PUT
#FUSES BBSIZ1K //1K words Boot Block size
#FUSES NOXINST //Extended set extension and Indexed Addressing mode disabled (Legacy mode)
// set ICD=TRUE only when using the CCS Debugger
#device ICD=TRUE
#FILL_ROM 0x00
#define VERSION_NUMBER "Beta-1.6"
#use delay(internal=16MHZ)
_________________ Thank you,
Bill
Coffee
Joined: 10 Feb 2015 Posts: 9
More Info on Fill_ROM / Checksum Problem
Posted: Tue Sep 22, 2015 8:20 am
The on-line release notes are as follows:
" 5.046 A wrong checksum in "#ID checksum" when using #fill_rom is fixed"
That may not be exactly what I'm finding.
The checksum that I find in the ID Location appears to be correct with or without the Fill_Rom directive -- it's always the same value.
What I'm finding is that my run-time calculated value is very different when the Fill_Rom directive is used.
This is very puzzling. I think I'm going to have to go to Tech Support for this one... _________________ Thank you,
Bill
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