Difference between revisions of "Microcontroller startup files"

From D Wiki
Jump to: navigation, search
(Initial document)
 
 
(3 intermediate revisions by 2 users not shown)
Line 3: Line 3:
  
 
You can use the [http://dlang.org/index.html D programming language] to program microcontrollers, for instance ARM Cortex-M3 or ARM Cortex-M4.
 
You can use the [http://dlang.org/index.html 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.
+
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().
+
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 <code>main()</code>.
  
 
There are 5 important kinds of files when developing for microcontrollers:
 
There are 5 important kinds of files when developing for microcontrollers:
Line 19: Line 19:
 
* STM32F4xx
 
* STM32F4xx
 
* STM32F3xx
 
* STM32F3xx
 +
* STM32F2xx
 
* LPC8xx
 
* LPC8xx
 
* LPC11xx
 
* LPC11xx
Line 27: Line 28:
 
* LPC43xx
 
* LPC43xx
  
-If your device family is not on this list, feel free to file an enhancement request [https://github.com/jens-gpio/MCU/issues/1 similar to the one for STM32F3xx].
+
If your device family is not on this list, feel free to file an enhancement request [https://github.com/jens-gpio/MCU/issues/1 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.
 
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.
  
Line 49: Line 50:
 
== Related Information ==
 
== Related Information ==
  
[[Bare_Metal_ARM_Cortex-M_GDC_Cross_Compiler]]
+
* [[Bare_Metal_ARM_Cortex-M_GDC_Cross_Compiler| Bare Metal ARM Cortex-M GDC Cross Compiler]]
[[Extremely_minimal_semihosted_%22Hello_World%22]]
+
* [[Extremely_minimal_semihosted_%22Hello_World%22 | Extremely minimal semihosted "Hello_World"]]
[http://dconf.org/2014/talks/franklin.html Tiny, Ubiquitous Machines Powered by D]
+
* [http://dconf.org/2014/talks/franklin.html Tiny, Ubiquitous Machines Powered by D]
[https://bitbucket.org/timosi/minlibd/ minlibd]
+
* [https://bitbucket.org/timosi/minlibd/ minlibd]
 +
 
 +
 
 +
[[Category:ARM]]

Latest revision as of 19:03, 8 September 2015

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

 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