Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : JALv2.4q2 versus XC8
Author | Message | ||||
vasi Guru Joined: 23/03/2007 Location: RomaniaPosts: 1697 |
I guess anyone knows that MPLAB XC8 compiler is in fact an unified "form" of the two HITECH C compilers, PICC and PICC18, known to generate the most efficient and compact code for PIC12F-16F-18F microcontrollers (and also the most expensive). Now, Microchip says that MPLAB XC8 is the future and all new designs must use this cross platform compiler. We have a free version edition but unfortunately, what Geoff says here about HITECH Lite, it is also true for XC8 (personally, I expected to have a performance at least at a comparable level with the C18 compiler). So, it is clear until now that this HITECH acquisition turned very bad for the hobby department. In fact, for the C programmers only. The 60 day trial for the PRO version may help a bit but this time, you can use it only once. I said more than once that we have in JALv2 compiler the best open-source alternative possible regarding to up to PIC18F microcontrollers so, we can ignore Microchip's greed. I did some comparative tests between XC8 1.30 and JAL2.4q2 beta and the first test was obvious blinking a LED (identical source code for both compilers, pic18f46k22): [code] XC8 free / XC8 PRO / JALv24q2 Code space used: 148 92 98 bytes RAM space used: 2 2 4 bytes [/code] But of course, this means almost nothing so, I compiled another demo, "USB HID Mouse" : [code] XC8 free / XC8 PRO / JALv24q2 Code space used: 8153 4234 2540 bytes RAM space used: 204 190 54 bytes [/code] But for the last test, I should mention that the code is not identical - I compiled what I found in the compiler's packages. Also, for the USB Stack, XC8 use the free open-source stack, M-Stack of "Signal 11 Software", stack which will become popular for hobby projects (so that they says). Anyway, it should be a starting point in evaluating the JALv2 compiler which can be situated in the professional zone. And don't forget that the "Pic Micro Pascal v,2" of Philippe Paternotte is about to come and it will be another free professional option. Hobbit name: Togo Toadfoot of Frogmorton Elvish name: Mablung Miriel Beyound Arduino Lang |
||||
vasi Guru Joined: 23/03/2007 Location: RomaniaPosts: 1697 |
Now, lets see what we lost with all these changes "for the better", mainly done to provide the same tools for all three major operating systems and to attract some Arduino users. Why I didn't compiled the "HID Mouse" example from MAL - Microchip Application Library (later changed to MLA - Microchip Libraries for Applications)? Because the Microchip USB stack does not compile with XC8. But lets compile it with MPLAB C18. So, with all optimizations active and procedural abstraction from the demo period you get: [code] used code space: 2484 bytes used RAM space: 394 bytes [/code] After the demo period, you lose procedural abstraction and we get: [code] used code space: 3177 bytes used RAM space: 394 bytes [/code] A little bit larger, but infinitely better than XC8 in free mode. But not better than JAL compiler who use a port of Microchip USB Stack. Now is clear as crystal that the migration to XC8 is a no-no! Should be boycotted by all users. MPLAB C18 is at 3.46 version and the target microcontroller was 18f46j50. Hobbit name: Togo Toadfoot of Frogmorton Elvish name: Mablung Miriel Beyound Arduino Lang |
||||
JohnS Guru Joined: 18/11/2011 Location: United KingdomPosts: 3815 |
The snag is that JAL isn't C. So, much less sample code, tutorials and knowledge on the net or in books. If you adopt it and wish in the future to change uC, maybe to PIC32 or STM32, you're stuck with a ton of code and knowledge that's not much use. On PIC32, I'm using GNU gcc for PIC32 rather than xc32. I'm using essentially the same gcc for STM32 and AllWinner A10, A13 & A20. I abandoned PIC18 etc as a policy as soon as 32-bit chips and boards became so cheap. Things like Maximite could not be done as well or cheaply with smaller CPUs. My advice: abandon small Microchip devices as soon as you can. Go 32-bit. Stick to open source C compilers. I'm finding STM32 much better value and faster than PIC32 but that's a separate decision. John |
||||
vasi Guru Joined: 23/03/2007 Location: RomaniaPosts: 1697 |
JAL is perfect for PIC12F-PIC18F families. It is very close to ADA and that may be a path to follow. But I guess this is not a concern as many of people here have several learned languages to their background (when I started to learn JAL, I already had Basic, Pascal, C and C++ into my portfolio - hehe, JAL stands for Just Another Language). And can be a loss only if Microchip stops their fabrication line. Even if now I am into AVRs, I can't let PICs go yet. For thousands of projects, a 32bit microcontroller is overkill so 8bit still have his place into this planet. Sticking with JAL, you stick with an open source compiler so, no problem here. Especially when it is so good at generating small code. My admiration to his creator which is doing a better job than a horde of paid programmers. JAL's value is what makes me recommend it to others. Personally, I would go for 16bit (dsPIC33F, PIC24F/H) instead of 32 as PIC32 still have some silicon bugs and a PIC24 project can easily be ported later to PIC32 when this will get better revisions. But as you say, it can be STM32 in the end. Anyway, thanks for your advices and for your point of view. _____ BTW, apart of FAT32 file system (for SD-Cards and HDDs), Jallib (a huge collection of JAL libraries) comes with MINIX file system for the people who prefer that instead of Microsoft's file system. But there are also a lot of goodies to be discovered for free. Hobbit name: Togo Toadfoot of Frogmorton Elvish name: Mablung Miriel Beyound Arduino Lang |
||||
elproducts Senior Member Joined: 19/06/2011 Location: United StatesPosts: 282 |
I can't agree. I think 32-bit is great but there is a place for these small devices. Little 8 - 20 pin devices are so handy and nothing in 32 bit offers that. Plus DIP Packages for easy soldering or breadboard projects. Plus micros under $1 is possible in small volume. And then all the compiler options in BASIC and C. And for C programming, the new MPLAB Code Configurator makes creating a new project with I/O setup and peripheral code as simple as some mouse clicks on a GUI. One final click from there on the generate code button and I have a whole project of XC8 .c and .h code. www.elproducts.com |
||||
JohnS Guru Joined: 18/11/2011 Location: United KingdomPosts: 3815 |
Small volume under $1 is irrelevant unless your time is free and in plentiful supply. Generally time is in limited supply and may also be expensive. Even my hobby time I value quite highly so very cheap chips that mean using yet another non-standard language thus locking me in would be a complete no-no. (One of the reasons I stayed away from Arduino which as you probably know isn't open source as well as being poor value for money.) John |
||||
Geoffg Guru Joined: 06/06/2011 Location: AustraliaPosts: 3196 |
Interesting discussion on 8 vs 16 vs 32 bit chips and I just had to chime in (this is just my humble opinion and only relates to the Microchip line). There are some 8-bit chips that cost less than 1$ and I guess that for something like smart cards produced in volume they would be a viable option. Also, there are occasions when you need just an 8 or 14 pin chip and an 8-bit chip is the logical choice. But for the great amount of general "hobby" applications 32-bit chips are the way to go (IMHO). At the cheap end of the range (16K flash, 4K RAM) they cost about $2.10 (in one off quantities) and their current consumption is less than 6mA (at 8 MHz). Compare this to the venerable (and popular) 16F88 which costs about $2.60 and has 4K flash and 368 bytes RAM. About the only advantage that the 8-bit chips have is that their power consumption is a little less (eg, 2mA at 8MHz for the PIC16F88). For some reason the 32-bit chips have the reputation of being complex and this puts people off. I think that this comes from the type of chips found in mobile phones. But the PIC32 range are easier than the 8-bit or 16-bit chips to program. In particular, the 8-bit chips are riddled with frustrating architectural limitations like small integers, paged memory and paged registers. There are some modern 8-bit chips which have their specialised applications but when hobbyists refer to 8-bit chips they generally mean the old warhorses like the PIC16F88 and PIC16F884 which they use as a general purpose processor. The best thing about the 32-bit chips is that they have the memory and speed to make things like compiler optimisations irrelevant. With the 8-bit chips you need a good compiler or write in assembler. With the 32-bit chips you can use the free compiler with the huge amount of support libraries from Microchip and the 32-bit chip will swallow it without a burp and still run way faster than an 8 or 16-bit chip. A while ago I was talking to a Microchip engineer and he commented that the 32-bit line was taking over the 16-bit territory and encroaching on applications previously reserved for 8-bit chips. So, everyone is moving to 32-bit. Chips like the PIC16F88 were designed 20 or so years ago. The only reason why Microchip keep them in their catalogue is because there are some products designed years ago that are still in production. But, using them for new projects is like designing a new television set that uses valves! Geoff Geoff Graham - http://geoffg.net |
||||
Grogster Admin Group Joined: 31/12/2012 Location: New ZealandPosts: 9308 |
Yes, interesting comments, Geoff. Having now played with first the mono MM, then the colour MM, and having taught myself the MMBasic language pretty well, the idea that I can take 99% of that to the new MM chips is making me very pleased that I took the time to learn MMBasic at all. Naturally, there are some further bench-tests needed for the new MM chips, but once that is done, I fully expect to migrate my products from PICAXE to MM IC's. All the PICAXE chips are 8-bit, and they really are a great idea and product, but I am a little disappointed that RevEd have not developed a new 32-bit PICAXE chip, but they seemed to be uninterested in that when it was proposed by a few. They also did not seem too interested in bringing in things like floating point, which many wanted - it may simply have been too hard or nay on impossible to do with 8-bit architecture. Smoke makes things work. When the smoke gets out, it stops! |
||||
vasi Guru Joined: 23/03/2007 Location: RomaniaPosts: 1697 |
Hi Geoff, Regarding to PIC32, you are right when is about the top members of this family as MX4,MX6,MX7 but still... - meantime, Microchip released recently new performing products in 16F and 18F lines with bigger speeds than PIC16F88, up to 16MIPS, on par with Arduino (ATmega) (finally!!!); - some PIC18F come with more flash programming space than the MX1/MX2 lines (one good criteria why keeping them around): PIC18F27J53 128Kb flash space is bigger than PIC32MX150F128B 128Kb flash space. So, I can write more code inside PIC18F than in MX1/MX2 with enough execution speed (I could write more code anyway, even on par sizes); - you still need the professional version of the C32 compiler to make the Maximite/Micromite projects possible (yes @Grogster, that is required in order to enjoy PIC32) - consider that there are also other projects that may need a non-crippled compiler and that may consider this a big obstacle in adopting PIC32 (as we found out, there is not yet a viable free alternative). Firewing is another great project that would benefit immensely from non-crippled XC16 and XC32 compilers as the language is an important factor in choosing a microcontroller family (I think that until now, BASIC did a lot more for PIC32 than Wiring language, but I may be wrong). Anyway, Microchip can keep their compilers for themselves. If it weren't for JAL and PMP, I would have migrated to AVR long time ago (that happened in the end). But for some reasons (and probably because I'm stupid enough), I continue the lobby for JAL and PMP in Microchip favours, knowing the fact that you can make projects at a professional level without paying money for compiler licenses. Hobbit name: Togo Toadfoot of Frogmorton Elvish name: Mablung Miriel Beyound Arduino Lang |
||||
elproducts Senior Member Joined: 19/06/2011 Location: United StatesPosts: 282 |
Geoff, I respect your opinion and am in awe of your talents but I have to disagree. Arduino and all the vast amount of 8-bit PIC based projects created over the years and still being created shows you don't always need 32 bits. And if you want battery operated, the 8-bit PICs draw nano amps not milliamps. So there is clearly still a place for 8-bit. And that's not my opinion, it's just all over the "hobby" projects at MakerFaires and Make Magazine and Nuts & Volts projects just to name a few. Many 3D printers run on 8 bits. Not sure why you picked that device, it is very old. The new 16F1xxx parts as Vasi mentions have far more features, lots more memory, draw less power and run a lot faster on an internal oscillator with PLL Option and are less than 1/2 the price. And then there are the new CLC, NCO, CWG, PPS, and other core independent peripherals in the latest 8-bit PICs that give you simplified gate array type capabilities and more in a small 8-28 pin device. And the number of third party compilers with libraries that handle common functions like SPI, I2C, serial, driving LCDs, reading keypads, etc. and take care of any banking requirements makes programming them so easy for hobbyist projects. And now there is a GUI code developer (MPLAB Code Configurator) for the parts that makes creating XC8 C code just a few mouse clicks away. So is 32 bit great? Absolutely. Should a hobbyist learn to use 32 bit parts. Yes. I think so. Especially the MX1/2 parts. But other than the PIC32MX1/2 parts there aren't many "hobbyist" friendly DIP packages. I can easily get 8-40 pin 8-bit DIP parts everywhere. So 8-bit still has a place and to ignore it is really limiting your options for any "hobby" type project. www.elproducts.com |
||||
JohnS Guru Joined: 18/11/2011 Location: United KingdomPosts: 3815 |
vasi - I'm using PIC32 gcc with optimisation, not xc32. I don't see anything wrong with its optimisation. gcc is a good compiler and free. (Even so, Microchip are shooting themselves in the foot if not head by their crazy behaviour with xc32.) John |
||||
vasi Guru Joined: 23/03/2007 Location: RomaniaPosts: 1697 |
John, the C32 compiler must meet some requirements in order to compile Maximite/Micromite: - PLIB availability; - optimizations at the same level with the commercial one; - no libc replacements; - in Micromite's case, 16bit code generation. The free version of C32 compiler developed by Jason Kajita (Microchip's employee) can't do that as is based on newlib and does not generate 16bit code (or does not provide the 16bit libraries) - is the only official free c32 compiler with full optimizations from Microchip. There is also Pinguino C32 but I think it does not come with PLIB, 16bit code generation and I think it is also based on newlib. I know it is possible to compile your own C32 version, eliminating the check for a license and borrowing the libraries from a commercial package but that enters in a gray (if not black) zone and you can't distribute it, and you can't expect that regular people will be able to do the same (in short, this can't be used at a community level). If none of these custom builds can provide the same level of performance Microchip's Pro compilers provide, then we are talking about "crippled" compilers. I'm using avr-gcc and I get the same level of performance, no matter who prepared the toolkit: a linux distro, or Atmel himself so I know what I'm talking about. Now as far as I know, for a short period of time, the commercial MPLAB C32 was available for Linux. So, what kind of compiler do you use? Hobbit name: Togo Toadfoot of Frogmorton Elvish name: Mablung Miriel Beyound Arduino Lang |
||||
JohnS Guru Joined: 18/11/2011 Location: United KingdomPosts: 3815 |
You can build one with all optimisation & mips16 too. You can use plib if you want but why would you? It just ties you into Microchip, the very thing to avoid. For that matter since Microchip have ignored and abused GPL it would be safe and legal to avoid their license on xc32. If I planned to stay using PIC32 I'd report them to EFF et al. (If you use JAL you're stuck in a big way and won't have plib but plib is a diversion from anything that matters.) You stick to xc8 etc if you wish but not me. I've been down the vendor-lock-in route before more than once (it's what you suffer as an employee with management who insist on wrong ways of doing things) and it hurts, every time without exception. JAL is another form of lock-in. If it suits someone, fine, but realise you're locked in. You don't see Microsoft, Linux, Android using it. As for the little chips and all the claimed wonders. Be happy but again you're locked in to Microchip and moving code or knowledge isn't realistic. John |
||||
vasi Guru Joined: 23/03/2007 Location: RomaniaPosts: 1697 |
This guy is washing the floors with XC8 in a manner that will close the mouth of anyone defending it. I mean, you can't deny the facts. Anyway, he concludes his article in a positive tone: [quote]The recent Microchip decision of optimizing the GOTOs makes me think that Microchip plans to provide compilers without restrictions in a near future. They are probably waiting some time before doing that because they don’t want to kick out of business to all those third-party compilers who had been supporting the company for so many years. Microchip could be giving them some courtesy years to change their business before releasing a free full featured compiler.[/quote]. Is what I like in the end and hope for. The problem is, I need it now! As for moving knowledge from JALv2, that is possible. There is (and always will be) ADA language, intensively used in Medical, Military, Space fields, etc. See here the main ADA customers. As for staying with Microchip, there are MIPS "microcontrollers" on Android and Linux: http://www.imgtec.com/mips/developers/ http://www.informationweek.com/desktop/android-device-chip-r ace-mips-takes-on-arm/d/d-id/1106058 I don't care too much about Microchip, but we have to be accurate. Hobbit name: Togo Toadfoot of Frogmorton Elvish name: Mablung Miriel Beyound Arduino Lang |
||||
Print this page |