Microcontroller startup files

From D Wiki
Revision as of 20:27, 27 April 2015 by O3o (talk | contribs) (Introduction)
Jump to: navigation, search

Introduction

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
  • 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

 linker-scripts/
   stm32f429.ld
   stm32f429xe.ld
   stm32f429xg.ld
   stm32f429xi.ld
   stm32f4xx.ld
 Makefile
 src/
   stm32f429_startup.d
   main.d
   stm32f4xx_hal_conf.h
 output/

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

Bare_Metal_ARM_Cortex-M_GDC_Cross_Compiler
Extremely_minimal_semihosted_"Hello_World"
Tiny, Ubiquitous Machines Powered by D
minlibd