I have tried explicity adding the c library to MPLAB the configuration and that did not help. I notice the comand line did not change either.
I see there is a library pragma too...
#pramga library module
I tried
#pragma library c
and
#pragma library libc18f.lib
no luck with that either. I feel I can't be the first person to try this ;)
I guess my fallback will be to compile outside of MPLAB but that would be a real shame as I have already put a fair amount of effort into being able to easily switch between SDCC and XC8 compilers just by selecting a different configuration.
It appears thay the I am missing or can't find the library containing the printing functions documented in the 3.6.0 manual in section 4.6.18.2.
I have inclued the headers stdio.h and string.h and am targeting an PCI18F device. What else might I be missing?
Best,
N
Last edit: CScotty 2017-04-17
Hi,
Can you provide a minimum example so we can try to reproduce the error?
Diego
Of course:
Added square brackets around hashes to stop silly formatting..
Best,
N
Last edit: Raphael Neider 2017-04-17
You may need to manually link with libc18f to get the implementation of the requested functions.
Explicitly adding libc18f.lib did not change anything. But thanks for the suggestion.
Best.
N
I've just seen Raphael has replied. A slightly longer answer :)
I use linux so some paths and commands are slightly different, but it should be very similar.
It seems you're using MPLAB X which is calling SDCC to compile first, and then a second time to link and produce the HEX file.
Reproducing those two steps.
Compilation:
$ sdcc --use-non-free -c -mpic16 -p18f26k22 main.c -omain.o
All OK
Linkage and HEX generation:
I get the same error as you do.
However, calling SDCC in just one command works OK (when SDCC gets called as a single command, it compiles, links and generates the HEX file):
Let's see which libraries it is liking against (by using verbose) when doing everything in one step vs separate linkage call:
Single step:
Separate linkage call:
You can see that the missing library is libc18f.lib as Raphael just mentioned.
If you add that library manually at the link stage, it works:
You may need to add libc18f.lib somewhere in MPLAB's SDCC config.
HI Diego,
Your point is well made, thanks.
I have tried explicity adding the c library to MPLAB the configuration and that did not help. I notice the comand line did not change either.
I see there is a library pragma too...
I tried
no luck with that either. I feel I can't be the first person to try this ;)
I guess my fallback will be to compile outside of MPLAB but that would be a real shame as I have already put a fair amount of effort into being able to easily switch between SDCC and XC8 compilers just by selecting a different configuration.
EDIT:
If I modify the default linker script by adding
i cna make it work. It just feels rather kludgey. There has to be a better way.
Best,
N
Last edit: CScotty 2017-04-17