1

I am using CCS, Inc. PCWHD Version 4

I am asked to compile and run C files on CCSC compiler, but the problem is unlike GCC and turbo it is not giving ".exe" (application file) on compilation. I am getting files with .cod, .err., .hex, .ESYM, etc. So out of which .hex must be executed (burn to IC); but I want to test it before burning.

How can I run hex or some other way of testing the code using CCSC compiler?

Clifford
  • 88,407
  • 13
  • 85
  • 165
krishna
  • 3,148
  • 5
  • 19
  • 24
  • I think you'd be better epost your *actual* question "how do I do unit testing for embedded systems". But first see these: http://stackoverflow.com/questions/10309866/unit-testing-for-embedded-system http://stackoverflow.com/questions/4230177/unit-testing-on-embedded-c-arm9 http://stackoverflow.com/questions/5904335/continuous-integration-unit-testing-in-embedded-c-systems http://stackoverflow.com/questions/115115/test-automation-with-embedded-hardware – Martin Thompson Apr 17 '13 at 09:25
  • 1
    Do not close your question when you have an answer - that is bad form. Only questions that do not meet SO's criteria are closed. If your question attracts criticism or closure votes, you should improve your question. Others may "improve" it for you. – Clifford Apr 17 '13 at 19:49
  • @Clifford i mean the same.. I thought S.O may fell it is not upto standard , amy recommand to close... Befor its answered.. :) – krishna Apr 18 '13 at 04:38
  • 1
    @krishna: So far it looks fine; I cleaned it up a bit - hopefully without changing the meaning. Questions work best if they are direct and to the point, and to some extent "de-personalised". – Clifford Apr 18 '13 at 08:26

3 Answers3

2

i dont know about your Custom computer services compiler but i'm experienced with TI CCS. .hex- basically intel hex format which stores your code in machine language and in the Hex format. this is generated by your compiler for that particular hardware(uC) that your working on.

.exe - contains machine code(generally)(and with resources) generated for your machine(host).

"I want to test it before burning" -
1) usually your IDE will have a simulator option whereby you can "Simulate" the uC. this will be in your compiler options usually. this is what your looking for. check this out if your IDE has no simulator

2)you can do real time debugging(your CCSCinc supports this as indicated by Link). this is more flexible as you can know what actually is happening. sometimes interrupts are hard to 'simulate' but easier if your doing hardware Debug.

Koushik Shetty
  • 2,146
  • 4
  • 20
  • 31
2

The PIC instruction set and architecture is entirely different than that of the development host, the CCS compiler cannot target x86 so cannot produce an executable that can run on the PC - it is a cross compiler. Parts of your application that are not hardware dependent may however be portable and might be tested on a PC by compiling in a host compiler, however you need to be aware that because it is a 32 bit architecture, data type sizes and numeric ranges will differ. If you carefully abstract your hardware this can be quite an effective technique since you can stub the hardware abstraction layer with a test harness or simulation code.

On a PIC microcontroller, code runs from on-chip ROM - the PIC architecture cannot execute code from RAM, so you have no choice but to burn the code to on-chip ROM in order to execute it on hardware. Most parts use flash memory which is erasable and re-writeable, so testing your code should not be a problem. There are one-time programmable parts, but you would not usually use these for development for obvious reasons!

Ideally for test and debug you should have an in-circuit debugger to allow you to program, run, step and breakpoint your code from a development host connected to the hardware.

An alternative (though often not entirely satisfactory) approach is to test and execute your code in a simulator. CCS does not appear to have an integrated simulator, so you would have to use Microchip's MPLAB SIM instead.

Clifford
  • 88,407
  • 13
  • 85
  • 165
1

The CCS C compiler does not build .exe files. It builds programs for PICs, DSCs, etc. Windows runs .exe files, Microchip processors don't. The files your compiler produces the correct output, provided that stuff builds with no errors. You have to load it onto the right processor or an emulator to run. They won't run in Windows.

Clifford
  • 88,407
  • 13
  • 85
  • 165
Phonon
  • 12,549
  • 13
  • 64
  • 114