Skip to content

Building with Eclipse

Andreas Tacke edited this page Mar 17, 2015 · 5 revisions

Short Version

Install the latest Eclipse Standard/SDK and install the C/C++ developments Tools plugins plugin eclipse

Import the project using the wizard Existing Code as Makefile Project

Adjust your build option if necessary

Make sure you have a valid ARM toolchain in the path

Long version

  • First you need an ARM toolchain. GCC ARM Embedded is the preferred choice (https://launchpad.net/gcc-arm-embedded).
  • Now download Eclipse and unpack it somewhere. At the time of writing Eclipse 4.4.2 (Luna) was the latest stable version.
  • To work with ARM projects in Eclipse you need a few plugins:
  • Now clone the project to your hard drive.
  • Create a new C project in Eclipse and choose ARM Cross Target Application and your ARM toolchain.
  • Import the Git project into the C project in Eclipse via File > Import > General > File System.
  • Activate Git via Project > Team > Share Project.
  • The next thing you need to do is adjust the project configuration. There is a Makefile included that works but you might want to use GNU ARM Eclipse's automatic Makefile generation. Open the Project configuration and go to C/C++ Build > Settings
    • Under Target Processor choose "cortex-m3"
    • Under Cross ARM C Linker > General (or whatever toolchain you chose)
      • Browse to the Script file stm32_flash.ld
      • Uncheck "Do not use standard start files"
      • Check "Remove unused sections"
    • Under Cross ARM C Linker > Libraries
      • Add "m" for the math library
    • Under Cross ARM C Compiler > Preprocessor add the following 2 items to "Defined Symbols":
      • STM32F10X_MD
      • USE_STDPERIPH_DRIVER
    • Under Cross ARM C Compiler > Directories add the following 3 items
      • ${workspace_loc:/${ProjName}/lib/CMSIS/CM3/CoreSupport}
      • ${workspace_loc:/${ProjName}/lib/CMSIS/CM3/DeviceSupport/ST/STM32F10x}
      • ${workspace_loc:/${ProjName}/lib/STM32F10x_StdPeriph_Driver/inc}
    • Under Cross ARM C Compiler > Miscellaneous add the following item to "Other flags":
      • -fomit-frame-pointer
  • The code in the support directory is for uploading firmware to the board and is meant for your host machine. Hence, it must not be included in the build process. Just right-click on it to open its properties and choose "Exclude from build" under C/C++ Build > Settings
  • The last thing you need to do is adding your toolchain to the PATH environment variable.
    • Go to Project > Properties > C/C++ Build > Environment, add a variable named "PATH" and fill in the full path of your toolchain's binaries.
    • Make sure "Append variables to native environment" is selected.
  • Try to build the project via Project > Build Project.
  • Note: If you're getting "...could not be resolved" errors for data types like int32_t etc. try to disable and re-enable the Indexer under Project > Properties > C/C++ General > Indexer.
Clone this wiki locally