chipKIT® Development Platform

Inspired by Arduino™

MPLAB X project configurations for stk500v2 bootloader

Created Thu, 21 Jul 2011 11:15:55 +0000 by Hazard


Hazard

Thu, 21 Jul 2011 11:15:55 +0000

Hello, I don't know for which section of the forum this question would be more adequate, sorry if it is in the wrong place.

Has anyone successfuly built some example for MAX32 using MPLAB X and uploaded it with avrdude and the stk500v2 bootloader?

I'm trying not to use ICD3 or Microchips USB/Serial bootloader. I'm trying to take advantage of the existing stk500v2 bootloader that comes with the MAX32 board, so that I can program using C and MPlab X, and other people that I share the board with, can program using MPIDE and Arduino sketches.

Can anyone help me? Thanks


svofski

Thu, 21 Jul 2011 13:53:03 +0000

I'm not sure about MPLAB X, but I'm programming this board in plain C++ in vi, compile with make and upload code wtih avrdude (it's just a build target in my makefile). All of this uses same gcc that's packaged with "arduino" ide for Max32. I'll share my Makefile once I get home. It's for Mac, but it should not make significant difference if you're on Linux. On Windows I'd expect major pain down below when trying to use make and gcc, but the IDE is probably made to remedy that.


boutboutnico

Thu, 21 Jul 2011 15:50:22 +0000

Cygwin should make it compatible for windows.


svofski

Thu, 21 Jul 2011 16:01:28 +0000

If gcc, binutils and make are a part of MPLAB X, Cygwin is not necessary. I've been using WinAVR for years in a similar setup, no probs.


Hazard

Thu, 21 Jul 2011 17:05:31 +0000

I'm not sure about MPLAB X, but I'm programming this board in plain C++ in vi, compile with make and upload code wtih avrdude (it's just a build target in my makefile). All of this uses same gcc that's packaged with "arduino" ide for Max32. I'll share my Makefile once I get home. It's for Mac, but it should not make significant difference if you're on Linux. On Windows I'd expect major pain down below when trying to use make and gcc, but the IDE is probably made to remedy that.

Thank you, it would be great. I think it may be a problem with addresses in the linker or something.


svofski

Thu, 21 Jul 2011 18:06:29 +0000

Ok, here goes, get it here: http://pastebin.com/31XXwmUV

The sources are expected to be in subfolders, names of which you list in SOURCES variable. If you have sources e.g. in source and in source/sdk you need to specify both. Addresses and all the sections are specified in the linker script, it must be what you've had missing. To upload the code, just 'make burn', but see -P/dev/tty.usbserial-A5004H5Q option, you'll probably have to adjust it to your reality.

This Makefile is raw and could use a bit of polishing, but it works. It's based on some of the makefiles from devKitPro for ARM. Yeah, a word for a wishing well — I wish Microchip would use a brain for a change and make a decent barebones SDK instead of those monstruous IDEs they push with such tenacity. Also, in my most intrepid dreams, such SDK would also be downloadable as a zip archive which contains actual files, not an .exe installer (or whatever platform format be it), but this, of course, would never happen.


avenue33

Tue, 15 Nov 2011 08:33:50 +0000

Hi!

Thank you for sharing the Makefile.

When I try it with Xcode, I get the following error message:

make

pic32-g++    -Wl,--gc-sections -mprocessor=32MX795F512L -Xlinker -T/Applications/Mpide.app/Contents/Resources/Java/hardware/pic32/cores/pic32/chipKIT-MAX32-application-32MX795F512L.ld -Xlinker -o/Users/avenue33/Desktop/Xcode_chipKIT/main.elf -Xlinker -M -Xlinker -Map=/Users/avenue33/Desktop/Xcode_chipKIT/main.map
/Applications/Mpide.app/Contents/Resources/Java/hardware/pic32/compiler/pic32-tools/bin/../lib/gcc/pic32mx/4.5.1/../../../../pic32mx/lib/cpp-startup.o: In function `_main_entry':
(.text+0x10): undefined reference to `main'
collect2: ld returned 1 exit status
make[1]: *** [/Users/avenue33/Desktop/Xcode_chipKIT/main.elf] Error 1
make: *** [build] Error 2
Command make failed with exit code 2

Have you experienced similar case :?: Thanks.