Author Topic: MPLABX and different board configurations  (Read 2223 times)

0 Members and 1 Guest are viewing this topic.

Offline JJallingTopic starter

  • Supporter
  • ****
  • Posts: 250
  • Country: dk
MPLABX and different board configurations
« on: January 04, 2016, 09:55:59 am »
Hi,

I have a product with a PIC microcontroller on the board. The board exists in (currently) two revisions, and each revision has a slightly different PIC micro (both PIC18).
Is it possible to support both boards in the same project in MPLABX?

How do you handle a situation like that? Have a project for each board revision, and keep the sources in sync betweeb the two?

BR Jonas
 

Offline Feynman

  • Regular Contributor
  • *
  • Posts: 199
  • Country: ch
Re: MPLABX and different board configurations
« Reply #1 on: January 04, 2016, 10:28:31 am »
You can add different configurations for one project. Each configuration has its own project settings (target processor, compiler, ... everything). Copy your "default" configuration as a starting point.

If your code depends on the board revision, you can add compiler macros (defines) for each configuration.

Code: [Select]
#if defined(BOARD_REV1)
    // conditional code
#elif defined(BOARD_REV2)
    // conditional code
#else
    #warning no board revision selected
#endif
« Last Edit: January 04, 2016, 10:55:19 am by Feynman »
 

Offline JJallingTopic starter

  • Supporter
  • ****
  • Posts: 250
  • Country: dk
Re: MPLABX and different board configurations
« Reply #2 on: January 04, 2016, 10:35:15 am »
Excellent, that does the job!! Thanks

BR Jonas
 

Offline Howardlong

  • Super Contributor
  • ***
  • Posts: 5411
  • Country: gb
Re: MPLABX and different board configurations
« Reply #3 on: January 04, 2016, 09:34:10 pm »
Another option I've used in order to simplify field distribution of firmware is to probe the board at runtime during boot up. That way there's only one firmware file, but it assumes your using roughly the same processor, and the board versions aren't too dissimilar.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf