Search code examples
picmicrochip

Linker errors when migrating from xc32 2.10 to 2.15


For reasons that I cannot track down, there seems to be some substantial differences in the linker between 2.10 and 2.15. After fixing up some multiple defines with "extern", I've come to the point where I'm just baffled on what is different. I have functional code that works with 2.10, but with 2.15 there are some vector conflicts.

/Applications/microchip/xc32/v2.15/bin/xc32-gcc -mprocessor=32MZ2048EFH144 -DXPRJ_default=default -legacy-libc -Wl,--defsym=_min_heap_size=65536,--no-code-in-dinit,--no-dinit-in-serial-mem -o bin/serial-r312-flash.elf obj/flash_interrupts.o obj/flash_main.o         
obj/main.o: In function `__vector_dispatch_24':
main.c:(.vector_24+0x0): multiple definition of `__vector_dispatch_24'
obj/flash_interrupts.o:interrupts.c:(.vector_24+0x0): first defined here
obj/flash_main.o: In function `__vector_dispatch_9':
main.c:(.vector_9+0x0): multiple definition of `__vector_dispatch_9'
obj/flash_interrupts.o:interrupts.c:(.vector_9+0x0): first defined here
/Applications/microchip/xc32/v2.15/bin/bin/gcc/pic32mx/4.8.3/../../../../bin/pic32m-ld: Link terminated due to previous error(s).
collect2: error: ld returned 255 exit status
make: *** [flash] Error 255

I have attempted to make the vectors externs, but that did not help in the least.

//interrupt.h
extern void __attribute__((vector(_TIMER_2_VECTOR), interrupt(ipl7AUTO), nomips16))SampleTimerHandler(void);

//interrupt.c
void __attribute__((vector(_TIMER_2_VECTOR), interrupt(ipl7AUTO), nomips16)){}

In main.c, I basically have a loop.

Any suggestions would be greatly appreciated.


Solution

  • Try defining your ISRs like that:

    void __ISR(_USB_VECTOR, IPL1SOFT) USB_ISR() {

    Builds clean on mine with -Wall . Also, I believe nomips16 is the new default.

    EDIT: also, see comments. Apparently, an attempt to re-declare the ISR in a header file has been a contributing factor.