7 years, 3 months ago.

Trying to export mbed project to Coocox Coide (STM32l152RE)

Hi everyone!

I am trying to export an MBED project made on STM32L152RE to Coocox Coide to adapt it for STM32L151C6. So here is my trial. I have exported a LED blinking project to Coide. Project is successfully opened. Next i try to compile.

Here are first errors:

Errors

 [cc] In file included from C:\Users\akmainik\Desktop\Mbed Projects\Nucleo_blink_led\mbed/mbed.h:75:0,
       [cc]                  from C:\Users\akmainik\Desktop\Mbed Projects\Nucleo_blink_led\main.cpp:1:
       [cc] C:\Users\akmainik\Desktop\Mbed Projects\Nucleo_blink_led\mbed/drivers/Serial.h:70:70: error: 'MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE' was not declared in this scope
       [cc]      Serial(PinName tx, PinName rx, const char *name=NULL, int baud = MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE);
       [cc]                                                                       ^
       [cc] In file included from C:\Users\akmainik\Desktop\Mbed Projects\Nucleo_blink_led\mbed/mbed.h:82:0,
       [cc]                  from C:\Users\akmainik\Desktop\Mbed Projects\Nucleo_blink_led\main.cpp:1:
       [cc] C:\Users\akmainik\Desktop\Mbed Projects\Nucleo_blink_led\mbed/drivers/RawSerial.h:64:50: error: 'MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE' was not declared in this scope
       [cc]      RawSerial(PinName tx, PinName rx, int baud = MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE);

Since i am not sure how to solve this issue i tried to comment these line in mbed.h . Which of course solves the problem but that is not a solution i am looking for. Project is built successfully after that but LED still does not blink. Next thought is that i need to do something with memory. But that is just a thought. Here i need your expertise.

So, asking for help. Would be ideal if someone shares his working project with that MCU. Otherwise i am ready to work on that problem and later share a working solution if i will reach one.

If i try to allocate memory properly following error appears.

Error 2

       [cc] C:\Users\akmainik\Desktop\Mbed Projects\Nucleo_blink_led/mbed/TARGET_NUCLEO_L152RE/TOOLCHAIN_GCC_ARM/startup_stm32l152xe.o:(.isr_vector+0x0): undefined reference to `_estack'
       [cc] collect2.exe: error: ld returned 1 exit status

1 Answer

7 years, 3 months ago.

Hello Nikita,
It seems that mbed has recently some issues with exporting projects to CoIDE. Try to re-export your project. If the errors persist then you shall include the definitions ( MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE etc.) by yourself. Luckily, they have been already defined in the mbed_config.h file (located under the headers in CoIDE project view). One solution, that forked for me, is to #include mbed_config.h" file into the device.h file.
Moreover, Serial is not getting initialized correctly in the programs exported do CoIDE. Hopefully this is going to be fixed soon too. In the meantime a work around is to use the default serial port for printf (available at pins: PA_2, PA_3) as below:

...
    //pc.printf("Hello\r\n");
    printf("Hello\r\n");
...


For info on porting code to other targets see:

https://developer.mbed.org/handbook/mbed-SDK-porting

https://developer.mbed.org/questions/75907/Support-For-Other-Boards/

https://developer.mbed.org/questions/4959/Possibility-of-porting-mbed-to-new-contr/