Hola amigos, estoy jugando con el starter kit ethernet, probando codigo de mchp, en sí es
PIC32 ESK usb host - mass storage simple demo que se encuentra en la web de mchp.
El ejemplo inicialmente compila bien, genera un archivo de texto en un pendrive, hasta alli todo bien.
Cambié la extensión del archivo y le puse .xls y compila bien y graba, la cosa es cuando uso la funcion sprintf no me deja manipular las variables a mi antojo, les dejo codigo que estoy usando:
Código que funciona correctamente:
if(FSInit())
{
//Opening a file in mode "w" will create the file if it doesn't
// exist. If the file does exist it will delete the old file
// and create a new one that is blank.
myFile = FSfopen("T09-11.XLS","w");
//Write some data to the new file.
FSfwrite("PRUEBA DE CONTEO\r",1,17,myFile);
for(cont_x = 0;cont_x<10;cont_x++)
{
FSfwrite(my_string,1,30,myFile);
for(cont_y = 0;cont_y<25;cont_y++)
{
FSfwrite(my_string,1,30,myFile);
}
FSfwrite("\r",1,1,myFile);
}
//Always make sure to close the file so that the data gets
// written to the drive.
FSfclose(myFile);
//Just sit here until the device is removed.
while(deviceAttached == TRUE)
{
USBTasks();
}
}
Este código funciona bien, hace lo ke se espera, el problema viene cuando hago esto
sprintf(my_string
,"CONT_X: %u\t",cont_x
);
me marca este error:
`_mon_write' referenced in section `.text.write' of c:/program files/microchip/mplabc32/v2.02/bin/../lib/gcc/pic32mx/4.5.1/../../../../pic32mx/lib\libc.a(write.o): defined in discarded section `.discard' of Objects - PIC32 Ethernet Starter Kit\main.o
`_mon_write' referenced in section `.text.write' of c:/program files/microchip/mplabc32/v2.02/bin/../lib/gcc/pic32mx/4.5.1/../../../../pic32mx/lib\libc.a(write.o): defined in discarded section `.discard' of Objects - PIC32 Ethernet Starter Kit\main.o
`_mon_write' referenced in section `.text.write' of c:/program files/microchip/mplabc32/v2.02/bin/../lib/gcc/pic32mx/4.5.1/../../../../pic32mx/lib\libc.a(write.o): defined in discarded section `.discard' of Objects - PIC32 Ethernet Starter Kit\main.o
`_mon_putc' referenced in section `.text.write' of c:/program files/microchip/mplabc32/v2.02/bin/../lib/gcc/pic32mx/4.5.1/../../../../pic32mx/lib\libc.a(write.o): defined in discarded section `.discard' of Objects - PIC32 Ethernet Starter Kit\main.o
collect2: ld returned 1 exit status
Link step failed.
En cabecera esta el <stdio.h>
No se como solucionarlo, alguien sabe como hacer que corra normal??.
Saludos