Microcontroller startup files

From D Wiki
Revision as of 19:03, 8 September 2015 by O3o (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


You can use the D programming language to program microcontrollers, for instance ARM Cortex-M3 or ARM Cortex-M4. In order to do so, you will need several different files, including a startup file. Startup files are usually not edited by you; they mainly contain an exception vector table and a small routine, which initializes the microcontroller before calling main().

There are 5 important kinds of files when developing for microcontrollers:

  • The Makefile
  • The startup file
  • The linker-script
  • The device drivers
  • Optionally a druntime library, such as minlibd
  • Your source code - of course

A few startup files have been made for you; they should be ready for use, and can be found on GitHub or on GPIO's D repository.

Currently, startup files for the following device families are available in the above repository:

  • STM32F4xx
  • STM32F3xx
  • STM32F2xx
  • LPC8xx
  • LPC11xx
  • LPC12xx
  • LPC13xx
  • LPC17xx
  • LPC18xx
  • LPC43xx

If your device family is not on this list, feel free to file an enhancement request similar to the one for STM32F3xx. Please provide a link to the device drivers, if you can; a request with a URL to the device drivers will have higher priority over a request without a URL.

Example directory structure


Note: The device driver and the druntime files have not been included above; you can keep the driver files in a separate location, so you do not have to update the drivers in all your projects every time a new version of the device drivers become available from the vendor. If you want to use druntime, you can also keep this in a separate location.

Related Information