Created Mon, 19 May 2014 10:56:51 +0000 by avenue33
Mon, 19 May 2014 10:56:51 +0000
I'd like to use the chipKIT PGM to upload and debug sketches developed with MPIDE. The procedure exposed here is quite complicated as it involves MPLabX.
MPIDE includes link scripts for the chipKIT with no boot-loader.
I've edited the boards.txt file adapting this post (Oct 13, 2011)
############################################################
uno_pic32_dbg.name=chipKIT UNO32 - MPLAB Debug
# new items
uno_pic32_dbg.group=chipKIT
uno_pic32_dbg.platform=pic32
uno_pic32_dbg.board=_BOARD_UNO_
uno_pic32_dbg.board.define=
uno_pic32_dbg.compiler.define=
uno_pic32_dbg.ccflags=ffff
uno_pic32_dbg.ldscript=chipKIT-application-32MX320F128-nobootloader.ld
# end of new items
# Use a high -Gnum for devices that have less than 64K of data memory
# For -G1024, objects 1024 bytes or smaller will be accessed by
# gp-relative addressing
uno_pic32_dbg.compiler.c.flags=-O0::-c::-mno-smart-io::-w::-ffunction-sections::-fdata-sections::-G1024::-g::-mdebugger::-Wcast-align::-fno-short-double
uno_pic32_dbg.compiler.cpp.flags=-O0::-c::-mno-smart-io::-w::-fno-exceptions::-ffunction-sections::-fdata-sections::-G1024::-g::-mdebugger::-Wcast-align::-fno-short-double
uno_pic32_dbg.upload.protocol=stk500v2
uno_pic32_dbg.upload.maximum_size=126976
uno_pic32_dbg.upload.speed=115200
uno_pic32_dbg.bootloader.low_fuses=0xff
uno_pic32_dbg.bootloader.high_fuses=0xdd
uno_pic32_dbg.bootloader.extended_fuses=0x00
uno_pic32_dbg.bootloader.path=not-supported
uno_pic32_dbg.bootloader.file=not-supported
uno_pic32_dbg.bootloader.unlock_bits=0x3F
uno_pic32_dbg.bootloader.lock_bits=0x0F
uno_pic32_dbg.build.mcu=32MX320F128H
uno_pic32_dbg.build.f_cpu=80000000L
uno_pic32_dbg.build.core=pic32
uno_pic32_dbg.build.variant=Uno32
#uno_pic32_dbg.upload.using=
Compilation runs fine but link fails with the following message:
/Applications/Mpide.app/Contents/Resources/Java/hardware/pic32/compiler/pic32-tools/bin/../lib/gcc/pic32mx/4.5.1/../../../../pic32mx/bin/ld: address 0x9d001010 of Blink.cpp.elf section `.reset' is not within region `kseg1_boot_mem'
/Applications/Mpide.app/Contents/Resources/Java/hardware/pic32/compiler/pic32-tools/bin/../lib/gcc/pic32mx/4.5.1/../../../../pic32mx/bin/ld: address 0x9d001010 of Blink.cpp.elf section `.reset' is not within region `kseg1_boot_mem'
/Applications/Mpide.app/Contents/Resources/Java/hardware/pic32/compiler/pic32-tools/bin/../lib/gcc/pic32mx/4.5.1/../../../../pic32mx/bin/ld: section .startup loaded at [9d001000,9d0011df] overlaps section .reset loaded at [9d001000,9d00100f]
collect2: ld returned 1 exit status
Any clue of what's going wrong?
Mon, 19 May 2014 17:16:45 +0000
Looks like the linker script is wrong.
It has:
_RESET_ADDR = ORIGIN(kseg0_program_mem);
and yet reset is placed in:
/* Boot Sections */
.reset _RESET_ADDR :
{
KEEP(*(.reset))
} > kseg1_boot_mem
but kseg1_boot_mem is at
kseg1_boot_mem : ORIGIN = 0xBFC00000, LENGTH = 0x490
I think _RESET_ADDR should be ORIGIN(kseg1_boot_mem)...
Mon, 19 May 2014 18:48:25 +0000
Thank you for your answer.
As posted before, I've just adapted the boards.txt file but kept the .ld files from https://github.com/chipKIT32/chipKIT32-MAX/tree/master/hardware/pic32/cores/pic32.
I'm going to open a ticket at https://github.com/chipKIT32/chipKIT32-MAX/issues?state=open, so everyone can enjoy the solution.
Mon, 19 May 2014 19:06:37 +0000
Ticket created at https://github.com/chipKIT32/chipKIT32-MAX/issues/458
Wed, 21 May 2014 14:51:28 +0000
Thank you for your answer. It works!
_RESET_ADDR = ORIGIN(kseg1_boot_mem);
See pull request at http://github.com/chipKIT32/chipKIT32-MAX/pull/459