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

Problems with internal EEPROM on import to MPLAB

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



Joined: 17 Sep 2003
Posts: 11
Location: Glasgow, Scotland

View user's profile Send private message

Problems with internal EEPROM on import to MPLAB
PostPosted: Mon May 17, 2004 4:55 am     Reply with quote

Shocked Hi wonder if you can help me out, I have just installed MPLAB 6.50 and used the file import within MPLAB to import a previously complied HEX file (hex file created for 18F252) that I had created a few weeks ago.

However, when I examined the imported code, the internal EEPROM data had not transferred across. (checked by going to the toolbarline View, then selecting EEPROM).

I then re-installed MPLAB 5.62 and imported my hex file. I was then able to view the internal EEPROM data, by going to the toolbar line Window and then selecting EEPROM memory.

Is this just me Crying or Very sad ,is it something stupid that I am doing or is there a problem with MPLAB 6.50's import function in regard of importing internal EEPROM data created within the CCS complier using #ROM statements?
Peter-NMB



Joined: 17 Sep 2003
Posts: 11
Location: Glasgow, Scotland

View user's profile Send private message

Problems with internal EEPROM on import to MPLAB More info
PostPosted: Mon May 17, 2004 8:47 am     Reply with quote

Extra Info:
The code sample I used is shown below for the problems I am seeing above

I also tried this with a 16F876 (moved the code locations of the#ROM to comply with the 16F876 locations) in both MPLABS I could view the EEPROM data after import

Code:

#include <18F252.h>                           // pic header file location
#fuses    XT,WDT,PUT,BORV42,NOPROTECT,NOLVP,CCP2C1,STVREN,NODEBUG,NOWRT,NOWRTD,NOWRTB,NOWRTC,NOCPD,NOCPB,NOEBTRB,NOEBTR   // internal fuses blown
#use    delay(clock=4000000,RESTART_WDT)      // clock frequency
#id    0x0000                              // ID word to allow compatability between PICSTART+ & MPLAB ICD


/************************************************************************************************************************/
//Internal EEPROM data
/************************************************************************************************************************/

#rom 0xF00000   ={'H'}         // General Sample Character
#rom 0xF00001   ={'E'}         // General Sample Character
#rom 0xF00002   ={'L'}          // General Sample Character
#rom 0xF00003   ={'L'}          // General Sample Character
#rom 0xF00004   ={'O'}          // General Sample Character
#rom 0xF00005   ={' '}          // General Sample Character
#rom 0xF00006   ={'I'}         // General Sample Character
#rom 0xF00007   ={' '}         // General Sample Character
#rom 0xF00008   ={'A'}         // General Sample Character
#rom 0xF00009   ={'M'}         // General Sample Character
#rom 0xF0000A   ={' '}         // General Sample Character
#rom 0xF0000B   ={'D'}         // General Sample Character
#rom 0xF0000C   ={'A'}         // General Sample Character
#rom 0xF0000D   ={'T'}         // General Sample Character
#rom 0xF0000E   ={'A'}         // General Sample Character
#rom 0xF0000F   ={' '}         // General Sample Character

#rom 0xF00010   ={0x00}         // General Sample Numeric
#rom 0xF00011   ={0x01}         // General Sample Numeric
#rom 0xF00012   ={0x02}         // General Sample Numeric
#rom 0xF00013   ={0x03}         // General Sample Numeric
#rom 0xF00014   ={0x04}         // General Sample Numeric
#rom 0xF00015   ={0x05}         // General Sample Numeric
#rom 0xF00016   ={0x06}         // General Sample Numeric
#rom 0xF00017   ={0x07}         // General Sample Numeric
#rom 0xF00018   ={0x08}         // General Sample Numeric
#rom 0xF00019   ={0x09}         // General Sample Numeric
#rom 0xF0001A   ={0x0A}         // General Sample Numeric
#rom 0xF0001B   ={0x0B}         // General Sample Numeric
#rom 0xF0001C   ={0x0C}         // General Sample Numeric
#rom 0xF0001D   ={0x0D}         // General Sample Numeric
#rom 0xF0001E   ={0x0E}         // General Sample Numeric
#rom 0xF0001F   ={0x0F}         // General Sample Numeric


/************************************************************************************************************************/
//Main Program Loop
/************************************************************************************************************************/
main()
{

   do{
   // do nothing just a code generation sample to show loading of internal eeprom data
   }while(true);
}
Guest








PostPosted: Mon Jun 07, 2004 12:42 pm     Reply with quote

I have experienced the same problem. I have tried several releases up to 6.51 before realizing that the problem is not related to MPLAB. The .HEX file generated by CCS compiler is wrong. It assumes that each entry is 16 bit wide. You can edit the .HEX file and read it to convince yourself.
format :
1 column ':' start of line
2 digits : number of arguments bytes on the current lines.
4 digits : start 16-bit address
2 digits : code : 01 : end of file
04 : 16-bit to use as higher address (31:16)
00 : data to writes
NbData*2 digits : data
2 digits : complement of the checksum

I have tried both coff and hex files, both have the same behavior.

If you merge the string to create "HELLO I AM DATA", it will generated the proper output (assuming that the string lenght match a 16-bit boundary including the terminating '\0' character).

If you want to include data, use 16-bit words only.

I am including my test case which shows the behavior of CCS compiler.

I expect that this text will help someone. I guess that someone should filed a bug or limitation report.

#include <18F452.h>
//#device adc=8
#use delay(clock=153000)
#fuses NOWDT,WDT128,XT, BROWNOUT, BORV45, PUT, STVREN
#use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8)
#id 0x0000 // ID word to allow compatability between PICSTART+ & MPLAB ICD


/************************************************************************************************************************/
//Internal EEPROM data
/************************************************************************************************************************/

// Ligne 0 du viewer
#rom 0xF00000 ={'H'}
#rom 0xF00001 ={'E'} // odd adresses are not allowed
#rom 0xF00002 ={'L'}
#rom 0xF00003 ={'L'}
#rom 0xF00004 ={'O'}

// Ligne 1 du viewer
#rom 0xF00010 ={'H','E'} // 'H' and 'E' are expanded to 16-bit
#rom 0xF00012 ={'L','L'} // not consider, it assumes that adress counter has reached ...14
#rom 0xF00014 ={'O',' '}

// Ligne 2 du viewer
#rom 0xF00020 ={'H','E','L','L'} // 16-bit expansion...
#rom 0xF00024 ={'O',' ',' ',' '} // not considered. data at the start adress is already defined

// Ligne 3 du viewer OK
#rom 0xF00030 ={"HELLO I AM DATA" }

// Ligne 4 du viewer
#rom 0xF00040 ={0x11} // ?? can't explain
#rom 0xF00041 ={0x22}
#rom 0xF00042 ={0x33}
#rom 0xF00043 ={0x44}

// Ligne 5 du viewer
#rom 0xF00050 ={0x11,0x22} // 16-bit expansion
#rom 0xF00052 ={0x33,0x44} // a mess

// 16-bit test case
// Ligne 6 du viewer
#rom 0xF00060 ={0x2211} // OK
#rom 0xF00062 ={0x4433}

// Ligne 7 du viewer
#rom 0xF00070 ={0x2211, 0x4433} // OK
#rom 0xF00074 ={0x6655, 0x8877}

// 32-bit test case
// Ligne 8 du viewer
// 16- bit expansion... It writes
// from 80 : 11 00 22 00 33 00 44 00 (last byte at 87)
// from 84 : 55 00 66 00 77 00 88 00
// location 84..87 already written. continue with
// data 77 at 88.
#rom 0xF00080 ={0x11,0x22,0x33,0x44}
#rom 0xF00084 ={0x55,0x66,0x77,0x88}

// Ligne 9 du viewer
#rom 0xF00090 ={0x44332211}
#rom 0xF00094 ={0x88776655}

// mix with unaligned
// Ligne 10 du viewer
#rom 0xF000A0 ={0x11, 0x3322, 0x44, 0x55, 0x7766, 0x88 }

// Ligne 11 du viewer
#rom 0xF000B0 ={0x78563412, 0x11, 0x22, 0x33, 0x44 }

// Ligne 12 du viewer
#rom 0xF000C0 ={0xAA, 0xBB, 0x78563412, 0xCC, 0xDD }

// Ligne 13 du viewer
#rom 0xF000D0 ={0xAA, 0x78563412, 0xBB, 0xCC, 0xDD }


/************************************************************************************************************************/
//Main Program Loop
/************************************************************************************************************************/
void main( void )
{
#if 0
setup_adc_ports(NO_ANALOGS);
setup_adc(ADC_OFF);
setup_psp(PSP_DISABLED);
setup_spi(FALSE);
setup_wdt(WDT_OFF);
setup_timer_0(RTCC_INTERNAL);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_timer_3(T3_DISABLED|T3_DIV_BY_1);
#endif

do {
// do nothing just a code generation sample to show loading of internal eeprom data
} while(true);
}
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