Menu

#2219 linker can not find memset; pic18 microcontroller

open
nobody
None
PIC16
5
2013-12-20
2013-09-17
voxspox
No

SDCC : mcs51/gbz80/z80/z180/r2k/r3ka/ds390/pic16/pic14/TININative/ds400/hc08/s08 3.3.0 #8604 (May 11 2013) (Linux)

and gputils 0.13.7-1 (Ubuntu package)

main.c:

#include <pic18f25k20.h>
#include <string.h>

void main() {
char data[10];
memset(data, 10, 0);
}

compile with MPLAB X:

"/opt/sdcc-3.3.0/bin/sdcc" --debug-ralloc --use-non-free --pstack-model=small -c -mpic16 -p18f25k20 main.c -obuild/default/production/_ext/1847476323/main.o
mkdir -p dist/default/production
"/opt/sdcc-3.3.0/bin/sdcc" --debug-ralloc -Wl-c -Wl-m --use-non-free --pstack-model=small -mpic16 -p18f25k20 build/default/production/_ext/1847476323/main.o -odist/default/production/bug_sdcc_memset.X.production.cof
message: using default linker script "/usr/share/gputils/lkr/18f25k20.lkr"
error: missing definition for symbol "_memset", required by "build/default/production/_ext/1847476323/main.o"

memset is not found by the linker. compile is ok... any ideas?

Discussion

  • voxspox

    voxspox - 2013-09-17

    #include <pic18f25k20.h>
    #include <string.h>

    (I had to escape some char to make this display correctly...)

     
  • voxspox

    voxspox - 2013-09-17

    workaround:

    #include <../lib/src/pic16/libc/string/memset.c>

    but this is really a hack ;)

     
  • Diego Herranz

    Diego Herranz - 2013-12-20

    Can you try to run SDCC from shell?

    $ "/opt/sdcc-3.3.0/bin/sdcc" --debug-ralloc --use-non-free --pstack-model=small -mpic16 -p18f25k20 main.c
    

    With this, SDCC will compile and call the assembler and linker in one command.

     
  • Philipp Klaus Krause

    Is this a self-compiled sdcc or an Ubuntu package? Does Ubuntu even ship the pic libraries in their sdcc packages?

    Philipp

     

Log in to post a comment.