chipKIT® Development Platform

Inspired by Arduino™

port code compiled w MPIDE to MPLAB for an embedded app?

Created Sun, 06 Apr 2014 15:12:28 +0000 by greatnorthern


greatnorthern

Sun, 06 Apr 2014 15:12:28 +0000

sorry if this is in the wrong place, I've been trying all night to no avail to take the compiled Blink.cpp.hex over to MPLAB X and program the Uno32 with my PICkit 3.. it programs, verifies, but does not appear to work.. what am I missing?

I'm really brand new to the ChipKit scene, I wanted something faster and beefier to work with than the Atmega328, but not so much as the ARM in the Due.. I felt this was a good compromise.

my applications for this will need to be programmed from MPLAB via ICSP in the end. I am hoping this is simple and I'm just not catching on yet :)

thanks!


majenko

Sun, 06 Apr 2014 17:02:45 +0000

You will have to compile the .hex using a special non-bootloader .ld script. The config settings are held in the bootloader - when you write the .hex with a PK3 you will be replacing the bootloader, and hence all the config settings.

You will need to make your own custom board definition in MPIDE and change the ld script it uses (non-bootloader scripts are provided).


greatnorthern

Mon, 07 Apr 2014 00:09:42 +0000

Hi Majenko, thanks so much for the reply. I have found the non-bootlaoder .ld script in the "cores" folder. How would I proceed to compile the .hex with this?

Also, what does making my custom board definition entail? is it in the "boards.txt" file? sorry but I am a noob to all of this backend stuff :) thanks!!


majenko

Mon, 07 Apr 2014 00:33:36 +0000

Yes, you need to edit the boards.txt file. Copy the section for your board and rename it (for the UNO32 you'd find all the entries starting uno_pic32.* and copy them renaming them to something else, like uno_pic32nb.*). Change the name of the board (uno_pic32mb.name=chipKIT UNO32 Without Bootloader) and change the uno_pic32nb.ldscript entry to use the non-bootloader version of the linker script. Load MPIDE, and you should have a new board.

This is what you might end up with:

uno_pic32nb.name=chipKIT UNO32 No Bootloader
uno_pic32nb.group=chipKIT
uno_pic32nb.platform=pic32
uno_pic32nb.board=_BOARD_UNO_
uno_pic32nb.board.define=
uno_pic32nb.ccflags=ffff
uno_pic32nb.ldscript=chipKIT-application-32MX320F128-nobootloader.ld
uno_pic32nb.compiler.c.flags=-O2::-c::-mno-smart-io::-w::-ffunction-sections::-fdata-sections::-G1024::-g::-mdebugger::-Wcast-align::-fno-short-double
uno_pic32nb.compiler.cpp.flags=-O2::-c::-mno-smart-io::-w::-fno-exceptions::-ffunction-sections::-fdata-sections::-G1024::-g::-mdebugger::-Wcast-align::-fno-short-double
uno_pic32nb.upload.protocol=stk500v2
uno_pic32nb.upload.maximum_size=126976
uno_pic32nb.upload.speed=115200
uno_pic32nb.bootloader.low_fuses=0xff
uno_pic32nb.bootloader.high_fuses=0xdd
uno_pic32nb.bootloader.extended_fuses=0x00
uno_pic32nb.bootloader.path=not-supported
uno_pic32nb.bootloader.file=not-supported
uno_pic32nb.bootloader.unlock_bits=0x3F
uno_pic32nb.bootloader.lock_bits=0x0F
uno_pic32nb.build.mcu=32MX320F128H
uno_pic32nb.build.f_cpu=80000000L
uno_pic32nb.build.core=pic32
uno_pic32nb.build.variant=Uno32

... or just copy and paste that lot into your boards.txt file ;)

And here's the result - just select that board, compile the sketch, and you should have a .hex you can work with: [attachment=0]nobootloader.png[/attachment]


greatnorthern

Mon, 07 Apr 2014 00:56:03 +0000

thanks again! I will try this too, but what I have just figured out in the mean time is that this: http://www.chipkit.net/forum/viewtopic.php?f=19&t=2520 method works, apparently. I simply imported the .elf and added the newest bootloader to the "loadables" folder in MPLAB and hit "make and program" and it worked, it loaded the bootloader as well as the .hex on, as I'm still able to update the board in MPIDE.. any caveats to doing it this way other than the size of the bootloader?


tcsaba101

Tue, 08 Apr 2014 16:16:51 +0000

Hi, there is something what would help.

I have a document in my hand (on CD) which describes the MPIDE MPLABX integration, also supplied with MPLABX sample project files. You can see the abstract in this document on page 13 under Class 17007: http://techtrain.microchip.com/usmasters/MASTERsDetails2013.pdf

I couldn't find on the net the files itself, and unfortunately I can't upload to the forum, it is preventing to upload pdfs. If you need it, I can send by email.

I haven't tried it yet. I use Uecide for developing, but it should not be a problem to go back to mpide for the debugging. Maybe Majenko will explain how to apply this knowledge from uecide?!


majenko

Tue, 08 Apr 2014 16:39:13 +0000

Well, under the hood UECIDE and MPIDE are the same from a compilation PoV. They use different techniques to do the compiling, but the source code they use and the end result are the same - UECIDE just uses multiple libraries (libXXX.a) whereas MPIDE uses one "core.a" file plus lots of object files.

I have no clue what the documented method of using MPLAB-X with MPIDE sketches is.

If you want to send me the PDF(s) you could upload them to my FTP server - ftp.sqsol.co.uk (login anonymously as ftp) and place them in the "incoming" folder.


tcsaba101

Tue, 08 Apr 2014 16:57:41 +0000

I have uploaded.

Please comment, should I start to struggle with the integration?


majenko

Tue, 08 Apr 2014 17:53:44 +0000

By all means go for it. The main thing MPIDE does (by the look of things) is build an elf file - that is the same in UECIDE. It's simpler there though as you have the Sketch menu entry "Show Build Folder" which will open the location where the elf file is for you to get at it easier.


guymc

Tue, 08 Apr 2014 19:58:31 +0000

For more info on the board variant mechanism in MPIDE, have a look at the instructions here:

http://chipkit.net/chipkit-mpide-board-variant-mechanism/

Cheers


tcsaba101

Thu, 10 Apr 2014 20:04:08 +0000

http://chipkit.net/chipkit-mpide-board- ... mechanism/ Cheers

It's heavy, but gooooood. Needs energy to digest.

Egeszsegedre (Cheers in Hungarian :D )


tcsaba101

Wed, 23 Apr 2014 09:52:18 +0000

I was able to debug MPIDE sketch, using uC32 board, PGM programmer in MPLABX. :) see here: http://chipkit.net/forum/viewtopic.php?f=6&t=2861&start=30

Cheers!