Using debug_printf in lib_small_printf_m0

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Using debug_printf in lib_small_printf_m0

409 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by deevee on Wed Oct 09 15:05:36 MST 2013
Evening folks - having some trouble implementing the lib_small_printf_m0 library in my own project.

I know this topic has been touched on before but I still can't figure it out based on the posts that exist - so - if someone could walk me through what's happening here, I'd be most appreciative.

I have a workspace which includes the lib_small_printf_m0 project, the example adc project and my project.

The ADC project compiles and runs just fine.

In the adc_main.c there is an include ref to the debug_printf header and then nestled within the ADCBar function there's a call to the debug_printf command:

#include "adc.h"
#include "debug_printf.h"

//more code in here

void ADCBar(int32_t Channel, uint32_t Counts)
{
uint32_t ValueBarLen = ((Counts * (MAX_BAR_LENGTH+1)) - (ADC_COUNT_MAX/2 - 1)) / ADC_COUNT_MAX;
char ValueBarBuf[BAR_OUTPUT_LENGTH+1];
double ValueVolts = Counts*SUPPLY_VOLTAGE/ADC_COUNT_MAX;

if(Channel >= 0)
{
if(ValueBarLen > MAX_BAR_LENGTH) ValueBarLen = MAX_BAR_LENGTH;
FillString(ValueBarBuf, '#', ValueBarLen);
debug_printf("%2d %d.%02dV |%s%*s|\n", (int)Channel,
(int)ValueVolts, (int)((ValueVolts-(int)ValueVolts)*100),
ValueBarBuf, (int)(MAX_BAR_LENGTH-ValueBarLen), "");
}
else
{
FillString(ValueBarBuf, '-', MAX_BAR_LENGTH+2);
debug_printf("%-9s%s\n", "", ValueBarBuf);
}
}


In the project tree, there is a little purple icon which shows a link to the lib_small_printf_m0 project, under Includes (image attached, please ignore my broken folders, I changed a folder name and now they won't go away).

There are various references to that folder inside the project properties under links/paths and so on.

Debug_printf.c and debug.printf.h both appear inside the Driver folder in the project tree.

I duplicated all of this in my own project.

Got a little purple project link icon in the includes parts of my project tree, copied the references into the project properties and copied the .h and .c files into my project drivers folder.

So at the top of my code I have the following:
#include "driver_config.h"
#include "target_config.h"
#include "adc.h"
#include "gpio.h"
#include "timer32.h"
#include "i2c.h"
#include "debug_printf.h"


/* Main Program */

int main (void) {
debug_printf("POV Firmware running!");


When I try to build the project, Eclipse tells me that there is an undefined reference to 'debug_printf' on that line in my project.

Additionally I get
Quote:
make: *** [POV_Solar_rev1.axf] Error 1

in the errors window.

When I click 'Open declaration' for debug_printf I get a little red message at the bottom right of the IDE window which states Could not find symbol 'debug_printf' in index. Which implies to me that the linking/referencing of the library hasn't worked properly.

Please can someone explain how to properly import a project as a reference/library to another project and/or tell me how to fix up my references so that the project compiles. Google has failed me on this one and the LPC documentation about this is not anywhere I can see (if its available and I've missed it please point me, more than happy to RTFM!)

Project files attached if you wanted to have a look around.

Any tips much appreciated
Best
D




Original Attachment has been moved to: pov-workspace-debugdependfiles.zip

Labels (1)
0 Kudos
1 Reply

333 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by woodchuck on Thu May 01 19:49:36 MST 2014
I'm very sorry you are having this problem, as I had the same one :(.

Ultimately it was easier to change tools.  Beyond a certain point, all you can do is vote with your feet.
0 Kudos