Back to Home

EmBlocks - IDE for STM32

stm32 · soft · ide

EmBlocks - IDE for STM32

    I promised to share my customized Em :: Blocks environment.
    I keep my promise.


    What is Em :: Blocks?


    This is an IDE based on Code :: Blocks, a cross-platform, fast development environment with a built-in scripting language and very flexible configuration oriented for C / C ++ development. The environment has built-in templates for a bunch of different cases and the ability to connect any compilers.
    EmBlocks, unlike CodeBlocks, is not cross-platform, it exists only under Windows.
    But along with it comes a special version of the CodeSourcery toolchain, which allows you to more tightly integrate the toolchain with the IDE. The bundled version is always fresh.

    Advantages of EmBlocks


    • fast because written in native code
    • extensible and well automated with scripts
    • project templates can be customized to your taste
    • you can change the dialog of the project creation wizard yourself
    • no installation required - can be carried with you on a USB flash drive and easily transferred with settings to another computer
    • out of the box supports debugging via ST-Link and J-Link
    • free
    • well supported on own forum

    An example project using EmBlocks is LED blinking.

    I work most often with STM32F103C8, STM32F103VE, STM32F100RB, so the project modified the templates for them. But to adapt to other processors is no difficulty. If there are specific questions - I will write how.
    I tuned it for myself:
    • Edited project templates for STM32F10x medium density, high density, medium density value line
    • In the templates, I replaced the project structure by stm_lib, cmsis, cmsis_boot and Src folders.
    • Updated cmsis version in the project template to version 3.0
    • Added support for ColinkEx debugger (it is not very flexible, but it works)
    • Added processor selection in the wizard for creating a project for firmware using ColinkEx
    • Added “Flash w ColinkEx”, “Flash w ST-Link / V2 ″ to the Tools menu
    • Changed the default setting for the ST-Link debugger from JTAG to SWD
    • Added creation of a HEX file for Debug target (standard only for Release)
    • Added to build options USE_STDPERIPH_DRIVER
    • Added to the search directories stm_lib \ src, stm_lib \ inc,. \ STM32_USB-FS-Device_Driver \ src,. \ STM32_USB-FS-Device_Driver \ inc, cmsis, cmsis \ boot
    • Fixed in gcc_arm.ld the size of flash and memory for the STM32F10x_MD series to the values ​​for STM32F103C8

    Something else changed by the little things, but I don’t remember.
    In order to start working with EmBlocks it is enough to unzip the archive and run emblocks.exe.
    If anyone doesn’t like the changes I made, the original is on the developers website . The original splashscreen also lies inside the archive.

    What changes give:


    • The project is ready for firmware immediately after creation by the wizard
    • There is everything you need to blink an LED
    • The project is designed to use the STM32 StdPeriph Library (as necessary, add modules to the project in the stm_lib folder, archive at the end of the article)
    • To work with the USB-FS library you just need to drop it into the project directory and add it to the project. (archive with library at the end of the article)
    • Fresh compiler does not swear at optimization thanks to new version of CMSIS
    • Easily migrate your project from the CooCox IDE
    • You can use CoolinkEx, which is quite popular with us and can be bought in Russia

    Surely each of us has its own subtleties in development, so I can’t cover all of them. I am going to tell how to use all this in the following entries. Ask questions, I will try to take them into account in the description.
    In general, I have an idea to lower the threshold for entering the development for STM32, making it easier to start with a set of convenient tools. Delivered and after 2 minutes Blink works for you.
    EmBlocks archive and libraries: STM32F10x StdPeriph Library, STM32 USB-FS-Device driver I posted on my site .
    Request - do not put hosting :) If you are not going to use right now - download later.

    Read Next