{"id":990,"date":"2021-05-26T22:26:44","date_gmt":"2021-05-27T05:26:44","guid":{"rendered":"http:\/\/localhost\/imagecraft\/blog\/?p=990"},"modified":"2021-05-26T22:26:44","modified_gmt":"2021-05-27T05:26:44","slug":"setting-up-a-development-environment","status":"publish","type":"post","link":"https:\/\/imagecraft.com\/?p=990","title":{"rendered":"Setting Up A Development Environment"},"content":{"rendered":"\n<h3 class=\"wp-block-heading\">Part I in \u201cBuilding REXIS, a Cortex-M microcontroller Real Time OS\u201d<br><\/h3>\n\n\n\n<p>As we stopped development of the ImageCraft embedded tools in 2020, when I decided to rewrite my message passing kernel REXIS (Real-time EXecutive for Intelligent Systems) in modern C++ and planning to eventually evolve it into a full operating system, I needed to set up a new development environment. In this post, I described the tools I ended up using, and why I made the decisions that I did.<br><\/p>\n\n\n\n<p>To do basic C++ embedded development with the Cortex-M microcontrollers, at the minimum, you need:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>A C\/C++ compiler<\/li><li>An IDE, or an editor with separate build system<\/li><li>A hardware development board<\/li><li>Hardware debug pod<\/li><li>Software debugger<\/li><\/ul>\n\n\n\n<h1 class=\"wp-block-heading\">My Selections<\/h1>\n\n\n\n<p>My desktop runs Windows 10. Here\u2019s what I ended up with:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Compiler: GNU embedded ARM C++ compiler&nbsp;<\/li><li>Editor: Microsoft\u2019s VSCode&nbsp;<\/li><li>Build system: make&nbsp;<\/li><li>Source control: git<\/li><li>Visual debugger: Segger\u2019s Ozone<\/li><li>Hardware board and debug pod: ST-Nucleo with STMF411RE M4 microcontroller<\/li><li>MSYS2 for Linux tools<\/li><\/ul>\n\n\n\n<p>The total cost is less than $15 for the ST-Nucleo. Everything else is free or free for noncommercial use. MSYS2 is only needed for my convenience. None of the tools requires it.<\/p>\n\n\n\n<p>The choice for the compiler is obvious as the GNU embedded compiler is the standard. It\u2019s free, generates excellent code, and is well supported by the silicon vendors and others.<\/p>\n\n\n\n<p>VSCode (\u201cVisual Studio Code\u201d) is a highly extendable editor that works fast and well. It comes from Microsoft, but is not related to their traditional Visual Studio IDE. It\u2019s built on top of the Electron platform, meaning that it actually uses the same Javascript NodeJS engine that powers web applications. Even though it is built on web technologies, it is as fast as other editors I have used, with great support for C++ (and other languages) using extensions. In particular, the Intellisense C++ support makes it easy to navigate C++ source files.<\/p>\n\n\n\n<p>As a long time Unix \/ Linux user, using make is second nature to me and is a no-brainer for a generic build system. When the project gets more complex, I will switch to using a more capable build system such as CMake or Ninja.<\/p>\n\n\n\n<p>Although I can debug using the command line gdb GNU debugger, it is much nicer to have a GUI debugger. Toward that goal, Segger\u2019s Ozone is a natural choice. You can use the built-in file browser to set breakpoints, and it has the usual set of tools such as stack trace, step-over and step-into, code disassembly etc. The best feature is the seamless integration of assembly and C++ instruction-aware stepping<\/p>\n\n\n\n<p>Finally, for hardware prototyping, the ST-Nucleo lines of development boards are true bargains. For an average sale price of around $15, there are versions with different STM microcontrollers, from the low power L0 series, to the powerful F7 and H7 series. They come with a built-in debug pod on board, and for the best experience with Segger\u2019s tools, you can program the debug pod to act as a Segger JLINK pod. You can even reverse the change if you wish.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Alternatives<\/h1>\n\n\n\n<p>There are many alternatives. You can use the silicon vendors\u2019 supplied (usually free) IDE and graphical tools. They usually (always?) include the GNU C\/C++ compilers. For example, ST\u2019s CubeIDE is competent. It\u2019s slow since it is based on Eclipse and the code generated by the graphical tools are the bloated \u201cLL\u201d low level or \u201cHL\u201d high level ST API code, but it does work well. It can be a daunting experience to program using the ST IO registers directly, so this is a good compromise.<\/p>\n\n\n\n<p>Other silicon vendors offer similar software and hardware development solutions. The cost is usually free or low since they want you to buy millions of their chips, and providing no \/ low cost development tools is one way for them to grab developers\u2019 attention.<\/p>\n\n\n\n<p>I generally prefer to roll-my-own, and eschew the bloatware, but for people just starting, these can be good choices.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">What\u2019s Next<\/h1>\n\n\n\n<p>In the next part, I will describe how to set up the GNU environment.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Part I in \u201cBuilding REXIS, a Cortex-M microcontroller Real Time OS\u201d As we stopped development of the ImageCraft embedded tools in 2020, when I decided to rewrite my message passing kernel REXIS (Real-time EXecutive for Intelligent Systems) in modern C++ and planning to eventually evolve it into a full operating system, I needed to set up a new development environment. In this post, I described the tools I ended up using, and why I made the decisions that I did. To do basic C++ embedded development with the Cortex-M microcontrollers, at the minimum, you need: A C\/C++ compiler An IDE, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""}},"footnotes":""},"categories":[1],"tags":[],"class_list":["post-990","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/imagecraft.com\/index.php?rest_route=\/wp\/v2\/posts\/990","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/imagecraft.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/imagecraft.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/imagecraft.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/imagecraft.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=990"}],"version-history":[{"count":0,"href":"https:\/\/imagecraft.com\/index.php?rest_route=\/wp\/v2\/posts\/990\/revisions"}],"wp:attachment":[{"href":"https:\/\/imagecraft.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=990"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/imagecraft.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=990"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/imagecraft.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=990"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}