4 years, 6 months ago.

Configure a Project in a Newer mbed-dev (f392fc9709a3) and Compiling with GCC in Eclipse 2019-03

Hi there,

I recently took a project three-years-vintage and attempted to make it compile on a new system with a fairly recent installation of Eclipse CDT with the GNU MCU Eclipse 4.6.1. I had a significant struggle doing this, so I exported the STM32F429ZI LCD/TS project from mbed online - to Eclipse and eventually succeeded with a build and with OpenOCD.

Now I have to migrate my existing code into this project and I simultaneously wanted to migrate to the latest mbed-dev.

I stripped all mbed and cmsis folders and sources/headers from the existing LCD/TS project and I took all files matching the following blobs in mbed-dev project checked out at f392fc9709a3. I also added these as include paths to the toolchain obviously.

list of mbed-dev files/folders


Now this compilation originally tripped up at some missing defines which I assume the mbed compiler provides as command-line-arguments (in the same way you supply preprocessor symbols with -D in GCC, to the translator).

I struggled to identify anything that identified how exactly you configure the code-base besides the otherwise-magic project symbols that the online mbed exporter can yield to an Eclipse project. Worth noting is that the LCD/TS project contained a large number of these symbols and I left them in the Eclipse project.

I stumbled across the mbed-os 5.1.4 reference and found a section on configuring it, and consequently added every single macro that the reference has a default value for. Except for MBED_CONF_RTOS_PRESENT which was removed (as I do not have a need for the os, just the HAL).

Now the compilation trips up because it is missing MBED_CONF_PLATFORM_ERROR_DECODE_HTTP_URL_STR which is a char pointer like a printf-format-string inside mbed_error.c's unit. Of course I could provide one, but I'd rather find out where it comes from. Googling the symbol returns an eclectic set of snippets from the exact same implementation in f392fc9709a3.

$ find . -type f \( -not -name \*.o \) -exec grep -Pn 'MBED_CONF_PLATFORM_ERROR_DECODE_HTTP_URL_STR' {} /dev/null --color=always \;
./f392fc9709a3/platform/mbed_error.c:542:    mbed_error_printf(MBED_CONF_PLATFORM_ERROR_DECODE_HTTP_URL_STR, ctx->error_status);

So how should I go about configuring this project correctly?

1 Answer

4 years, 6 months ago.

Hello Matthew,

One option is to let mbed-cli generate the configuration file for your Eclipse project:

  • Create a simple "Blinky" Mbed OS-2 project for your target using mbed-cli. Add a mbed_app.json file if needed and compile.
  • Copy & paste the mbed_config.h file generated by mbed-cli in the "Blinky" project to your Eclipse project.

Below is the mbed_config.h file generated by mbed-cli for the DISCO_F429ZI target when no mbed_app.json was used:


 * mbed SDK
 * Copyright (c) 2017 ARM Limited
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * http://www.apache.org/licenses/LICENSE-2.0
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * See the License for the specific language governing permissions and
 * limitations under the License.

// Automatically generated configuration file.
// DO NOT EDIT, content will be overwritten.

#ifndef __MBED_CONFIG_DATA__
#define __MBED_CONFIG_DATA__

// Configuration parameters
#define CLOCK_SOURCE                                       USE_PLL_HSE_XTAL|USE_PLL_HSI                                                   // set by target:DISCO_F429ZI
#define CLOCK_SOURCE_USB                                   1                                                                              // set by target:DISCO_F429ZI
#define LPTICKER_DELAY_TICKS                               1                                                                              // set by target:FAMILY_STM32
#define MBED_CONF_DRIVERS_UART_SERIAL_RXBUF_SIZE           256                                                                            // set by library:drivers
#define MBED_CONF_DRIVERS_UART_SERIAL_TXBUF_SIZE           256                                                                            // set by library:drivers
#define MBED_CONF_PLATFORM_CRASH_CAPTURE_ENABLED           0                                                                              // set by library:platform
#define MBED_CONF_PLATFORM_CTHUNK_COUNT_MAX                8                                                                              // set by library:platform
#define MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE        9600                                                                           // set by library:platform
#define MBED_CONF_PLATFORM_ERROR_ALL_THREADS_INFO          0                                                                              // set by library:platform
#define MBED_CONF_PLATFORM_ERROR_DECODE_HTTP_URL_STR       "\nFor more info, visit: https://armmbed.github.io/mbedos-error/?error=0x%08X" // set by library:platform
#define MBED_CONF_PLATFORM_ERROR_FILENAME_CAPTURE_ENABLED  0                                                                              // set by library:platform
#define MBED_CONF_PLATFORM_ERROR_HIST_ENABLED              0                                                                              // set by library:platform
#define MBED_CONF_PLATFORM_ERROR_HIST_SIZE                 4                                                                              // set by library:platform
#define MBED_CONF_PLATFORM_ERROR_REBOOT_MAX                1                                                                              // set by library:platform
#define MBED_CONF_PLATFORM_FATAL_ERROR_AUTO_REBOOT_ENABLED 0                                                                              // set by library:platform
#define MBED_CONF_PLATFORM_FORCE_NON_COPYABLE_ERROR        0                                                                              // set by library:platform
#define MBED_CONF_PLATFORM_MAX_ERROR_FILENAME_LEN          16                                                                             // set by library:platform
#define MBED_CONF_PLATFORM_POLL_USE_LOWPOWER_TIMER         0                                                                              // set by library:platform
#define MBED_CONF_PLATFORM_STDIO_BAUD_RATE                 9600                                                                           // set by library:platform
#define MBED_CONF_PLATFORM_STDIO_BUFFERED_SERIAL           0                                                                              // set by library:platform
#define MBED_CONF_PLATFORM_STDIO_CONVERT_NEWLINES          0                                                                              // set by library:platform
#define MBED_CONF_PLATFORM_STDIO_CONVERT_TTY_NEWLINES      0                                                                              // set by library:platform
#define MBED_CONF_PLATFORM_STDIO_FLUSH_AT_EXIT             1                                                                              // set by library:platform
#define MBED_CONF_PLATFORM_USE_MPU                         1                                                                              // set by library:platform
#define MBED_CONF_TARGET_BOOT_STACK_SIZE                   0x1000                                                                         // set by target:Target
#define MBED_CONF_TARGET_DEEP_SLEEP_LATENCY                3                                                                              // set by target:FAMILY_STM32
#define MBED_CONF_TARGET_LPTICKER_LPTIM_CLOCK              1                                                                              // set by target:FAMILY_STM32
#define MBED_CONF_TARGET_LPUART_CLOCK_SOURCE               USE_LPUART_CLK_LSE|USE_LPUART_CLK_PCLK1                                        // set by target:FAMILY_STM32
#define MBED_CONF_TARGET_LSE_AVAILABLE                     0                                                                              // set by target:DISCO_F429ZI
#define MBED_CONF_TARGET_MPU_ROM_END                       0x0fffffff                                                                     // set by target:Target


Accepted Answer

Thank you for attaching that! I'll investigate if that solves it. The mbed-os configuration reference refers specifically to versions of the rtos and not the mbed library that it implements. For this reason, it's a little ambiguous how to implement a library by itself. I couldn't find documentation regarding this.

posted by Matt P 17 Oct 2019