Sida 1 av 1

MCC32 problem med Debug

Postat: 14 februari 2012, 00:08:56
av TomasL
Försöker använda Debugfunktionerna i kompilatorn, men får linker-fel
I main() har jag DBINIT() som i princip första raden
Kompilatorn har direktivet "-mappio-debug"

Får sedan detta

Kod: Markera allt

Executing: "D:\Microchip\mplabc32\v2.02\bin\pic32-gcc.exe" -mdebugger -mprocessor=32MX795F512L "cfc.o" "exceptions.o" "ff.o" "main.o" "ccsbcs.o" -o"fFAT-CFPMP.elf" -Wl,--defsym=__MPLAB_BUILD=1,--defsym=__MPLAB_DEBUG=1,--defsym=__MPLAB_DEBUGGER_ICD3=1,--defsym=__ICD2RAM=1,--defsym=__MPLAB_SWBPS_ON=1,-Map="fFAT-CFPMP.map"
`_appio_putc' referenced in section `.text' of main.o: defined in discarded section `.discard' of cfc.o
`_appio_putc' referenced in section `.text' of main.o: defined in discarded section `.discard' of cfc.o
`_appio_putc' referenced in section `.text' of main.o: defined in discarded section `.discard' of cfc.o
`_appio_putc' referenced in section `.text' of main.o: defined in discarded section `.discard' of cfc.o
`_appio_putc' referenced in section `.text' of main.o: defined in discarded section `.discard' of cfc.o
`_appio_putc' referenced in section `.text' of main.o: defined in discarded section `.discard' of cfc.o
collect2: ld returned 1 exit status
Link step failed. 
Så vad??

Re: MCC32 problem med Debug

Postat: 15 februari 2012, 00:54:49
av bos
Är källkoden hemlig?

Re: MCC32 problem med Debug

Postat: 15 februari 2012, 01:02:00
av TomasL
Nä, vaddå??

Re: MCC32 problem med Debug

Postat: 15 februari 2012, 01:05:56
av bos
Felmeddelandet i sig är inte så informativt. Kan lika gärna vara ett slarvfel du har i koden, men eftersom du inte visar den så är det svårt att veta.

Re: MCC32 problem med Debug

Postat: 15 februari 2012, 01:08:06
av TomasL
Tja, jag tror inte 15k rader källkod ger nånting om jag skall vara ärlig.
Det är möjligt att det kan finnas nåt fel, iofs är det klart eftersom jag får felmeddelande och build fail.
Helt klart är att felmeddelandet inte hjälper så mycket, dvs inte ett skit.

Re: MCC32 problem med Debug

Postat: 15 februari 2012, 01:11:29
av bos
Vad händer exempelvis om du slänger bort allt i main(), utom DBINIT-makrot?

Re: MCC32 problem med Debug

Postat: 15 februari 2012, 01:11:53
av TomasL
Såsom jag förstått det så kompileras koden helt ok, utan varningar eller fel, dock får länkaren spatt av någon anledning.

Re: MCC32 problem med Debug

Postat: 15 februari 2012, 01:14:01
av TomasL
bos skrev:Vad händer exempelvis om du slänger bort allt i main(), utom DBINIT-makrot?
Inte en susning, om jag skall vara ärlig.
Dock är det nog inte main() som orsakar felet, utan main.c vilken är rätt stor fil, tillsammans med cfc.c (inte riktigt lika stor ett par hundra rader eller så bara)

Re: MCC32 problem med Debug

Postat: 15 februari 2012, 01:19:23
av bos
Nu har jag läst felmeddelandet igen, och tror mig veta felet.

Vilka includes har du?

Re: MCC32 problem med Debug

Postat: 15 februari 2012, 01:25:38
av TomasL
Bra fråga, får kika i morgon på jobbet, har inte koden här hemma, tyvärr.

Re: MCC32 problem med Debug

Postat: 15 februari 2012, 01:28:17
av bos
Se till att du har #include "db_utils.h" och att db_utils.a finns på ett ställe länkaren når. Jag gissar att .a-filen inte hittas, felmeddelandet hintar om det.

Re: MCC32 problem med Debug

Postat: 15 februari 2012, 01:40:34
av TomasL
Skall kolla det, eftersom det är en box-standard installation i princip så borde länkaren hitta, men som sagt, får kika på det i morgon.

hmm, kikade på min installation här hemma, db_utils existerar inte, utan includen heter appio.h

I pdfen skriver uChip
You can choose which implementation to use by defining a preprocessor symbol. To
choose the APPIN/APPOUT implementation, pass the -mappio-debug option to
pic32-gcc.exe. To choose the PIC32 Starter Kit implementation, pass
-DPIC32_STARTER_KIT to the compiler shell. Also use #include <p32xxxx.h> to
include the generic header file in your source code.

With one of the above options passed to the compiler and the sys/appio.h include file
added to your source code, the debugging-support library provides alternate I/O helper
functions to the linker. These alternate I/O helper functions redirect stdin and stdout
to the appropriate debugging mechanism. Standard I/O functions now use the selected
mechanism.

MPLAB® C Compiler for PIC32 MCUs User’s Guide
DS51686B-page 120 © 2009 Microchip Technology Inc.

4.3 <SYS/APPIO.H> PIC32 DEBUGGING SUPPORT
The sys/appio.h header file contains conditional-compilation directives that cause the
compiler to pull in the correct aliased functions. In addition, it provides macros that
simplify enabling and disabling the debugging feature
Så det vete sjutton, vill minnas att den använder liben i PIC32MX foldern, dock finns det också en PIC32-LIBs folder med nästan samma innehåll , vilken inte verkar användas alls,.

Re: MCC32 problem med Debug

Postat: 15 februari 2012, 01:49:10
av bos
Standard-install eller inte, länkaren hittar inte om du inte explicit säger åt den att du använder db_utils.

Kod: Markera allt

 *   2. Add 'db_utils.a' to the library branch of MPLAB IDE project tree.
 *      It is located in "<install dir>\PIC32 Starter Kits\Microchip\Common" 

Re: MCC32 problem med Debug

Postat: 15 februari 2012, 02:02:52
av TomasL
Var hittade du det?
Nu använder jag iofs inte "starterkitets" implementation, eftersom jag kör med ICD istället.
Har fått för mig att starterkit pryttlarna bara skall användas när man kör direkt via USB på kitet.

Re: MCC32 problem med Debug

Postat: 15 februari 2012, 11:10:46
av TomasL
Mina includes ser ut så här

Kod: Markera allt

#include <p32xxxx.h>
#include <stdio.h>
#include <sys/appio.h>
#include <plib.h>
#include <string.h>
#include "diskio.h"
#include "ff.h"
#include "stddef.h"
#include "HardwareProfile.h"
#include "defs.h"