Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

1 год назад
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. README
  2. ======
  3. [![Build Status](https://travis-ci.org/libopencm3/libopencm3.svg?branch=master)](https://travis-ci.org/libopencm3/libopencm3)
  4. [![Gitter channel](https://badges.gitter.im/libopencm3/discuss.svg)](https://gitter.im/libopencm3/discuss)
  5. The libopencm3 project aims to create an open-source firmware library for
  6. various ARM Cortex-M microcontrollers.
  7. Currently (at least partly) supported microcontrollers:
  8. - ST STM32 F0xx/F1xx/F2xx/F30x/F37x/F4xx/F7xx/H7xx series
  9. - ST STM32 G0xx G4xx L0xx L1xx L4xx series
  10. - Atmel SAM3A/3N/3S/3U/3X series, as well as SAMDxx and friends
  11. - NXP LPC1311/13/17/42/43
  12. - Stellaris LM3S series (discontinued, without replacement)
  13. - TI (Tiva) LM4F series (continuing as TM4F, pin and peripheral compatible)
  14. - EFM32 Gecko series (only core support)
  15. - Freescale Vybrid VF6xx
  16. - Qorvo (formerly ActiveSemi) PAC55XX
  17. - Synwit SWM050
  18. The library is written completely from scratch based on the vendor datasheets,
  19. programming manuals, and application notes. The code is meant to be used
  20. with a GCC toolchain for ARM (arm-elf or arm-none-eabi), flashing of the
  21. code to a microcontroller can be done using the OpenOCD ARM JTAG software.
  22. Status and API
  23. --------------
  24. The libopencm3 project is currently work in progress. Not all subsystems
  25. of the microcontrollers are supported, yet.
  26. **IMPORTANT**: The API of the library is _NOT_ yet considered stable! Please do
  27. not rely on it, yet! Changes to function names, macro names, etc.
  28. can happen at any time without prior notice!
  29. _TIP_: Include this repository as a Git submodule in your project to make sure
  30. your users get the right version of the library to compile your project.
  31. For how that can be done refer to the
  32. [libopencm3-template](https://github.com/libopencm3/libopencm3-template) repository.
  33. Prerequisites
  34. -------------
  35. Building requires Python (some code is generated).
  36. **For Ubuntu/Fedora:**
  37. - An arm-none-eabi/arm-elf toolchain.
  38. **For Windows:**
  39. Download and install:
  40. - msys - http://sourceforge.net/projects/mingw/files/MSYS/Base/msys-core/msys-1.0.11/MSYS-1.0.11.exe
  41. - Python - http://www.python.org/ftp/python/2.7/python-2.7.msi (any 2.7 release)
  42. - arm-none-eabi/arm-elf toolchain (for example this one https://launchpad.net/gcc-arm-embedded)
  43. Run msys shell and set the path without standard Windows paths, so Windows programs such as 'find' won't interfere:
  44. export PATH="/c//Python27:/c/ARMToolchain/bin:/usr/local/bin:/usr/bin:/bin"
  45. After that you can navigate to the folder where you've extracted libopencm3 and build it.
  46. Toolchain
  47. ---------
  48. The most heavily tested toolchain is "gcc-arm-embedded"
  49. https://launchpad.net/gcc-arm-embedded
  50. Other toolchains _should_ work, but they have not been nearly as well tested.
  51. Toolchains targeting Linux, such as "gcc-arm-linux-gnu" or the like are
  52. _not_ appropriate.
  53. _NOTE_: We recommend that you use gcc-arm-embedded version 4.8 2014q3 or newer
  54. to build all platforms covered by libopencm3 successfully.
  55. Building
  56. --------
  57. $ make
  58. If you have an arm-elf toolchain (uncommon) you may want to override the
  59. toolchain prefix (arm-none-eabi is the default)
  60. $ PREFIX=arm-elf make
  61. For a more verbose build you can use
  62. $ make V=1
  63. Fine-tuning the build
  64. ---------------------
  65. The build may be fine-tuned with a limited number of parameters, by specifying
  66. them as environment variables, for example:
  67. $ VARIABLE=value make
  68. * `FP_FLAGS` - Control the floating-point ABI
  69. If the Cortex-M core supports a hard float ABI, it will be compiled with
  70. the best floating-point support by default. In cases where this is not desired, the
  71. behavior can be specified by setting `FP_FLAGS`.
  72. Currently, M4F cores default to `-mfloat-abi=hard -mfpu=fpv4-sp-d16`, and
  73. M7 cores defaults to double precision `-mfloat-abi=hard -mfpu=fpv5-d16` if available,
  74. and single precision `-mfloat-abi=hard -mfpu=fpv5-sp-d16` otherwise.
  75. Other architectures use no FP flags, in otherwords, traditional softfp.
  76. You may find which FP_FLAGS you can use in a particular architecture in the readme.txt
  77. file shipped with the gcc-arm-embedded package.
  78. Examples:
  79. $ FP_FLAGS="-mfloat-abi=soft" make # No hardfloat
  80. $ FP_FLAGS="-mfloat-abi=hard -mfpu=magic" make # New FPU we don't know of
  81. * `CFLAGS` - Add to or supersede compiler flags
  82. If the library needs to be compiled with additional flags, they can be
  83. passed to the build system via the environment variable `CFLAGS`. The
  84. contents of `CFLAGS` will be placed after all flags defined by the build
  85. system, giving the user a way to override any default if necessary.
  86. Examples:
  87. $ CFLAGS="-fshort-wchar" make # Compile lib with 2 byte wide wchar_t
  88. Example projects
  89. ----------------
  90. The libopencm3 community has written and is maintaining a huge collection of
  91. examples, displaying the capabilities and uses of the library. You can find all
  92. of them in the libopencm3-examples repository:
  93. https://github.com/libopencm3/libopencm3-examples
  94. If you just wish to test your toolchain and build environment, a collection of
  95. mini blink projects is available too. This covers _many_ more boards, but, as
  96. the name suggests, only demonstrates blinking LEDs.
  97. https://github.com/libopencm3/libopencm3-miniblink
  98. Installation
  99. ------------
  100. Simply pass -I and -L flags to your own project. See the
  101. [libopencm3-template](https://github.com/libopencm3/libopencm3-template)
  102. repository for a template repository using this library as a Git submodule,
  103. the most popular method of use. The libopencm3-examples is another
  104. example of this.
  105. It is strongly advised that you do not attempt to install this library to any
  106. path inside your toolchain itself. While this means you don't have to include
  107. any `-I` or `-L` flags in your projects, it is _very_ easy to confuse a multi-library
  108. linker from picking the right versions of libraries. Common symptoms are
  109. hardfaults caused by branches into ARM code. You can use `arm-none-eabi-objdump`
  110. to check for this in your final ELF file. You have been warned.
  111. Coding style and development guidelines
  112. ---------------------------------------
  113. See HACKING.
  114. License
  115. -------
  116. The libopencm3 code is released under the terms of the GNU Lesser General
  117. Public License (LGPL), version 3 or later.
  118. See COPYING.GPL3 and COPYING.LGPL3 for details.
  119. Community
  120. ---------
  121. * Our [![Gitter channel](https://badges.gitter.im/libopencm3/discuss.svg)](https://gitter.im/libopencm3/discuss)
  122. * Our IRC channel on the freenode IRC network is called #libopencm3
  123. Mailing lists
  124. -------------
  125. * Developer mailing list (for patches and discussions):
  126. https://lists.sourceforge.net/lists/listinfo/libopencm3-devel
  127. * Commits mailing list (receives one mail per `git push`):
  128. https://lists.sourceforge.net/lists/listinfo/libopencm3-commits
  129. Website
  130. -------
  131. * http://libopencm3.org