as you might guess from the subject: I'm trying to find a toolchain for freescale's hcs12 or S12X family of microcontrollers. Currently i'm using Codewarrior on the Windows machine at work, but as i'm a tad dissatisfied by it's lack of decent syntax-checking and have no windows at home, i'd rather use some free compiler available for my rather unusual platform (Linux on PowerPC). So gcc would probably be the best bet.
Has any of you guys experience with that combination or another suggestion (apart from buying some windows machine)??
gcc provides better syntax checking than any other compiler I have tried. However, I don't believe there is a gcc port for the 68HCS12 - if such a thing exists, it would only be as a minor partial port. But there are a couple of other ways to achieve what you want without dropping Codeworrier.
It is quite possible to use gcc for a different target as a static analysis tool. I've done that along with a commercial compiler for a target (I've forgotten which - it was a long time ago) - gcc "compiles" the program natively for the host (linking tended to fail...). It might mean a little bit of fiddling to get the right headers at the right place, and perhaps an extra header defining macros for any compiler extensions used by the real target compiler, but it can often work well. You can also use gcc to generate the makefile dependencies at the same time.
An alternative is to use a dedicated static analysis tool. The big one is PC-Lint, which is a reasonable price on Windows (but absurdly four times the price on Linux - and I doubt they support PPC Linux). The open source option is splint, which should be fine on your system.
--
Regards,
Richard.
+ http://www.FreeRTOS.org & http://www.FreeRTOS.org/shop
17 official architecture ports, more than 5000 downloads per month.
+ http://www.SafeRTOS.com
Certified by TÜV as meeting the requirements for safety related systems.
Building a toolchain isn't too hard. Below is the shell script I used last time I built a toolchain for the 6812. That was probably a couple years ago I included newlib in my build, but IIRC, you can build a 6812 compiler without any libc at all if you prefer.
What do you mean by a "minor partial port"? It's in the mainline gcc source tree, and it seemed to work fine for me. The code it generated was far better than the last commercial
6811 compiler I used.
--
Grant Edwards grante Yow! Gee, I feel kind of
at LIGHT in the head now,
visi.com knowing I can't make my
satellite dish PAYMENTS!
I'm not necessarily into dropping Codewarrior, i thought more like using gcc as some sort of syntax check while not at work, so i can test the stuff at home and concentrate on fixing this mess at work ;-) Proper binaries would be an added bonus though.
And -- i just checked -- the gcc man page lists in the "machine dependent options" section the options -m68hc12 and -m68hcs12 in version 4.3.0. I'll probably try and get this to work, but as said: using gcc as a mere syntax checker would already be a start.
Understand your frustration with codewarrior, however one reason for sticking with it is the fairly good BDM in-circuit debug capability of the HCS12 family.
The pod will set you back $100, but ultimately it is worth it.
I don't know if a gcc-based tool chain will really be able to leverage that.
Gcc is a single-target design: you have to build a separate gcc installation for each target architecture. IOW, you can't switch from IA32 to HC12 target architecture by merely changing the command line arguments passed to a single gcc binary.
In my experience splint is useless for real world work. It'll warn you about code like this:
uint8_t b; b = 1;
Splint is unhappy because b is 8 bits wide and "1" is 16 or 32 bits wide (depending on your target), and the assignment is loosing bits. If you turn that warning off, then you _won't_ get warned about code like this:
uint32_t u; uint8_t b; b = 123456789L; b = u; The only solution is to completely cover your code with type-casts. The result is code without splint warnings, but it's completely impossible to read/maintain. I looked into trying to fix up splint to make it useful for real work, but gave up after looking at the internals. The "owners" of splint acknowledged on the splint mailing list that splint was intended for language research and not for use with real programs.
--
Grant Edwards grante Yow! Is this going to
at involve RAW human ecstasy?
visi.com
ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here.
All logos and trade names are the property of their respective owners.