Hi Raphael.

I now have this output:

make -f nbproject/Makefile-default.mk SUBPROJECTS= .build-conf
make[1]: Entering directory `/home/amartins/MPLABXProjects/Pic18F4550Test.X'
make  -f nbproject/Makefile-default.mk 
dist/default/production/Pic18F4550Test.X.production.cof
make[2]: Entering directory `/home/amartins/MPLABXProjects/Pic18F4550Test.X'
make[2]: `dist/default/production/Pic18F4550Test.X.production.cof' is up to 
date.
make[2]: Leaving directory `/home/amartins/MPLABXProjects/Pic18F4550Test.X'
make[1]: Leaving directory `/home/amartins/MPLABXProjects/Pic18F4550Test.X'

*BUILD SUCCESSFUL (total time: 170ms)*
Loading 
/home/amartins/MPLABXProjects/Pic18F4550Test.X/dist/default/production/Pic18F4550Test.X.production.cof...
Loading completed


Thanks very much.

*I want to share this here*, if you don't mind.

*Using MPLAB X and SDCC: to solve the described issue, here is the procedure:

After installing MPLAB X and successfully build and install SDCC  we have to 
make some settings on MPLAB X in order to work with SDCC.

First add SDCC to MPLAB X compilers list, this easy:

        got to Tools > Options > Embedded; then click "Scan for Build Tools" 
button on the bottom right side of panel. Doing so SDCC must appear on 
"Toolchain" list.

After that, create a project for test and follow the SDCC manual instruction on 
pages 18 and 19 under topic 2.7 - Testing the SDCC Compiler, 
don't forget to include target device header files (f.e.: pic18fregs.h and 
pic18fxxxx.h) 
Now, after create project and put test code on main.c file one have to select 
some options for project:
        right click over project name > Properties > SDCC Toolchain/sdcc 
                1 - Add following text in "Additional options": 
-L/usr/share/sdcc/lib/pic16/ -I/usr/share/sdcc/include 
-I/usr/share/sdcc/include/pic16/  libc18f.lib
                2 - With "Options category" = General, check the "Use non free 
libraries/headers" **option* - this will add --use-non-free to command line.

That's it. Your code should be compiled using SDCC and MPLAB X IDE.

NOTE: Using MPLAB X one can only build code for PICs. As using programmer with 
MPLAB X must not be covered here, please visit forums available on Microchip's 
site for information.

Many thanks to you Raphael. You gave me a very helpful hand on solving this 
issue. I'm glad I can build my projects using SDCC :-)))


Alexandre Martins

Electronics and Telecommunications Technical Engineer

Web/Software/Android Developer

On 20-08-2011 18:09, Raphael Neider wrote:

> Hi,
>
>> Got the right path: /usr/local/share/sdcc and this folder has other  
>> three: include, lib and non-free. I notice that libc18f is not in
>> /usr/local/share/sdcc/non-free/lib/pic16 but in  but in  
>> /usr/local/share/sdcc/lib/pic16 folder.
> OK, now you need tell gplink to (i) look there and (ii) to include  
> libc18f.lib during linking.
>
>> After addign this line to code strcpy(str1, "testing") {str1 => char  
>> str1[10]} I get this error:
>>
>> /usr/local/bin/sdcc  --debug-ralloc -Wl-c -Wl-m --use-non-free  
>> --pstack-model=large --pno-banksel --extended --obanksel=2 --debug-xtra  
>> --pcode-verbose -L /usr/local/share/sdcc/lib/ -L /usr/share/sdcc/lib/   
>> -I/usr/local/share/sdcc/include -I/usr/local/share/sdcc/include/pic16/    
>> -mpic16 -p18f4550 build/default/production/main.o   
>> -odist/default/production/Pic18F4550Test.X.production.cof
>> message: using default linker script "/usr/share/gputils/lkr/18f4550.lkr"
>> error: missing definition for symbol "_strcpy", required by  
>> "build/default/production/main.o"
>> This is weird because libraries are there... Don't no what else I can do.
> As I wrote earlier, you must tell the linker to include libc18f.lib:
>
>>> You need to append libc18f.lib to the linker command line.
> Here is your current linker command (the one that fails):
>
>> /usr/local/bin/sdcc  --debug-ralloc -Wl-c -Wl-m --use-non-free  
>> --pstack-model=large --pno-banksel --extended --obanksel=2 --debug-xtra  
>> --pcode-verbose -L /usr/local/share/sdcc/lib/ -L /usr/share/sdcc/lib/   
>> -I/usr/local/share/sdcc/include -I/usr/local/share/sdcc/include/pic16/    
>> -mpic16 -p18f4550 build/default/production/main.o   
>> -odist/default/production/Pic18F4550Test.X.production.cof
> Problems:
> As you pointed out earlier, libc18f.lib does not reside in any of the  
> paths given here after -L.
> What's more, you found out that libc18f.lib does not reside in  
> .../non-free/lib/pic16, so --use-non-free will still not point the linker  
> to the right path.
>
> Solutions:
> (1) Add -L /usr/local/share/sdcc/lib/pic16 to the link command.
> (2) Append libc18f.lib to the link command. In a autoconf-compliant  
> Makefile, this might be done by extending the LIBS variable; LDADD might  
> also work if it is combined into the linker command following all files to  
> be linked (after .../main.o). In MPLAB X, I have no clue where/how to  
> append this.
>
> To give you more information on how the tools (assembler, linker) are  
> invoked, you can also include -V in the linker command to see what's  
> actually passed on to gplink. Its arguments must include (i) a proper -L  
> /path/to/libc18f.lib directive, (ii) /path/to/main.o, (iii) libc18f.lib  
> (possibly including the complete /path/to/libc18f.lib to avoid further  
> problems with automatic searching) -- and in this order: (iii) *must* come  
> after (i) and (ii).
>
> I hope this clears things up.
>
> Raphael
>
> ------------------------------------------------------------------------------
> Get a FREE DOWNLOAD! and learn more about uberSVN rich system, 
> user administration capabilities and model configuration. Take 
> the hassle out of deploying and managing Subversion and the 
> tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2
> _______________________________________________
> Sdcc-user mailing list
> Sdcc-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/sdcc-user
------------------------------------------------------------------------------
Get a FREE DOWNLOAD! and learn more about uberSVN rich system, 
user administration capabilities and model configuration. Take 
the hassle out of deploying and managing Subversion and the 
tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to