I forgot to mention I am looking for a C compiler.I've been using PicBasic Pro for 20 years. Easy to learn but very powerful.
I did google search, but it seems like NOT (edited) many are available.hi bug,
A Google Search shows these options.
https://www.google.com/search?client=firefox-b-d&q=compilers+available+for+pic16/18/24
E
Very interesting, what project do you use it on?
Everything. Every time I develop something for PIC I do it in JAL. If I need to optimize, or I want a challenge, I'll convert it to assembly. I started with JAL many years ago because it's free and the C compilers for PIC were too pricey. I think there are libraries for most things I've ever needed. There's a library for SSD1306 coming out very soon, but I wrote my own anyway months ago.Very interesting, what project do you use it on?
What's the main issue. A C compiler for a 8-bit machine (any embedded system is unlikely to be 100% ANSI code) will be a bit of a kludge of the official spec.Hi team
Just wondering what are the other compilers available for pic16/18/24, I am thinking giving the moving away from XC8 compiler.
thanks guys!
I have been bitten by the bug(or so as I believed) in the XC8 compiler a few time. It wasted me a lot of time. There are two that just happened in the last few weeks.What's the main issue. A C compiler for a 8-bit machine (any embedded system is unlikely to be 100% ANSI code) will be a bit of a kludge of the official spec.
https://embeddedgurus.com/stack-overflow/2009/12/efficient-c-code-for-8-bit-microcontrollers/
Integer promotion
The integer promotion rules of ANSI C are probably the most heinous crime committed against those of us who labor in the 8-bit world.
/* it sometime have problem with this
* accessing one member will change the
* value of the other member
*/
typedef struct TEST_A{
uint8_t data1;
uint16_t data2;
}test_a_t;
/* this one work fine */
typedef struct TEST_B{
uint16_t data2;
uint8_t data1;
}test_b_t;
Hard to tell without a example but TEST_A data1 might get integer promoted to a int (16-bits in XC8) and overlap data2 during pointer int R/W operations. In TEST_B, a data1 int access won't affect data2 but it might affect the next variable in a contiguous memory space.I have been bitten by the bug(or so as I believed) in the XC8 compiler a few time. It wasted me a lot of time. There are two that just happened in the last few weeks.
In the latest XC8 v2.20 (free version), if you have an array more than 256, something weird will happen. Once I reduced the array size to 256 or less, all the funny business went away.
Same version as above, it seems to have problem with structure:
C:/* it sometime have problem with this * accessing one member will change the * value of the other member */ typedef struct TEST_A{ uint8_t data1; uint16_t data2; }test_a_t; /* this one work fine */ typedef struct TEST_B{ uint16_t data2; uint8_t data1; }test_b_t;
Form what I can understand (meaning I would be wrong), integer promotion could be one thing, but the compiler over writing memory on a different location where it not suppose to is another.Hard to tell without a example but TEST_A data1 might get integer promoted to a int (16-bits in XC8) and overlap data2 during pointer int R/W operations. In TEST_B, a data1 int access won't affect data2 but it might affect the next variable in a contiguous memory space.
It should't be stomping on variables unless you tell it to.Form what I can understand (meaning I would be wrong), integer promotion could be one thing, but the compiler over writing memory on a different location where it not suppose to is another.
In my case, my problem only happened on XC8 v2.20, it has no problem on an older version.
Looks like a ANSI C problem then... I have also experienced similar... BUT it was my old code.. C90 was more forgiving and C99 threw allsorts of errors... If it compiled on earlier versions just select C90 in the properties.. It will then be backwards compatible.... This is why C90 is still supported in V2.05In my case, my problem only happened on XC8 v2.20, it has no problem on an older version.
Thread starter | Similar threads | Forum | Replies | Date |
---|---|---|---|---|
S | [SOLVED] how can i solve uart error in iar compiler | Microcontrollers | 2 | |
K | What case compiler optimize the variable | Programming & Languages | 8 | |
K | Compiler Memory Allocation | Programming & Languages | 23 | |
Help with PIC16f690 and pin address -- CCS C compiler | Microcontrollers | 7 | ||
Oshonsoft compiler error | Microcontrollers | 1 |