mbed With uVision 4.21

04 Aug 2011

Hello folks, I'm using mbed LPC1768 prototyping board. Nowadays I'm trying to compile my mbed programs with uVision 4.21, working on a 20x4LCD example. I've successfully compiled my program with online mbeed compiler but when I'm trying to compile my program at uVision 4.21, it throws 3 errors like;

.\build\deneme.axf: Error: L6218E: Undefined symbol TextLCD::locate(int, int) (referred from main.o).
.\build\deneme.axf: Error: L6218E: Undefined symbol TextLCD::TextLCD(PinName, PinName, PinName, PinName, PinName, PinName, TextLCD::LCDType) (referred from main.o).
.\build\deneme.axf: Error: L6218E: Undefined symbol vtable for TextLCD (referred from main.o).

At the beggining, I've downloaded apnt207.zip file and read apnt207.pdf from begginning to the end. I've applied all instructions step by step, so I don't think that I've made a mistake when I was configuring mbed settings. I've also included TextLCD.h library in my program but nothing changed. What sould posibbly gives this errors? Am I doing mistakes when I'm adding libraries?

My Code :

#include "mbed.h"
#include "TextLCD.h" 
Timer timer;
DigitalOut led(LED1);
long int begin, end,end1,end2,end3,end4,end5,times;
TextLCD lcd(p16, p15, p20, p19, p18, p17,TextLCD::LCD20x4);
int main() 
    begin = timer.read_us();
    led = !led;
    end = timer.read_us();
    lcd.printf("Led Duration : %Ld us",end-begin);
    end1 = timer.read_us();
    lcd.printf("\nLCD Write : %Ld us",end1-end);
    lcd.printf("LCD Locate : %Ld us",end2-end5);
    lcd.printf("\nCalculation : %Ld us",end4-end3);
04 Aug 2011

You need to download the code for the TextLCD library and build it as well. In addition to the TextLCD.h file, you will need all of the .c and .cpp files.

The errors you are getting above indicate that the main.cpp compiled with no problems but when it goes to link, it can't find the actual code for the TextLCD library.

04 Aug 2011

What is the steps for adding library? Could you give a simple example step by step?

04 Aug 2011

I can give you a set of steps for the first half of the process but I am not sure that they are the best (no doubt others will comment if they aren't.) I am not familiar with uVision so I am not sure how you would actually import the files that these steps pull down to your PC.

  • For my test I pulled in Simon's TextLCD_HelloWorld example from http://mbed.org/users/simon/programs/TextLCD_HelloWorld/livcr8. You can use your existing code but I just wanted something that would have the same TextLCD class.
  • In the "Program Workspace" pane of the compiler, I expand the TextLCD_HelloWorld project and right-click on the TextLCD library module. From the popup menu, I select the "Edit Library..." option. This pulls the code into my project.
  • Now right-click the TextLCD_HelloWorld project and select the "Export..." option from the popup menu. The .zip archive that is downloaded to your PC will now include the library sources along with your main.cpp.
  • At some point, I would recommend right-clicking on the TextLCD library module and clicking the "Revert Library..." option so that you don't keep your own private copy of the library around and revert to using the published version.

The resulting archive will have a TextLCD directory next to your main.cpp. It is likely that you will now need to get uVision to compile the TextLCD.cpp source file in this directory and get the directory added to the INCLUDE path so that it can find the header file in this directory as well.

Another option is to select the TextLCD library module in your project and then look at the right hand side of the compiler (the area titled "Library Details") and select the "Open library page" link. On the page brought up, there will be the option to just download the sources for this library alone as a .ZIP archive. Extract the source and add them to an appropriate place in your uVision project and add them to the build.

06 Aug 2011

Thanks for your helpful commenteries and your patience. I've tried a LCD example with uVision and I've got it work. Thanks again. Ragards..