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 support@ccsinfo.com

pointer to rom

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



Joined: 19 Jan 2007
Posts: 8

View user's profile Send private message

pointer to rom
PostPosted: Tue Mar 20, 2007 4:34 am     Reply with quote

Did I understand anything wrong or should it be possible to get a pointer to ROM with 4.xx?

I tried this:
Code:

const char   status_g_2_blink[12]   =    {"G__G_______"};
const char   status_g_3_blink[15]   =    {"G__G__G_______"};
const char   status_g_fast_blink[3]=    {"_G"};

const char    *sequence_ptr   =   &status_g_2_blink[0];



On 8051 with Keil Compiler this works, but CCS says: "Expression must evaluate to a constant"
Ttelmah
Guest







PostPosted: Tue Mar 20, 2007 5:54 am     Reply with quote

Welcome to the world of CCS, not doing what it is advertised as doing...
Pointers to ROM, still don't work right. There have been some releases, that show occassional signs of things starting to work, but I have yet to see one, which actually fully operates...
If you use the ROM keyword, instead of 'const' (this is required for CCS4 syntax, or ANSI syntax), the system will generate a pointer to ROM, but on the current release, doesn't retrieve the data at this address properly. The const form, does not work at all. :(
Using 'pass_strings_in_ram', a version about 15 releases ago, started working a bit, but since the latter releases have gone backwards.
Unfortunately, CCS seem to have forgotten that they are selling a compiler, and are wasting lots of time on their IDE, while have still failed to get the core compiler close to working for the new features.
Using the ROM keyword, and the read_program_memory function, you can access the data, but not in an easy way.

Best Wishes
kevcon



Joined: 21 Feb 2007
Posts: 142
Location: Michigan, USA

View user's profile Send private message

PostPosted: Tue Mar 20, 2007 8:25 am     Reply with quote

While it does get the address right, the compiler doesn't know whether it's pointing ROM or RAM so you have to force it with your own routines.

Code:

#include "18F65J10.h"
#include "romstring.h"

#case

#fuses DEBUG         //Enable Dedicated Debugger Pins
#fuses NOWDT         //Disable Watchdog Timer
#fuses STVREN         //Enable Stack Over/Underflow Reset
#fuses NOXINST         //Disable Extended Instructions

#fuses NOPROTECT      //Disable Code Protection

#fuses NOIESO         //Disable Two Speed Start-up
#fuses FCMEN         //Enable Fail Safe Clock Monitor
#fuses PRIMARY         //Set Defaul Clock as PRIMARY
#fuses H4_SW         //High Speed Crystal and PLL

#fuses WDT32768         //Set WDT Postscaler to MAX

#fuses CCP2C1         //ECCP2/P2A is Multiplexed with RC1

#use delay( clock = 29,491,200, crystal = 7,372,800 )

const unsigned int8 rom_string[ 6 ] = { "Hello" };

char *romStringPointer;
char ram_string[ 32 ];



void main( void )
{

   romStringPointer = rom_string;

   rom_to_ram_strcopy( ram_string, romStringPointer );



}



romstring.h
Code:

#case

#define TBLPTRL 0xFF6
#define TBLPTRH 0xFF7
#define TBLPTRU 0xFF8
#define TABLAT   0xFF5

#byte   _TABLAT = TABLAT
#byte   _TBLPTRL = TBLPTRL
#byte   _TBLPTRH = TBLPTRH
#byte   _TBLPTRU = TBLPTRU


char *rom_to_ram_strcopy( char *s1, char *s2 )
{
   char *_TBLPTR;
#locate _TBLPTR = TBLPTRL

//Setup ROM TABLE Pointer
   _TBLPTRU = 0x00;
   _TBLPTR = s2;

   do {
#asm
      TBLRD   *+
#endasm
      *s1 = _TABLAT;
      s1++;
   } while( _TABLAT != 0);


   return( s1 );
}

Ttelmah
Guest







PostPosted: Tue Mar 20, 2007 8:29 am     Reply with quote

As I said, you can bodge it with read_program_memory (you are doing the same with your version), but this is just that a 'bodge'. The compiler is meant to understand the ROM keyword, and handle this automatically.

Best Wishes
kevcon



Joined: 21 Feb 2007
Posts: 142
Location: Michigan, USA

View user's profile Send private message

PostPosted: Tue Mar 20, 2007 8:39 am     Reply with quote

I agree, it's very frustrating when things don't work as they should.

The whole ROM pointer thing gave me hours of frustration before I figured out it didn't work like it should. Smile
maikelmeyers



Joined: 19 Jan 2007
Posts: 8

View user's profile Send private message

PostPosted: Tue Mar 20, 2007 9:49 am     Reply with quote

How bad, I always work with ROM Pointers. Now it's very awkward to do this stuff.
maikelmeyers



Joined: 19 Jan 2007
Posts: 8

View user's profile Send private message

PostPosted: Tue Mar 20, 2007 10:05 am     Reply with quote

This is a cheek, to sell a compiler that does'nt work. It is intentional deception. They must have known that it does'nt work. Its not only a bug, which no one knows at the time they began to sell.
Ttelmah
Guest







PostPosted: Tue Mar 20, 2007 10:41 am     Reply with quote

Have a look at the Version 4 comments thread.
Historically, this is in part 'expected' with CCS, but this time they have excelled themselves. Normally it takes about 6 months after the release of a product for it to be working 'reasonably well'. this time though, they started by having a 'beta' program, with a compiler that wasn't even an 'alpha' in most people's rating. the before even a small number of the problems were fixed it was launched, with dozens of 'new' features being advertised, of which at the time, none worked. The core compiler didn't even produce useable code. About ten versions ago, it started to produce pretty reasonable code, for stuff using the V3 syntax, and a few of the features began to work. The compiler possibly then rating a 'beta'. However they seem to be spending huge amounts of time on the IDE (which to my mind is a 'adjunct' to the compiler), rather than actually getting the compiler to work as advertised.
I must admit, in the UK, if I had bought from a UK distributer, I have found myself toying with the thought that it would be worth launching a small claims court case, on the grounds that the product is not 'fit for the intended purpose', but given I renewed directly, and the value of 'time', it is not worthwhile.
I have stated before, that to my mind, they should suspend the 'clock' on everybodies rights to renew, till a version exists where most of the features work. Otherwise a user who has 'bought' V4, would find themselves without a package that actually does what they paid for...
Similarly, people who have paid for a year of upgrades, have seen nothing for this now, for about a year!. The last really good working version of V3, was 3.249, which came out in about March last year, and while V4, has added support for some new processors, it took nearly twenty versions, before features that worked in 3.249 (typemod for example), started working in the new compiler...

Bes Wishes
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