Errors when exportomg to offline toolchain (GCC CodeSourcery)

08 Oct 2012

Hi All,

I am trying to export my project to offline toolchain (GCC CodeSourcery), but get errors when using the mBed export library.

1. main.cpp file

My main file is simple, blinking LED1 forever.

#include "mbed.h"

DigitalOut myled(LED1);

int main() {
    while(1) {
        myled = 1;
        wait(0.2);
        myled = 0;
        wait(0.2);
    }
}

Compile this main file and runs it at my mBed successfully

2. mbed-export library

Now I import the mbed-export library, as it is suggested that an mBed export library is needed (http://mbed.org/forum/mbed/topic/3685/?page=1#comment-18467). I imported the mbed-export library from http://mbed.org/users/mbed_official/code/mbed-export/file/

When I click 'Compile' at the first time, I got errors, see the figure below

/media/uploads/freetiger/mbed-export_error.jpg

When I click 'Compile' again and so on, I got an error

'Unable to download. Fixed the reported errors...'

any suggestions/comments are greatly appreciate.

08 Oct 2012

Hi Daniel Dai,

It looks like this error is happening because you have two copies of the mbed library in your project.

I suggest that you delete mbed-export from your project, this will allow your program to compile in the online compiler. If you also make sure the mbed library is the latest version in your project it will allow the export to work without the need for mbed-export.

To update your mbed library click on mbed with the cog icon on the right of the compiler you may see a message saying "A new version is available", if that is the case clicking update will update you to the latest version.

Steve

08 Oct 2012

thanks. It works if I remove the mBed-export from my project. However, the difficulty is that I need mBed-export for exporting my project to offline toolchain (CodeSoucery). Maybe, I should try to remove the mBed library.

08 Oct 2012

Hi, Steve,

I removed both the mBed and mBed-export, and then import mbed-export only. It works. I get the bin file which runs at my mBed. Great. thanks.

Dan

08 Oct 2012

Hi Daniel Dai,

mbed-export is not necessary if you have the latest version of the mbed library in your project even if you are exporting your project.

Steve

08 Oct 2012

That is great. I think my mBed library may not not be updated to the latest one. When I exported and compiled my programme offline without the mBed-export library, I got an error " missing 'cmsis.h'", which was solved by using the mBed-export library. I will update the mBed library and try. thanks

Dan

08 Oct 2012

Hi, Steve,

The mBed library works. I tried to build with the latest mBed library and the mbed-export library, seperately, and both work well. Amazing.

Now I export my programme from mBed online compiler to a local file test.zip. Then create a Makefile project in Eclipse and import the test.zip into the project. Select 'Build project' in Eclipse, it works, no errors. :)

Greatly appreciate your help.

dan