Jump to content

Recommended Posts

Hi. Today I wanted to try the new Chameleon compiler (otherwise I'm using v6 compiler) and I have one problem from the beginning of source file. I have:

#pragma CLOCK_FREQ 16000000

which compiles fine with legacy c16 compiler (latest v6 and v7), but end up with "invalid ...something..." in chameleon. How should I write this? Is there some example source structure or some kind of manual for Chameleon at this stage?

Thank you for any info on this, Jaero

NB: problem is with DATA _CONFIG... lines, CLOCK_FREQ passes without problems...

Edited by jaero
clarification of problem
Link to post
Share on other sites

Hi Jareo,

The Chameleon doesn't seem to like the '&' in the pragma line.

If the header file contains the type 2 config style then use it.

#pragma config FOSC = INTIO67 // Internal oscillator block, port function on RA6 and RA7
#pragma config WDTEN = ON // WDT is always enabled. SWDTEN bit has no effect
#pragma config PWRTEN = ON // Power up timer enabled

otherwise work out the bits you need and insert a hex value.

Remember to define all the bits in all the config bytes or strange things can happen.  SourceBoost doesn't recognise the default erased chip values.

I still haven't worked out how to put data into rom with this compiler.




Link to post
Share on other sites

Hi Reynard. You are right with logic operators in #pragma, when I place computed hex values there, these two lines compile without problems.

#pragma DATA _CONFIG1, 0b0010111110101110
#pragma DATA _CONFIG2, 0b0011111111111101

It is for PIC16F720 so I don't have #pragma configs available.

As you mentioned, it seems that there is no way to put data in flash, because this chip has no eeprom and for my project I need 5 configuration bytes placed in flash. I tried #pragma data, compiler doesn't like it the same as it doesn't like:

void config_data_in_flash() @ CONFIG_FLASH_ADDR

So, asm data construct isn't supported either and I'm stuck with my legacy v6 compiler.

Thank you Reynard for helping with the config lines! :D

Link to post
Share on other sites

Ok, I'm taking it back with asm data placed at speciffic address. This one works, my project compiles with chameleon at this stage. I accidentaly removed CONF_BYTE1 and CONF_BYTE2 when I was trying the asm data statements. I hope chameleon will understand all my other exercises with this project :D

Link to post
Share on other sites

Ok spamming more :rolleyes:

Looks like chameleon compiles #pragma data wrong:

#pragma DATA _CONFIG1, 0x2FAE	// 0b0010111110101110
#pragma DATA _CONFIG2, 0x3FFD	// 0b0011111111111101

end up as:

	ORG 0x00002007
2007  00AE  	DW 0x00AE
2008  00FD  	DW 0x00FD

And another thing, chameleon produces over 100% more code (479 words instead of 222 words with v7 compiler). I don't understand this:

intcon.GIE = 1;

compiles into

0101  142A  	BSF CompTempVar640,0
0102  1C2A  	BTFSS CompTempVar640,0
0103  138B  	BCF gbl_intcon,7
0104  182A  	BTFSC CompTempVar640,0
0105  178B  	BSF gbl_intcon,7

So this post is more for Pavel or David...

Link to post
Share on other sites

Hi Jaero,

I think #pragma DATA is only for byte data and not words.

I tried your config but with a different processor selected (PIC18F25K22), I forgot to change it to your chip, and I got Windows error box saying "c_pis18.exe has stopped working".

Using "rom char *myromdata = {1,2,3};" just puts the data into RAM.  Tried other forms from other compilers but no luck.

Enums don't work right for me either.

Using a compiler warning to promote SPAM telling us to try Chameleon is very bad practice.  Deleted that offending line of code.

Until Chameleon comes out of Beta and there exist a manual, Chameleon is just a toy at the moment.

The limit of 256 bytes of rom per declaration in BoostC is a pain for me at the moment.  I have to split my GLCD font files into pages.  Will be moving this project to an ATmega very shortly.




Link to post
Share on other sites

I think #pragma DATA is only for byte data and not words.

Yes, I understand that I'm using old architecture here (16F...) and I'm sure chameleon will be targetted for more modern ones and it will not need #pragma data for configuration lines...

For me,  big plus of chameleon compiler at the moment is it's speed. I'm using it under linux and speed difference of boostc_pic16.exe and c_pic16.exe is absolutely measurable. I hope to try it on a more modern architecture, where it will not be limited with such constructs :D

Anyway, thank you very much for trying it out ;)

Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...