Dembo
Guest
|
|
« Reply #50 on: April 16, 2007, 03:10:12 15:10 » |
|
If YOU love it so much and you appreciate so much CCS works, why do you not buy it? this will give them more money to enhance their compiler ! Piracy is not a good thing! If it let you appreciate and test correctly a product without limitations, why you do not buy it if it gives you so satisfaction? Why do You think that I don't buy it? I have 3 different LEGAL versions of CCSC that I bought, one PCM and 2 PCW. And for commercial projects I use only legal versions. I download new versions from here because CCS demo is limited to specific micro, but I want to "try before buy" how it works on my preferred micro. This lets me to buy it exact when I it really need. I don't use PICbasic, I don't love it, but if someone found it useful - I'll never attack him. You want to prove us that CCSC is bad? For what do You need it? We all are friends here, and if Your friend found girlfriend and love her, You will say him "Your girl is ugly, I recommend You someone better" ? int i; for (i =110; i<0; i++) doSomething() Do You really need such action in You program? What should it do? Or You want to see: what will this stupid compiler do in this case? But if You ask compiler to do something not rational, why do You expect for rational answer?
|
|
« Last Edit: April 16, 2007, 03:35:37 15:35 by Dembo »
|
Logged
|
|
|
|
bluex
Junior Member
Offline
Posts: 83
Thank You
-Given: 10
-Receive: 39
|
|
« Reply #51 on: April 16, 2007, 03:46:40 15:46 » |
|
Why do You think that I don't buy it? I do not think anything. Everybody is free to do what he wants. I don't use PICbasic
I also do not use it. We all are friends here,
Glad to know that and if Your friend found girlfriend and love her, You will say him "Your girl is ugly, I recommend You someone better" ?
Of course I'll do !!! what happen if he "use" it to produce a baby? it will be bugged ... and when he will become a man, may be he will become a developper at CCS and produces a more buggy compiler version CCS v8.249 . We must preserve the environment from pollution !!!
|
|
« Last Edit: April 16, 2007, 03:48:32 15:48 by bluex »
|
Logged
|
|
|
|
Dembo
Guest
|
|
« Reply #52 on: April 16, 2007, 03:54:29 15:54 » |
|
|
|
|
Logged
|
|
|
|
bluex
Junior Member
Offline
Posts: 83
Thank You
-Given: 10
-Receive: 39
|
|
« Reply #53 on: April 16, 2007, 03:58:17 15:58 » |
|
|
|
|
Logged
|
|
|
|
hate
Hero Member
Offline
Posts: 555
Thank You
-Given: 156
-Receive: 355
|
|
« Reply #54 on: April 16, 2007, 04:48:47 16:48 » |
|
int i; for (i =110; i<0; i++) doSomething()
First of all there is lack of C knowledge here! You didn't complete the for statement with a ';' so this code will give an error of "missing ';' " with CCS. I don't know if other compilers will generate any code but if they do then that's a shame for the compiler!
I have more than 19 years experience with C language. My code do not leak anything since it's not a fully working example, it's just a chunck of code. What I means is that CCS compiler will generate asm code that will never be executed because of max and min conditions in loops. you can try it your self. This is ugly. And WE HAVE HAD bugs with floating point and ugly printf function that return a string representation that has nothing to do with the number passed as parameter.
Allright I won't go any deeper in this useless discussion but be sure about that the code below doesn't compile to any code if it is in a 'main()' function or not! Because first there is a missing ';' & I guess you have forgotten to type it(according to your 19 year C experience) and second the compiler defaults 'int' to 'UNSIGNED 8-BIT INTEGER' so the expression 'i<0' is NEVER TRUE!!?! Below is a test program check for yourself: void main() { int i;
for (i =110; i<0; i++) delay_cycles(1);
setup_adc_ports(NO_ANALOGS|VSS_VDD); setup_adc(ADC_OFF); setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1); setup_timer_1(T1_DISABLED); setup_comparator(NC_NC); setup_vref(FALSE);
// TODO: USER CODE!!
} And the list file: .................... int i; .................... .................... for (i =110; i<0; i++) delay_cycles(1); 0015: MOVLW 6E 0016: MOVWF 26 0017: GOTO 01B //it never checks 'i' jumps directly to init part as 'i' is never negative! 0018: NOP //and this should be the normal compiler behaviour! 0019: INCF 26,F 001A: GOTO 017 And WE HAVE HAD bugs with floating point and ugly printf function that return a string representation that has nothing to do with the number passed as parameter. I always use the printf function and it always supplied my needs without any format problem maybe yours had a special bug for the version you used. Now when you said to never had problems with it, I do not speak about compiling programs that are on robots or on hardware that is rebooted 10000 times a day, I'm speaking about firmware that controls harware that will and must stay working for months without any reboot, on programs that do not do only loops and simple tests with 1000 lines of code, but on programs that have more than 400000 lines ... that have to work on devices like 18F8722 ... try doing such projects with CCS and you will see what I mean. I didn't say I never had problems, in fact I had lots of problems with CCS but I didn't understand where you got the idea that I used it with systems rebooted 1000 times a day? No I haven't used that for human security but I used it for home security with lots of peripherals used in the PIC & the system never goes offline even the main power fails! In theory the code still runs without reboot without a single software related problem so far! I really don't know 400000 lines of code compiles into how many assembly commands but my rough guess is above 400000 if there isn't any definitions in the code and I don't know of a 18 series PIC with memory more than 400kb to try 400000 lines of code you mentioned! Please don't get me wrong 'bluex' your jokes are funny indeed but I can also make jokes about programs that you and others like and that won't make me feel good if that program doesn't deserve this! Regards...
|
|
|
Logged
|
Regards...
|
|
|
bluex
Junior Member
Offline
Posts: 83
Thank You
-Given: 10
-Receive: 39
|
|
« Reply #55 on: April 16, 2007, 06:48:44 18:48 » |
|
What about my last Joke ? you'll find it funny : I really don't know 400000 lines of code compiles into how many assembly commands but my rough guess is above 400000 if there isn't any definitions in the code and I don't know of a 18 series PIC with memory more than 400kb to try 400000 lines of code you mentioned!
wow ... very scientific aproach ... 1- When you have an optimizing compiler, lines are not converted using a template search/replace mechanism (like CCS seems to do )! 2- When you write four lines like Sprintf(....); Sprintf(....); Sprintf(....); Sprintf(....); the code of SprintF is only integrated once (unless you force inlining of intrinsic functions) the lines are replaced by only push of params and call to functions. 3- when I say compiling 400000 that does not mean that ALL the content of the 400000 will be in the final hex !!! lot of libs and functions (not used) will not be integrated, they will be compiled in first stage of compilation and removed in linking/optimizing stage (at least in a good compiler+linker ). Try to have a look at a book on compilation techniques and you'll be less ridiculous in your posts Regards!
|
|
|
Logged
|
|
|
|
hate
Hero Member
Offline
Posts: 555
Thank You
-Given: 156
-Receive: 355
|
|
« Reply #56 on: April 16, 2007, 08:11:19 20:11 » |
|
I'm not very into compiler writing and don't have any idea about it. I just said "rough guess" as every line of code at least adds a "call subroutine" command if using intrinsic functions as you said. So my rough guess was 400000+ lines of assembly without any "definition,enumaration vs..." in the code. But in case you are adding "libraries, unused functions" in your "400000+ lines of code" then we can consider we are all working with 50000+ lines of code in a simple project! Then that makes not of a big difference 400k with 50k, 1/8 ratio! Regards...
|
|
|
Logged
|
Regards...
|
|
|
Dembo
Guest
|
|
« Reply #57 on: April 16, 2007, 08:45:29 20:45 » |
|
I just opened my current project with all possible stuff: "definitions,enumerations,typedefs,libraries, unused functions etc."...
.lst file is 8000 lines, ROM usage is 9kB, code is optimized enough (to my look about less than 15% wasted comparing if I was writing it in assembler)
assuming each assembly line is 2bytes of the ROM, it is 4.5k lines, and source is about 3,5k
so hate's calculation is more or less accurate
|
|
« Last Edit: April 16, 2007, 08:48:20 20:48 by Dembo »
|
Logged
|
|
|
|
micropar
Active Member
Offline
Posts: 173
Thank You
-Given: 44
-Receive: 13
|
|
« Reply #58 on: April 16, 2007, 09:10:35 21:10 » |
|
Hi all,
I agree with Bluex.
I have 20 years of experience with C/C++ using it for embedded as well as PC side programming. My most projects are very complecated with lots of features, added and derived from my earlier programming. I normally do prototype software with Turbo C, make it compile without error and then I port the same to embedded.
Hitech is the best I found among PIC series besides defacto Keil C51 for 8051. The semantic analysis of Hitech is so good that many times, bugs that are un-noticed with TurboC are noticed by Hitech and it suggest its remedial action, too, very nicely.
I too consider CCS compiler as Hobbyiest or beginners one. Till as of version 4.032, it still doesn't support pointer to function, which is must if you want to write RTOS and complex state machines. If you ever had written even small compiler, you can realise that most difficult part of it are Pointer and Reference managment, as CCSinfo people have not able to offer.
Best part of Hitech Compiler are (1) support Pointer to function, (2) Strict adherence to ANSI I/O library and (3) Very compact code when you use data structures.
Bad part of Hitech is it dosen't provide accurate delay functions inbuilt in Library. Although when you use RTOS you don't requires that much too accurate delay functions as using delay fuctions in RTOS are supposed as blocking functions and bad programing practice.
Strong part of CCSinfo is their execellant library of most commonly Embedded peripherals, which makes using Compiler in C like writing programs in Basic. I too use it many times for quick prototyping on estimation of cost on bigger projects.
There is another reason why I reccommand Hitech, if you are taking up Embedded Programming as Careers full time profession seriosly. With in next few years, 32 bit ARM architecture will predominent the current 8/16 bit microcontrollers just like microcontrollers has predominated currently that of earlier microprocessor embedded boards of 8085, Z80, 68000 etc. Now to program in 32 bit ARM, you requires good ANSI adherence, good programming habbits of using data structures etc. all that Hitech offers and caters today.
I regret for inconvenience caused or feeling hurt to anyone, as I was expressing my opinion, from my experince.
Regards, --micropar--
|
|
|
Logged
|
|
|
|
hate
Hero Member
Offline
Posts: 555
Thank You
-Given: 156
-Receive: 355
|
|
« Reply #59 on: April 17, 2007, 10:15:41 10:15 » |
|
ANSI may be good for 32-bit ARM architecture but IMO it is not for an 8-bit architecture. Because ANSI standart defaults even the "short int" type to a "16-bit" value minimum! A 16-bit variable in an 8-bit system is slower than an 8-bit variable in an 8-bit system! Of course there is the "char" type but it is mainly for "characters" right? So I stay away from ANSI for low-end MCU's!
32-bit ARM architecture is something I also try to get familiar with but in my country where even PIC18 is not very common, ARM stays as a very special and expensive option. And I don't think 32-bit MCU's will dominate 8-bit or 16-bit parts, if 32-bit costs lower ok but even if they both the same price I prefer the low-end part for low-end systems.
Regards...
|
|
|
Logged
|
Regards...
|
|
|
bluex
Junior Member
Offline
Posts: 83
Thank You
-Given: 10
-Receive: 39
|
|
« Reply #60 on: April 17, 2007, 10:42:31 10:42 » |
|
32-bit ARM architecture is something I also try to get familiar with but in my country where even PIC18 is not very common, ARM stays as a very special and expensive option. And I don't think 32-bit MCU's will dominate 8-bit or 16-bit parts, if 32-bit costs lower ok but even if they both the same price I prefer the low-end part for low-end systems.
Regards...
32 bit ARM devices are becoming very close to most 16bits devices ... some Philips LPCxxxx are just about 16 euros and have by far more ROM/RAM and internal hardware. The only problem with such devices FOR HOBBIST is perhaps the fact that they do not exists in DIL packages because of their numerous IO pins. But they are the PRESENT and not the FUTURE !!!! They are the most used processors in embedded hardware actually!
|
|
|
Logged
|
|
|
|
hate
Hero Member
Offline
Posts: 555
Thank You
-Given: 156
-Receive: 355
|
|
« Reply #61 on: April 17, 2007, 08:32:03 20:32 » |
|
But they are the PRESENT and not the FUTURE !!!! They are the most used processors in embedded hardware actually! Actually we live the PAST here Regards...
|
|
|
Logged
|
Regards...
|
|
|
micropar
Active Member
Offline
Posts: 173
Thank You
-Given: 44
-Receive: 13
|
|
« Reply #62 on: April 18, 2007, 08:51:21 08:51 » |
|
Hi all and Hate, And I don't think 32-bit MCU's will dominate 8-bit or 16-bit parts, if 32-bit costs lower ok but even if they both the same price I prefer the low-end part for low-end systems.
Embedded future belong to 32 bit architecture, even though we hate using it, including myself. There are several reasons for it but most important are: 1) 32 bit offer almost full range of number (int) (4GB) that the human can encounters in our everyday life. For this reason once you start programming in 32 bit, you mostly don't have to think of out of range quantity or scalling the numbers obtained from A/D or I/O. 2) Timer management in embedded RTOS becomes very easy, as you start incorporating more tasks and you never have to worry about timer interrupt missing or rollover. .......If you ever designed any uP IP using FPGA core with VHDL or Verilog, you will realise more: 3) Memory addressing (4GB) becomes simpler 4) Opcode format becomes very easy to program as you have 32 bit to play with and almost all instructions can be single cycle including Jump with pipe-lining. I hope, we should start to welcome the bright future of ours in 32 bit world, warmly, Regards, --micropar--
|
|
|
Logged
|
|
|
|
hate
Hero Member
Offline
Posts: 555
Thank You
-Given: 156
-Receive: 355
|
|
« Reply #63 on: April 18, 2007, 10:00:41 10:00 » |
|
Yes you are right for all the things you say but those are mostly high-end systems requiring 4GB memory. I'm not talking about low-end MCU's for high-end systems, I'm talking about low-end MCU's for low-end systems! At least this will be my choice if the low-end MCU costs less!
Regards...
|
|
|
Logged
|
Regards...
|
|
|
Robi
Newbie
Offline
Posts: 20
Thank You
-Given: 54
-Receive: 1
|
|
« Reply #64 on: April 18, 2007, 02:29:33 14:29 » |
|
hate, you have my sympathy as I pretty agreed with all that you say but you shouldn't wasting your time with those who want not to hear or understand. It sounds to me as a few guys here prefer doing 0.1'' hole with auger instead using mini-drill or does that hide their personal frustration in using low-end products? May or maybe not. What I know is that the tool one may use make not him necessarely professional.
|
|
« Last Edit: April 18, 2007, 02:36:55 14:36 by Robi »
|
Logged
|
|
|
|
chenyi.com
Newbie
Offline
Posts: 27
Thank You
-Given: 18
-Receive: 27
|
|
« Reply #65 on: April 18, 2007, 07:06:12 19:06 » |
|
CCS C VS HT-PICC I compiled this file with CCS c and ht-Picc. The list file in here.
************************************************* void main(void) { int i; for (i =110; i<0; i++) { i++; } i = 100; }
*************************************************************************************** CCS PCM C Compiler, Version 4.032, 60629 19-四月-07 12:31
Filename: C:\Documents and Settings\user\My Documents\12.lst
ROM used: 42 words (1%) Largest free fragment is 2048 RAM used: 8 (2%) at main() level 8 (2%) worst case Stack: 0 locations
* 0000: MOVLW 00 0001: MOVWF 0A 0002: GOTO 004 0003: NOP .................... #include "C:\Documents and Settings\user\My Documents\12.h" .................... #include <16F946.h> .................... //////// Standard Header file for the PIC16F946 device //////////////// .................... #device PIC16F946 .................... #list .................... .................... #device adc=8 .................... .................... #FUSES NOWDT //No Watch Dog Timer .................... #FUSES LP //Low power osc < 200 khz .................... #FUSES NOPUT //No Power Up Timer .................... #FUSES PROTECT //Code protected from reads .................... .................... #use delay(clock=20000000) .................... .................... .................... .................... .................... void main() .................... { 0004: CLRF 04 0005: BCF 03.7 0006: MOVLW 1F 0007: ANDWF 03,F 0008: BSF 03.6 0009: CLRF 1C 000A: CLRF 1D 000B: CLRF 1E 000C: BSF 03.5 000D: CLRF 1C 000E: CLRF 1D 000F: CLRF 1E 0010: BCF 03.5 0011: BCF 03.6 0012: BCF 1F.5 0013: BCF 1F.6 0014: MOVLW 00 0015: BSF 03.5 0016: MOVWF 11 0017: CLRF 17 0018: MOVLW 07 0019: MOVWF 1C .................... .................... .................... int16 i; .................... for (i =110; i<0; i++) { 001A: BCF 03.5 001B: CLRF 22 001C: MOVLW 6E 001D: MOVWF 21 001E: GOTO 026 .................... i++; 001F: INCF 21,F 0020: BTFSC 03.2 0021: INCF 22,F .................... } 0022: INCF 21,F 0023: BTFSC 03.2 0024: INCF 22,F 0025: GOTO 01E .................... i = 100; 0026: CLRF 22 0027: MOVLW 64 0028: MOVWF 21 .................... .................... .................... // TODO: USER CODE!! .................... .................... } 0029: SLEEP
********************************************************************************
HI-TECH Software PICC Macro Assembler V9.60 Thu Apr 19 01:45:36 2007 1 processor 16F946 2 opt pw 79 3 psect text0,local,class=CODE,delta=2 4 psect text1,local,class=CODE,delta=2 5 0000 6 0000 7 0000 8 0000 9 0000 10 0000 11 0000 12 0000 13 0000 14 0000 15 16 psect text0 17 07EB _main 18 ; _i assigned to ?a_main+0 19 0000 _main$i set ?a_main 20 ;11.c: 4: void main() 21 07EB 306E movlw 110 22 07EC 1283 bcf 3,5 23 07ED 1303 bcf 3,6 ;carry unused 24 07EE 00A0 movwf ?a_main 25 07EF 01A1 clrf ?a_main+1 26 07F0 2FF9 goto l3 27 07F1 l2 28 ;11.c: 13: i++; 29 07F1 0AA0 incf ?a_main 30 07F2 1903 btfsc 3,2 31 07F3 0AA1 incf ?a_main+1 32 07F4 0AA0 incf ?a_main 33 07F5 1903 btfsc 3,2 34 07F6 0AA1 incf ?a_main+1 35 07F7 1BA1 btfsc ?a_main+1,7 36 07F8 2FF1 goto l2 37 07F9 l3 38 ;11.c: 14: } 39 07F9 3064 movlw 100 40 07FA 00A0 movwf ?a_main 41 07FB 01A1 clrf ?a_main+1 42 ;11.c: 16: } 43 07FC 0183 clrf 3 44 07FD 120A 118A 2800 ljmp start HI-TECH Software PICC Macro Assembler V9.60 Symbol Table Thu Apr 19 01:45:36 2007 ?a_main 0020 l2 07F1 l3 07F9 _main 07EB start 0000 status 0003
************************************************************************************
|
|
« Last Edit: April 19, 2007, 05:33:22 05:33 by chenyi.com »
|
Logged
|
|
|
|
chenyi.com
Newbie
Offline
Posts: 27
Thank You
-Given: 18
-Receive: 27
|
|
« Reply #66 on: April 18, 2007, 07:10:48 19:10 » |
|
|
|
|
Logged
|
|
|
|
chenyi.com
Newbie
Offline
Posts: 27
Thank You
-Given: 18
-Receive: 27
|
|
« Reply #67 on: April 18, 2007, 07:17:20 19:17 » |
|
about pointers to funtions *************************** The compiler does not permit pointers to functions so that the compiler can know at compile time the complete call tree. This is used to allocate memory for full RAM re-use. Functions that could not be in execution at the same time will use the same RAM locations. In addition since there is no data stack in the PICĀ®, function parameters are passed in a special way that requires knowledge at compile time of what function is being called. Calling a function via a pointer will prevent knowing both of these things at compile time. Users sometimes will want function pointers to create a state machine. The following is an example of how to do this without pointers:
enum tasks {taskA, taskB, taskC};
run_task(tasks task_to_run) {
switch(task_to_run) {
case taskA : taskA_main(); break;
case taskB : taskB_main(); break;
case taskC : taskC_main(); break;
}
} ********************************** Use this and pointers to funtions in Ht-picc, pls look the .lst file, Vs them!!!
|
|
|
Logged
|
|
|
|
hate
Hero Member
Offline
Posts: 555
Thank You
-Given: 156
-Receive: 355
|
|
« Reply #68 on: April 18, 2007, 09:24:18 21:24 » |
|
Thnx Robi! We all share something here, either idea, either stuff, either opinion & I was just sharing my opinion
|
|
|
Logged
|
Regards...
|
|
|
|