chipKIT® Development Platform

Inspired by Arduino™

Can't compile the bootloader for Max32

Created Sat, 29 Oct 2011 06:47:11 +0000 by drBart


drBart

Sat, 29 Oct 2011 06:47:11 +0000

Hello, I recently got into C/C++ programming for microcontrollers. I picked up an Arduino Uno, and later a Max32. I wanted to see if there was a performance differance between the code compiled in MPIDE vs. MPLAB-X (there was, but the code in MPLAB-X was slower, it seemed. Another topic for another time). At anyrate, I went to compile the bootloader on GitHub: /chipKIT32/pic32-Arduino-Bootloader, but it doesn't seem to want to compile.

I did set the configuration for Mega, and I am using a PicKit3, though I do have an ICD 3, and Real Ice as well.

Here's my compile error:

make -f nbproject/Makefile-mega.mk SUBPROJECTS= .build-conf
make[1]: Entering directory `/d/arduino/chipKIT32-pic32-Arduino-Bootloader-498abef'
make  -f nbproject/Makefile-mega.mk dist/mega/production/chipKIT32-pic32-Arduino-Bootloader-498abef.production.elf
make[2]: Entering directory `/d/arduino/chipKIT32-pic32-Arduino-Bootloader-498abef'
C:\\Program\ Files\ \(x86\)\\Microchip\\mplabc32\\v2.01\\bin\\pic32-gcc.exe   -mprocessor=32MX795F512L -nostartfiles -o dist/mega/production/chipKIT32-pic32-Arduino-Bootloader-498abef.production.elf build/mega/production/pic32bootloader.o build/mega/production/startup.o        -Wl,--defsym=__MPLAB_BUILD=1,--report-mem,--script=boot-linkerscript.ld,--gc-sections,-Os,-Map="map.txt",--cref
c:/program files (x86)/microchip/mplabc32/v2.01/bin/../lib/gcc/pic32mx/4.5.1/../../../../pic32mx/bin/ld.exe: warning: Sections: .debug_ranges, .debug_pubtypes, and .gnu.attributes should be mapped in the linker script.
data_init: Link Error: Could not allocate section .dinit, size = 8 PC units, attributes = code 
data_init: Link Error: Could not allocate section .dinit, size = 8 PC units, attributes = code 
 Link Error: Could not allocate program memory
collect2: ld returned 1 exit status
make[2]: *** [dist/mega/production/chipKIT32-pic32-Arduino-Bootloader-498abef.production.elf] Error 1
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2
make[2]: Leaving directory `/d/arduino/chipKIT32-pic32-Arduino-Bootloader-498abef'
make[1]: Leaving directory `/d/arduino/chipKIT32-pic32-Arduino-Bootloader-498abef'

BUILD FAILED (exit value 2, total time: 15s)

Jacob Christ

Sat, 29 Oct 2011 15:45:44 +0000

Is the Mega not an Atmel based Arduino? I have not yet tried to compile the bootloader but I may soon.

Also when you say that MPLABX was slower, are you refering to compile time or execution speed of compiled code?

Jacob


drBart

Sat, 29 Oct 2011 20:28:29 +0000

The board that I'm working with is a Max32.

The MPLABX project for the bootloader has multiple configurations for various boards.

uno-64k uno-128k mega microchip-pic32-starter-kit etc.

Since the Max32 is the equivalent of the Arduino Mega, I went with the Mega configuration. However, it never gets as far as programming the board, so the actual board and programmer used are irrelevant at this stage.

I think these are the pertinent lines in the error:

data_init: Link Error: Could not allocate section .dinit, size = 8 PC units, attributes = code 
data_init: Link Error: Could not allocate section .dinit, size = 8 PC units, attributes = code 
Link Error: Could not allocate program memory

drBart

Sat, 29 Oct 2011 20:48:46 +0000

I found the HEX file on the Digilent website and I was able to load that to my board using the PicKit3.

Still, it would be nice to know why the source didn't compile.

Also, I started another thread in the "Using ChipKIT" board to discuss the performance issues I mentioned in the OP.


Jacob Christ

Sun, 30 Oct 2011 05:53:30 +0000

I was able to compile the bootloaders today using MPLABX from a fresh install. I tried both Uno32 64K target and the Mega target. Now that I've tried it, it makes sense that the Mega is for the Max32 and that it couldn't compile for an Atmel chip, since this is the Microchip tool.

We built a custom board based on the Uno32 and inadvertently ordered 64K chips. Since we were anxious to test the board we just desoldered the 128K chip from an Uno32 board and put it on our board. I put the one of the 64K chips back on the Uno32 and finally had time today to try out the 64K bootloader on the Uno32 with the 64k chip and it works great.

Side note: I wasn't able to burn the hex files using MPLABX, I had to use MPLAB 8. I tried to use the driver switcher and it said it worked properly but it did not. I'm using an ICD3.

Jacob