Author Topic: Compiling firmware on two different platforms  (Read 2260 times)

0 Members and 1 Guest are viewing this topic.

Offline tarun172Topic starter

  • Regular Contributor
  • *
  • Posts: 63
  • Country: us
Compiling firmware on two different platforms
« on: July 03, 2013, 08:42:36 pm »
Hello Guys,
                  I was given an old code to work recently. The code used a generic processor along with a commercially available RTOS. The problem was the compilation was complicated (when different tools for program, and development) and gcc compiler used was version specific. |O |O This code used it's own make custom written makefile. Now, I wanted to make this simple by getting it to work on MPLAB and program it using the same IDE (easy right?Not so fast). I spent a lot of time setting the compiler and finally got it to work on MPLAB with hi-tech PICC compiler this week. The program now compiles fine and generates a hex file.
                 When I loaded this new hex file in the processor, it did not work.  :-//. I noticed that in the hex file the code is smaller. BTW, I turned off code optimization and played around with the compiler settings. Any ideas where do I start and how do I fix this issue?

- Tarun
Thanks & Regards,
Tarun S
 

Offline nctnico

  • Super Contributor
  • ***
  • Posts: 26907
  • Country: nl
    • NCT Developments
Re: Compiling firmware on two different platforms
« Reply #1 on: July 03, 2013, 09:26:38 pm »
Don't use PIC but a processor which is supported by GCC. Each C compiler has its own platform specific slang (pragmas and language extensions) so in general its not easy to move C code from one compiler to another.
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Offline adam1213

  • Regular Contributor
  • *
  • Posts: 120
  • Country: au
Re: Compiling firmware on two different platforms
« Reply #2 on: July 10, 2013, 09:16:33 am »
Start by checking that the configuration bits are correct (e.g oscillator settings). The way that configuration settings is specified may differ between compilers. Getting it correct is crucial in making the program run.

The makefile might specify defines which are used by the source code (e.g. look for "-d" being passed to the compiler or in CC_FLAGS etc). Moving the project to MPLAB may mean you need to copy the defines from the makefile to the project compilation settings.

Different compilers produce different binary sizes. When you say the hex file is smaller, how small? is it so much smaller than you think it can't possibly be correct?
Are you building for the PIC12F683? (based on Microcontrollers & FPGA's / Re: Using MPLAB with salvo)
Have you included the RTOS in the hex file / are you using the  same processor and RTOS as before or a different one?
Does the compiler produces any warnings? (you may need to clean then build to get a full list)

Is your aim to compile for one platform or multiple?

As you asked about using MPLAB for compilation I have attempted to offer basic advise related to this. Using MPLAB's build process has limitations. However it is also simple to use once it works.
« Last Edit: July 10, 2013, 09:22:36 am by adam1213 »
 

Offline tarun172Topic starter

  • Regular Contributor
  • *
  • Posts: 63
  • Country: us
Re: Compiling firmware on two different platforms
« Reply #3 on: July 12, 2013, 01:53:13 pm »
@adam1213. Yes, iT is the same project. The configuration bits are set in the main file. I added prepossesser directives and include file paths in the compiler setting. I got a bit curious and ran a simple delay program using salvo. It did not work. The program might lie get salvo, MPLAB and HI-tech compiler.

- Tarun
Thanks & Regards,
Tarun S
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf