Thanks again Borut Ražem,  I've been successful.

Now I've figure out how to do it.

In the delay directory
sdcc -V --vc --debug -mpic16 -p18f4550  --use-non-free -I/.  -L/.  -c
delay.c
# It creates delay.o

gplib -c libmydelay.lib  delay.o
#It creates  libmydelay.lib


sdcc -V --vc  -mpic16 -p18f4550  --main-return  --use-non-free
libmydelay.lib -I/$(INCDIR)  -L$(INCDIR)   main.c

And finally creates main.hex.  I think this feature should best documented
in the sdcc manual.



On Sat, Dec 1, 2012 at 5:22 AM, Borut Ražem <[email protected]> wrote:

>  You are using wrong tool to create the pic library: you should use the
> gplib librarian which is a part of gputils.
>
> Borut
>
>
> On 30. 11. 2012 23:40, Caio Rodrigues wrote:
>
>  Thanks  Borut Ražem  and Douglas Goodall for the advices.
>
>  I think sdcc compiles by default for the 8051 core and the sdcclib only
> accepts *.rel files and not *.o files.
>
>  I have tried:
>
>  *$ sdcc -V -mpic16 -p18f4550 -c delay.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=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"  "delay.c"
> + "gpasm" -DSTACK_MODEL_SMALL -D__STACK_MODEL_SMALL -o "delay.o" -c
> "delay.asm"
>
>
>  And
>  sdcclib libmydelay.lib delay.o
>
>  $ sdcclib -s libmydelay.lib delay.rel:
>
>  And I have gotten the same error again: * *error: "libmydelay.lib" is
> not a valid coff object or archive
>  returned errorcode 256
>
>  $  *sdcc -V --vc --debug -mpic16 -p18f4550  --main-return
>  --use-non-free -L`pwd` libmydelay.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 "libmydelay.lib" "libdev18f4550.lib" "libsdcc.lib"
> *error: "libmydelay.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 "libmydelay.lib" "libdev18f4550.lib" "libsdcc.lib" * returned
> errorcode 256*
>
>
>
> On Fri, Nov 30, 2012 at 7:11 PM, Douglas Goodall 
> <[email protected]>wrote:
>
>> 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,
>>
>>  Douglas
>>
>>   On Nov 30, 2012, at 1:24 PM, Caio Rodrigues <[email protected]>
>> 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
>>  delay.rel:
>>    .__.ABS.
>>    C$delay.c$43$1$5
>>    C$delay.c$44$1$5
>>    C$delay.c$36$1$4
>>    C$delay.c$29$1$2
>>    C$delay.c$45$1$5
>>    C$delay.c$37$1$4
>>    C$delay.c$46$1$5
>>    G$delay1s$0$0
>>    G$delaysx$0$0
>>    _delay1s
>>    G$delay500ms$0$0
>>    _delaysx
>>    XG$delay1s$0$0
>>    _delay500ms
>>    XG$delaysx$0$0
>>    A$delay$200
>>    A$delay$120
>>    A$delay$211
>>    A$delay$121
>>    A$delay$140
>>    A$delay$204
>>    A$delay$160
>>    A$delay$133
>>    A$delay$124
>>    XG$delay500ms$0$0
>>    A$delay$134
>>    A$delay$207
>>    A$delay$153
>>    A$delay$135
>>    A$delay$126
>>    A$delay$181
>>    A$delay$136
>>    A$delay$127
>>    A$delay$118
>>    A$delay$191
>>    A$delay$164
>>    A$delay$128
>>    A$delay$192
>>    A$delay$183
>>    A$delay$129
>>    A$delay$184
>>    A$delay$157
>>    A$delay$185
>>    A$delay$158
>>    A$delay$195
>>    A$delay$186
>>    A$delay$159
>>    C$delay.c$23$0$0
>>    A$delay$197
>>    C$delay.c$30$1$2
>>    A$delay$198
>>    A$delay$189
>>    A$delay$199
>>    C$delay.c$32$1$2
>>    C$delay.c$40$1$4
>>     C$delay.c$35$1$2
>>
>>
>>  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:
> INSIGHTS What's next for parallel hardware, programming and related areas?
> Interviews and blogs by thought leaders keep you ahead of the curve.
> http://goparallel.sourceforge.net
> _______________________________________________
> Sdcc-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/sdcc-user
>
>
------------------------------------------------------------------------------
Keep yourself connected to Go Parallel: 
INSIGHTS What's next for parallel hardware, programming and related areas?
Interviews and blogs by thought leaders keep you ahead of the curve.
http://goparallel.sourceforge.net
_______________________________________________
Sdcc-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to