I  don't consider myself an expert but here are my thoughts...

Probably better to name the library something other than the name of the routine, like mydelay.lib.

Instead of putting delay.lib in the object list, you could try "sdcc ... -l mydelay"

Good luck,


On Nov 30, 2012, at 1:24 PM, Caio Rodrigues <blackdog245@gmail.com> wrote:

Hello users of the SDCC list:

I am trying to create a pic18f4550 a custom library and I get the error:    "delay.lib" is not a valid coff object or archive    returned errorcode 256.
I've attached the files used in this report.

I am using:  
Ubuntu 12.04 
SDCC - 3.2.0      /usr/local/sdcc /usr/local/bin/sdcc
gplink-0.13.7 beta
gpasm-0.13.7 beta
MCU:  pic18f4450

I am trying to create my own test library but I get this error:

$ sdcc -V --debug -c delay.c
+ "/usr/local/bin/sdcpp" -nostdinc -Wall -obj-ext=.rel -D__SDCC_MODEL_SMALL -DSDCC_MODEL_SMALL -D__SDCC_FLOAT_REENT -DSDCC_FLOAT_REENT -D__SDCC=3_2_0 -DSDCC=320 -D__SDCC_REVISION=8008 -DSDCC_REVISION=8008 -D__SDCC_mcs51 -DSDCC_mcs51 -D__mcs51 -D__STDC_NO_COMPLEX__ -D__STDC_NO_THREADS__ -D__STDC_NO_ATOMICS__ -D__STDC_NO_VLA__ -isystem "/usr/local/bin/../share/sdcc/include/mcs51" -isystem "/usr/local/share/sdcc/include/mcs51" -isystem "/usr/local/bin/../share/sdcc/include" -isystem "/usr/local/share/sdcc/include"  "delay.c" 
+ "/usr/local/bin/sdas8051" -plosgffwc "delay.rel" "delay.asm"

I got :   delay.rel

And then I do:
$ sdcclib delay.lib delay.rel

I got :   delay.lib

$ sdcclib -s delay.lib 

And then:

$ sdcc -V --vc --debug -mpic16 -p18f4550  --main-return  --use-non-free -L`pwd` delay.lib main.c 

+ "/usr/local/bin/sdcpp" -nostdinc -Wall -Dpic18f4550 -D__18f4550 -D__SDCC_PIC18F4550 -DSTACK_MODEL_SMALL -D__STACK_MODEL_SMALL -obj-ext=.o -D__SDCC_USE_NON_FREE -DSDCC_USE_NON_FREE -D__SDCC=3_2_0 -DSDCC=320 -D__SDCC_REVISION=8008 -DSDCC_REVISION=8008 -D__SDCC_pic16 -DSDCC_pic16 -D__pic16 -D__STDC_NO_COMPLEX__ -D__STDC_NO_THREADS__ -D__STDC_NO_ATOMICS__ -D__STDC_NO_VLA__ -isystem "/usr/local/bin/../share/sdcc/include/pic16" -isystem "/usr/local/share/sdcc/include/pic16" -isystem "/usr/local/bin/../share/sdcc/include" -isystem "/usr/local/share/sdcc/include" -isystem "/usr/local/bin/../share/sdcc/non-free/include/pic16" -isystem "/usr/local/share/sdcc/non-free/include/pic16" -isystem "/usr/local/bin/../share/sdcc/non-free/include" -isystem "/usr/local/share/sdcc/non-free/include"  "main.c" 
+ "gpasm" -DSTACK_MODEL_SMALL -D__STACK_MODEL_SMALL -g -o "main.o" -c "main.asm"
+ "gplink" -I"/home/caio/FinalProject/mcu/organizar/proj3" -I"/usr/local/bin/../share/sdcc/lib/pic16" -I"/usr/local/share/sdcc/lib/pic16" -I"/usr/local/bin/../share/sdcc/non-free/lib/pic16" -I"/usr/local/share/sdcc/non-free/lib/pic16"   -w -r -o "main" "main.o"  crt0i.o "delay.lib" "libdev18f4550.lib" "libsdcc.lib" 
error: "delay.lib" is not a valid coff object or archive
message: using default linker script "/usr/share/gputils/lkr/18f4550.lkr"
+ "gplink" -I"/home/caio/FinalProject/mcu/organizar/proj3" -I"/usr/local/bin/../share/sdcc/lib/pic16" -I"/usr/local/share/sdcc/lib/pic16" -I"/usr/local/bin/../share/sdcc/non-free/lib/pic16" -I"/usr/local/share/sdcc/non-free/lib/pic16"   -w -r -o "main" "main.o"  crt0i.o "delay.lib" "libdev18f4550.lib" "libsdcc.lib"  returned errorcode 256

I know the sdcc has already  a delay library but, I would like to learn how to create libraries.

I don't understand what is  a ''valid coff object or archive ' and why the this error happens.  I also would like to know how to create libraries like the native library of the SDCC like libc18f.

Keep yourself connected to Go Parallel:
TUNE You got it built. Now make it sing. Tune shows you how.
Sdcc-user mailing list