chipKIT® Development Platform

Inspired by Arduino™

Max32 ELF on slightly different PIC32

Created Fri, 26 Oct 2012 15:38:46 +0000 by cgclepper


cgclepper

Fri, 26 Oct 2012 15:38:46 +0000

Greetings all

I have worked up a nice prototype using the Max32 board, but would like to shift to a different lower cost chip for eventual production. The MX695 series have the same pinout and only lack the CAN feature, which is not used in my project, so would the ELF from the Max32 chip load and work on that? What about a 795 series with less RAM?

If the images are not compatible, what needs to be done in MPIDE to make it work? Is it just some compiler options or would it require extensive work to accomplish?

The fact that the Microchip data sheet is the same for all of the chips I'm looking at gives me some hope, but I have no idea how compatible the chips really are.

Thank you Chris


EmbeddedMan

Fri, 26 Oct 2012 16:01:07 +0000

Chris,

I'm pretty sure (note: not tested, just thinking) that the ELF file should work just fine on the 695 processor.

That being said, one of the huge advantages of MPIDE is that it's super easy for users to create new board variations, with different processors and I/O pins and such. You end up doing 3 things:

  1. Create a new varients folder, populate with proper code (copy from closest existing board, modify if needed)
  2. Add a new entry to boards.txt (again, copy/paste closest existing board, then modify to suit)
  3. If you are using a new processor that hasn't been used before in MPIDE (which I think you would be) you'll need to modify your avrdude.conf files with information for the new processor. Again copy/paste from closest processor.

*Brian


cgclepper

Fri, 26 Oct 2012 16:43:18 +0000

Hi Brian

Thanks for the quick reply!

I'm coming from Mac/Win development where cross compiling for various chip targets is easy and common. Are there any further instructions on adding new boards to MPIDE? I see some chip specific .ld files - do I need one of those for the additional chip?

I also put in a ticket with Microchip to see what they have to say about binary compatibility and cross compilation in general.

Thanks again Chris


EmbeddedMan

Fri, 26 Oct 2012 19:55:24 +0000

Chris,

Well, I can tell you that Microchip supports cross-compiling from their compilers (obviously) - so they probably won't have much to say (since MPIDE is NOT a Microchip product).

The answer to your first question is yes - that's a step I forgot. Copy/paste a close processor, and simply modify the memory ends if necessary.

I think, since the processor you are moving to has the same amount of memory, that you won't have to change anything in all of the little pieces you are copy/pasting, other than the processor name.

The only real change for you will happen because the boards.txt file passes the processor part number into the compiler on the command line. The compiler then includes the right libraries and header files and such.

*Brian


cgclepper

Fri, 26 Oct 2012 20:48:45 +0000

Brian

Here are the steps I'm going to do for a new build target:

  1. Copy Max32 folder in variants to MyNewPIC. Do I need to change the BOARD_NAME #define in the .h file?

  2. Copy chipKIT-MAX32-application-32MX795F512L.ld to MyNewPIC.ld - anything to edit? All of the memory regions look the same between the files already there.

  3. Edit boards.txt by copying the Max32 section and editing the .ld file and mcpu type. Keep BOARD_MEGA as the pinout since it will be the same?

  4. Edit avrdude.conf by copying the 32MX795F512L section and replacing the cpu name with what I'm using. I don't really understand anything else in that conf file though!

I also found a bunch of libmhcp_peripherals_.a files for every PIC32 - are those linked in the build process?

After all of this I guess I'll be using the MPLAB debug process to put the ELF file on the target using a PicKit3?

Anything I'm missing?

Thanks again for your invaluable help!

Chris


EmbeddedMan

Fri, 26 Oct 2012 21:19:25 +0000

Chris,

I think you've got it. For each of those, you will need to update the name of the processor, but since the memories are the same, you can leave those.

The proper .a files do get linked in by the linker when you pass in the proper processor number to the compiler.

*Brian


cgclepper

Sat, 27 Oct 2012 00:04:56 +0000

Brian

I'll give compilation a try this weekend, but it will be a bit before I can test the image in practice. I will be sure to report any progress here.

Maybe the above info can be put in the wiki by someone?

Thanks Chris