SDCC conundrum

Status
Not open for further replies.

spirosd

New Member
I am playing around with the cvs version of the sdcc compiler and I have put together a 'simple' piece of code to step a motor (based on the work that I have done with the Hi-Tech PICC Lite compiler). I am using gpsim (again latest cvs version) to test the code to ensure that everything is A OK.

Now, simulating a 16f84 no problems ... everything works as advertised, I am a happy bunny . Configuring the code for a 16f628 (MCLR internally to VDD, Comparators off, internal 4MHz clock, LVP OFF ... ahh heck this is the config line ) is the only difference in the code (that and using the 16f628 header file).
Code:
//fuses configuration
typedef unsigned int word;
word at 0x2007 __CONFIG = _CP_OFF & \       // code protection off
                          _DATA_CP_OFF & \             // data protection off
                          _PWRTE_ON & \                 // power on timer on
                          _WDT_OFF & \                   // watchdog timer off
                          _INTRC_OSC_NOCLKOUT & \     // internal oscillator
                          _LVP_OFF & \                  // low voltage programming off
                          _MCLRE_OFF & \             // MCLRE tied internally to VDD
                          _BODEN_OFF;                // Brown-out reset disabled

Trying to simulate the resulting code in gpsim fails (for those interested I have included the error message I get from gpsim)
Code:
gpsim - the GNUPIC simulator
version: 0.21.3

type help for help
starting server....
 started server
gpsim>  f628 construct
p16f628 setting config word 0xffff
 porta valid_iopins ff  tris valid io df
** SETTING CONFIG address = 0x2007  value = 0x3f90
p16f628 setting config word 0x3f90
 porta valid_iopins 1f  tris valid io df
gpsim> running...
attempt read from invalid file register
attempt write to invalid file register: address 0x0, value 0x4
0x0000000000000048 p16f628 0x0013 0x1515 bsf    ccpr1l,2

Any ideas as to what might be wrong? I have posted a question of the gpsim mail list about this, wondering if anyone here might have any ideas / suggestions.

(Yes Nigel, this is another reason why learning assembler is good reason ... :lol: )
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…