diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0d20b64 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.pyc diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..61f39c5 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,6 @@ +[submodule "builder/frameworks/mbed"] + path = builder/frameworks/mbed + url = https://github.com/platformio/builder-framework-mbed.git +[submodule "builder/frameworks/libopencm3"] + path = builder/frameworks/libopencm3 + url = https://github.com/platformio/builder-framework-libopencm3.git diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..2f8c0c8 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,19 @@ +language: python +python: + - "2.7" + +env: + - PLATFORMIO_PROJECT_DIR=examples/cmsis-blink + - PLATFORMIO_PROJECT_DIR=examples/libopencm3-blink + - PLATFORMIO_PROJECT_DIR=examples/mbed-blink + - PLATFORMIO_PROJECT_DIR=examples/mbed-dsp + - PLATFORMIO_PROJECT_DIR=examples/mbed-rtos + - PLATFORMIO_PROJECT_DIR=examples/mbed-serial + - PLATFORMIO_PROJECT_DIR=examples/spl-blink + +install: + - pip install -U https://github.com/platformio/platformio/archive/feature/platformio-30.zip + - platformio platform install file://. + +script: + - platformio run -d $PLATFORMIO_PROJECT_DIR diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..2f79a3b --- /dev/null +++ b/LICENSE @@ -0,0 +1,174 @@ +Apache License +Version 2.0, January 2004 +http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + +"License" shall mean the terms and conditions for use, reproduction, +and distribution as defined by Sections 1 through 9 of this document. + +"Licensor" shall mean the copyright owner or entity authorized by +the copyright owner that is granting the License. + +"Legal Entity" shall mean the union of the acting entity and all +other entities that control, are controlled by, or are under common +control with that entity. For the purposes of this definition, +"control" means (i) the power, direct or indirect, to cause the +direction or management of such entity, whether by contract or +otherwise, or (ii) ownership of fifty percent (50%) or more of the +outstanding shares, or (iii) beneficial ownership of such entity. + +"You" (or "Your") shall mean an individual or Legal Entity +exercising permissions granted by this License. + +"Source" form shall mean the preferred form for making modifications, +including but not limited to software source code, documentation +source, and configuration files. + +"Object" form shall mean any form resulting from mechanical +transformation or translation of a Source form, including but +not limited to compiled object code, generated documentation, +and conversions to other media types. + +"Work" shall mean the work of authorship, whether in Source or +Object form, made available under the License, as indicated by a +copyright notice that is included in or attached to the work +(an example is provided in the Appendix below). + +"Derivative Works" shall mean any work, whether in Source or Object +form, that is based on (or derived from) the Work and for which the +editorial revisions, annotations, elaborations, or other modifications +represent, as a whole, an original work of authorship. For the purposes +of this License, Derivative Works shall not include works that remain +separable from, or merely link (or bind by name) to the interfaces of, +the Work and Derivative Works thereof. + +"Contribution" shall mean any work of authorship, including +the original version of the Work and any modifications or additions +to that Work or Derivative Works thereof, that is intentionally +submitted to Licensor for inclusion in the Work by the copyright owner +or by an individual or Legal Entity authorized to submit on behalf of +the copyright owner. For the purposes of this definition, "submitted" +means any form of electronic, verbal, or written communication sent +to the Licensor or its representatives, including but not limited to +communication on electronic mailing lists, source code control systems, +and issue tracking systems that are managed by, or on behalf of, the +Licensor for the purpose of discussing and improving the Work, but +excluding communication that is conspicuously marked or otherwise +designated in writing by the copyright owner as "Not a Contribution." + +"Contributor" shall mean Licensor and any individual or Legal Entity +on behalf of whom a Contribution has been received by Licensor and +subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of +this License, each Contributor hereby grants to You a perpetual, +worldwide, non-exclusive, no-charge, royalty-free, irrevocable +copyright license to reproduce, prepare Derivative Works of, +publicly display, publicly perform, sublicense, and distribute the +Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of +this License, each Contributor hereby grants to You a perpetual, +worldwide, non-exclusive, no-charge, royalty-free, irrevocable +(except as stated in this section) patent license to make, have made, +use, offer to sell, sell, import, and otherwise transfer the Work, +where such license applies only to those patent claims licensable +by such Contributor that are necessarily infringed by their +Contribution(s) alone or by combination of their Contribution(s) +with the Work to which such Contribution(s) was submitted. If You +institute patent litigation against any entity (including a +cross-claim or counterclaim in a lawsuit) alleging that the Work +or a Contribution incorporated within the Work constitutes direct +or contributory patent infringement, then any patent licenses +granted to You under this License for that Work shall terminate +as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the +Work or Derivative Works thereof in any medium, with or without +modifications, and in Source or Object form, provided that You +meet the following conditions: + +(a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + +(b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + +(c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + +(d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + +You may add Your own copyright statement to Your modifications and +may provide additional or different license terms and conditions +for use, reproduction, or distribution of Your modifications, or +for any such Derivative Works as a whole, provided Your use, +reproduction, and distribution of the Work otherwise complies with +the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, +any Contribution intentionally submitted for inclusion in the Work +by You to the Licensor shall be under the terms and conditions of +this License, without any additional terms or conditions. +Notwithstanding the above, nothing herein shall supersede or modify +the terms of any separate license agreement you may have executed +with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade +names, trademarks, service marks, or product names of the Licensor, +except as required for reasonable and customary use in describing the +origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or +agreed to in writing, Licensor provides the Work (and each +Contributor provides its Contributions) on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +implied, including, without limitation, any warranties or conditions +of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A +PARTICULAR PURPOSE. You are solely responsible for determining the +appropriateness of using or redistributing the Work and assume any +risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, +whether in tort (including negligence), contract, or otherwise, +unless required by applicable law (such as deliberate and grossly +negligent acts) or agreed to in writing, shall any Contributor be +liable to You for damages, including any direct, indirect, special, +incidental, or consequential damages of any character arising as a +result of this License or out of the use or inability to use the +Work (including but not limited to damages for loss of goodwill, +work stoppage, computer failure or malfunction, or any and all +other commercial damages or losses), even if such Contributor +has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing +the Work or Derivative Works thereof, You may choose to offer, +and charge a fee for, acceptance of support, warranty, indemnity, +or other liability obligations and/or rights consistent with this +License. However, in accepting such obligations, You may act only +on Your own behalf and on Your sole responsibility, not on behalf +of any other Contributor, and only if You agree to indemnify, +defend, and hold each Contributor harmless for any liability +incurred by, or claims asserted against, such Contributor by reason +of your accepting any such warranty or additional liability. diff --git a/README.md b/README.md index 6cd776a..d7a414d 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,20 @@ -# platform-ststm32 -ST STM32: development platform for PlatformIO +# ST STM32: development platform for [PlatformIO](http://platformio.org) +[![Build Status](https://travis-ci.org/platformio/platform-ststm32.svg?branch=develop)](https://travis-ci.org/platformio/platform-ststm32) +[![Build status](https://ci.appveyor.com/api/projects/status/y5dayom6bltenoeh/branch/develop?svg=true)](https://ci.appveyor.com/project/ivankravets/platform-ststm32/branch/develop) + +The STM32 family of 32-bit Flash MCUs based on the ARM Cortex-M processor is designed to offer new degrees of freedom to MCU users. It offers a 32-bit product range that combines very high performance, real-time capabilities, digital signal processing, and low-power, low-voltage operation, while maintaining full integration and ease of development. + +* [Home](http://platformio.org/platforms/ststm32) (home page in PlatformIO Platform Registry) +* [Documentation](http://docs.platformio.org/en/latest/platforms/ststm32.html) (advanced usage, packages, boards, frameworks, etc.) + +# Usage + +1. [Install PlatformIO CLI](http://docs.platformio.org/en/latest/installation.html) +2. Install ST STM32 development platform: +```bash +# isntall the latest stable version +> platformio platform install ststm32 + +# install development version +> platformio platform install https://github.com/platformio/platform-ststm32/archive/develop.zip +``` diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000..f82dbf8 --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,24 @@ +build: off +environment: + + matrix: + - PLATFORMIO_PROJECT_DIR: "examples/mbed-blink" + - PLATFORMIO_PROJECT_DIR: "examples/mbed-dsp" + - PLATFORMIO_PROJECT_DIR: "examples/mbed-serial" + + - PLATFORMIO_PROJECT_DIR: "examples/cmsis-blink" + - PLATFORMIO_PROJECT_DIR: "examples/libopencm3-blink" + - PLATFORMIO_PROJECT_DIR: "examples/mbed-blink" + - PLATFORMIO_PROJECT_DIR: "examples/mbed-dsp" + - PLATFORMIO_PROJECT_DIR: "examples/mbed-rtos" + - PLATFORMIO_PROJECT_DIR: "examples/mbed-serial" + - PLATFORMIO_PROJECT_DIR: "examples/spl-blink" + +install: + - cmd: git submodule update --init --recursive + - cmd: SET PATH=%PATH%;C:\Python27\Scripts + - cmd: pip install -U https://github.com/platformio/platformio/archive/feature/platformio-30.zip + - cmd: platformio platform install file://. + +test_script: + - cmd: platformio run -d %PLATFORMIO_PROJECT_DIR% diff --git a/boards/armstrap_eagle1024.json b/boards/armstrap_eagle1024.json new file mode 100644 index 0000000..0fa714a --- /dev/null +++ b/boards/armstrap_eagle1024.json @@ -0,0 +1,22 @@ +{ + "build": { + "core": "stm32", + "cpu": "cortex-m4", + "extra_flags": "-DSTM32F40_41xxx", + "f_cpu": "168000000L", + "ldscript": "armstrap_eagle_1024.ld", + "mcu": "stm32f417vgt6", + "variant": "stm32f4" + }, + "frameworks": [ + "cmsis", + "spl" + ], + "name": "Armstrap Eagle 1024", + "upload": { + "maximum_ram_size": 196608, + "maximum_size": 1048576 + }, + "url": "http://docs.armstrap.org/en/latest/hardware-overview.html", + "vendor": "Armstrap" +} \ No newline at end of file diff --git a/boards/armstrap_eagle2048.json b/boards/armstrap_eagle2048.json new file mode 100644 index 0000000..090b8e0 --- /dev/null +++ b/boards/armstrap_eagle2048.json @@ -0,0 +1,22 @@ +{ + "build": { + "core": "stm32", + "cpu": "cortex-m4", + "extra_flags": "-DSTM32F427_437xx", + "f_cpu": "168000000L", + "ldscript": "armstrap_eagle_2048.ld", + "mcu": "stm32f427vit6", + "variant": "stm32f4" + }, + "frameworks": [ + "cmsis", + "spl" + ], + "name": "Armstrap Eagle 2048", + "upload": { + "maximum_ram_size": 262144, + "maximum_size": 2091752 + }, + "url": "http://docs.armstrap.org/en/latest/hardware-overview.html", + "vendor": "Armstrap" +} \ No newline at end of file diff --git a/boards/armstrap_eagle512.json b/boards/armstrap_eagle512.json new file mode 100644 index 0000000..3735a8e --- /dev/null +++ b/boards/armstrap_eagle512.json @@ -0,0 +1,22 @@ +{ + "build": { + "core": "stm32", + "cpu": "cortex-m4", + "extra_flags": "-DSTM32F40_41xxx", + "f_cpu": "168000000L", + "ldscript": "armstrap_eagle_512.ld", + "mcu": "stm32f407vet6", + "variant": "stm32f4" + }, + "frameworks": [ + "cmsis", + "spl" + ], + "name": "Armstrap Eagle 512", + "upload": { + "maximum_ram_size": 196608, + "maximum_size": 524288 + }, + "url": "http://docs.armstrap.org/en/latest/hardware-overview.html", + "vendor": "Armstrap" +} \ No newline at end of file diff --git a/boards/b96b_f446ve.json b/boards/b96b_f446ve.json new file mode 100644 index 0000000..8a6a8e1 --- /dev/null +++ b/boards/b96b_f446ve.json @@ -0,0 +1,17 @@ +{ + "build": { + "cpu": "cortex-m4", + "f_cpu": "168000000L", + "mcu": "stm32f446vet6" + }, + "frameworks": [ + "mbed" + ], + "name": "96Boards B96B-F446VE", + "upload": { + "maximum_ram_size": 131072, + "maximum_size": 524288 + }, + "url": "https://developer.mbed.org/platforms/ST-B96B-F446VE/", + "vendor": "96Boards" +} \ No newline at end of file diff --git a/boards/disco_f051r8.json b/boards/disco_f051r8.json new file mode 100644 index 0000000..6d0ab52 --- /dev/null +++ b/boards/disco_f051r8.json @@ -0,0 +1,18 @@ +{ + "build": { + "cpu": "cortex-m0", + "f_cpu": "48000000L", + "mcu": "stm32f051r8t6" + }, + "frameworks": [ + "mbed" + ], + "name": "ST STM32F0DISCOVERY", + "upload": { + "maximum_ram_size": 8192, + "maximum_size": 65536, + "protocol": "stlink" + }, + "url": "http://www.st.com/web/catalog/tools/FM116/SC959/SS1532/LN1848/PF253215", + "vendor": "ST" +} \ No newline at end of file diff --git a/boards/disco_f100rb.json b/boards/disco_f100rb.json new file mode 100644 index 0000000..b911366 --- /dev/null +++ b/boards/disco_f100rb.json @@ -0,0 +1,18 @@ +{ + "build": { + "cpu": "cortex-m3", + "f_cpu": "24000000L", + "mcu": "stm32f100rbt6" + }, + "frameworks": [ + "mbed" + ], + "name": "ST STM32VLDISCOVERY", + "upload": { + "maximum_ram_size": 8192, + "maximum_size": 131072, + "protocol": "stlink" + }, + "url": "http://www.st.com/web/catalog/tools/FM116/SC959/SS1532/LN1848/PF250863", + "vendor": "ST" +} \ No newline at end of file diff --git a/boards/disco_f303vc.json b/boards/disco_f303vc.json new file mode 100644 index 0000000..ee3f867 --- /dev/null +++ b/boards/disco_f303vc.json @@ -0,0 +1,25 @@ +{ + "build": { + "core": "stm32", + "cpu": "cortex-m4", + "extra_flags": "-DSTM32F3 -DSTM32F303xC", + "f_cpu": "72000000L", + "ldscript": "stm32f30xx.ld", + "mcu": "stm32f303vct6", + "variant": "stm32f303xc" + }, + "frameworks": [ + "mbed", + "cmsis", + "spl", + "libopencm3" + ], + "name": "ST STM32F3DISCOVERY", + "upload": { + "maximum_ram_size": 49152, + "maximum_size": 262144, + "protocol": "stlink" + }, + "url": "http://www.st.com/web/catalog/tools/FM116/SC959/SS1532/LN1848/PF254044", + "vendor": "ST" +} \ No newline at end of file diff --git a/boards/disco_f334c8.json b/boards/disco_f334c8.json new file mode 100644 index 0000000..740fc84 --- /dev/null +++ b/boards/disco_f334c8.json @@ -0,0 +1,18 @@ +{ + "build": { + "cpu": "cortex-m4", + "f_cpu": "72000000L", + "mcu": "stm32f334c8t6" + }, + "frameworks": [ + "mbed" + ], + "name": "ST 32F3348DISCOVERY", + "upload": { + "maximum_ram_size": 12288, + "maximum_size": 65536, + "protocol": "stlink" + }, + "url": "http://www.st.com/web/en/catalog/tools/PF260318", + "vendor": "ST" +} \ No newline at end of file diff --git a/boards/disco_f401vc.json b/boards/disco_f401vc.json new file mode 100644 index 0000000..cc6fda1 --- /dev/null +++ b/boards/disco_f401vc.json @@ -0,0 +1,18 @@ +{ + "build": { + "cpu": "cortex-m4", + "f_cpu": "84000000L", + "mcu": "stm32f401vct6" + }, + "frameworks": [ + "mbed" + ], + "name": "ST 32F401CDISCOVERY", + "upload": { + "maximum_ram_size": 65536, + "maximum_size": 262144, + "protocol": "stlink" + }, + "url": "http://www.st.com/web/catalog/tools/FM116/SC959/SS1532/LN1848/PF259098", + "vendor": "ST" +} \ No newline at end of file diff --git a/boards/disco_f407vg.json b/boards/disco_f407vg.json new file mode 100644 index 0000000..400e296 --- /dev/null +++ b/boards/disco_f407vg.json @@ -0,0 +1,25 @@ +{ + "build": { + "core": "stm32", + "cpu": "cortex-m4", + "extra_flags": "-DSTM32F4 -DSTM32F407xx -DSTM32F40_41xxx", + "f_cpu": "168000000L", + "ldscript": "stm32f405x6.ld", + "mcu": "stm32f407vgt6", + "variant": "stm32f407xx" + }, + "frameworks": [ + "mbed", + "cmsis", + "spl", + "libopencm3" + ], + "name": "ST STM32F4DISCOVERY", + "upload": { + "maximum_ram_size": 131072, + "maximum_size": 1048576, + "protocol": "stlink" + }, + "url": "http://www.st.com/web/catalog/tools/FM116/SC959/SS1532/LN1848/PF252419", + "vendor": "ST" +} \ No newline at end of file diff --git a/boards/disco_f429zi.json b/boards/disco_f429zi.json new file mode 100644 index 0000000..ae85f90 --- /dev/null +++ b/boards/disco_f429zi.json @@ -0,0 +1,18 @@ +{ + "build": { + "cpu": "cortex-m4", + "f_cpu": "180000000L", + "mcu": "stm32f429zit6" + }, + "frameworks": [ + "mbed" + ], + "name": "ST 32F429IDISCOVERY", + "upload": { + "maximum_ram_size": 262144, + "maximum_size": 2097152, + "protocol": "stlink" + }, + "url": "http://www.st.com/web/catalog/tools/FM116/SC959/SS1532/LN1848/PF259090", + "vendor": "ST" +} \ No newline at end of file diff --git a/boards/disco_f469ni.json b/boards/disco_f469ni.json new file mode 100644 index 0000000..4ae7f53 --- /dev/null +++ b/boards/disco_f469ni.json @@ -0,0 +1,18 @@ +{ + "build": { + "cpu": "cortex-m4", + "f_cpu": "180000000L", + "mcu": "stm32f469nih6" + }, + "frameworks": [ + "mbed" + ], + "name": "ST 32F469IDISCOVERY", + "upload": { + "maximum_ram_size": 393216, + "maximum_size": 1048576, + "protocol": "stlink" + }, + "url": "http://www.st.com/web/catalog/tools/FM116/CL1620/SC959/SS1532/LN1848/PF262395", + "vendor": "ST" +} \ No newline at end of file diff --git a/boards/disco_l053c8.json b/boards/disco_l053c8.json new file mode 100644 index 0000000..c321932 --- /dev/null +++ b/boards/disco_l053c8.json @@ -0,0 +1,18 @@ +{ + "build": { + "cpu": "cortex-m0plus", + "f_cpu": "32000000L", + "mcu": "stm32l053c8t6" + }, + "frameworks": [ + "mbed" + ], + "name": "ST 32L0538DISCOVERY", + "upload": { + "maximum_ram_size": 8192, + "maximum_size": 65536, + "protocol": "stlink" + }, + "url": "http://www.st.com/web/en/catalog/tools/PF260319", + "vendor": "ST" +} \ No newline at end of file diff --git a/boards/disco_l152rb.json b/boards/disco_l152rb.json new file mode 100644 index 0000000..e5fe908 --- /dev/null +++ b/boards/disco_l152rb.json @@ -0,0 +1,24 @@ +{ + "build": { + "core": "stm32", + "cpu": "cortex-m3", + "extra_flags": "-DSTM32L1 -DSTM32L152xB -DSTM32L1XX_MD", + "f_cpu": "32000000L", + "ldscript": "stm32l15xx6.ld", + "mcu": "stm32l152rbt6", + "variant": "stm32l152xb" + }, + "frameworks": [ + "cmsis", + "spl", + "libopencm3" + ], + "name": "ST STM32LDISCOVERY", + "upload": { + "maximum_ram_size": 16384, + "maximum_size": 131072, + "protocol": "stlink" + }, + "url": "http://www.st.com/web/catalog/tools/FM116/SC959/SS1532/LN1848/PF258515", + "vendor": "ST" +} \ No newline at end of file diff --git a/boards/disco_l476vg.json b/boards/disco_l476vg.json new file mode 100644 index 0000000..25c2074 --- /dev/null +++ b/boards/disco_l476vg.json @@ -0,0 +1,18 @@ +{ + "build": { + "cpu": "cortex-m4", + "f_cpu": "80000000L", + "mcu": "stm32l476vgt6" + }, + "frameworks": [ + "mbed" + ], + "name": "ST 32L476GDISCOVERY", + "upload": { + "maximum_ram_size": 131072, + "maximum_size": 1048576, + "protocol": "stlink" + }, + "url": "http://www.st.com/web/catalog/tools/FM116/CL1620/SC959/SS1532/LN1848/PF261635", + "vendor": "ST" +} \ No newline at end of file diff --git a/boards/mts_mdot_f411re.json b/boards/mts_mdot_f411re.json new file mode 100644 index 0000000..2d01855 --- /dev/null +++ b/boards/mts_mdot_f411re.json @@ -0,0 +1,17 @@ +{ + "build": { + "cpu": "cortex-m4", + "f_cpu": "100000000L", + "mcu": "stm32f411ret6" + }, + "frameworks": [ + "mbed" + ], + "name": "MultiTech mDot F411", + "upload": { + "maximum_ram_size": 131072, + "maximum_size": 524288 + }, + "url": "https://developer.mbed.org/platforms/MTS-mDot-F411/", + "vendor": "MultiTech" +} \ No newline at end of file diff --git a/boards/nucleo_f030r8.json b/boards/nucleo_f030r8.json new file mode 100644 index 0000000..e1f65cd --- /dev/null +++ b/boards/nucleo_f030r8.json @@ -0,0 +1,17 @@ +{ + "build": { + "cpu": "cortex-m0", + "f_cpu": "48000000L", + "mcu": "stm32f030r8t6" + }, + "frameworks": [ + "mbed" + ], + "name": "ST Nucleo F030R8", + "upload": { + "maximum_ram_size": 8192, + "maximum_size": 65536 + }, + "url": "https://developer.mbed.org/platforms/ST-Nucleo-F030R8/", + "vendor": "ST" +} \ No newline at end of file diff --git a/boards/nucleo_f031k6.json b/boards/nucleo_f031k6.json new file mode 100644 index 0000000..b48a90b --- /dev/null +++ b/boards/nucleo_f031k6.json @@ -0,0 +1,17 @@ +{ + "build": { + "cpu": "cortex-m0", + "f_cpu": "48000000L", + "mcu": "stm32f031k6t6" + }, + "frameworks": [ + "mbed" + ], + "name": "ST Nucleo F031K6", + "upload": { + "maximum_ram_size": 4096, + "maximum_size": 32768 + }, + "url": "https://developer.mbed.org/platforms/ST-Nucleo-F031K6/", + "vendor": "ST" +} \ No newline at end of file diff --git a/boards/nucleo_f042k6.json b/boards/nucleo_f042k6.json new file mode 100644 index 0000000..4ac0537 --- /dev/null +++ b/boards/nucleo_f042k6.json @@ -0,0 +1,17 @@ +{ + "build": { + "cpu": "cortex-m0", + "f_cpu": "48000000L", + "mcu": "stm32f042k6t6" + }, + "frameworks": [ + "mbed" + ], + "name": "ST Nucleo F042K6", + "upload": { + "maximum_ram_size": 6144, + "maximum_size": 32768 + }, + "url": "https://developer.mbed.org/platforms/ST-Nucleo-F042K6/", + "vendor": "ST" +} \ No newline at end of file diff --git a/boards/nucleo_f070rb.json b/boards/nucleo_f070rb.json new file mode 100644 index 0000000..982e5b8 --- /dev/null +++ b/boards/nucleo_f070rb.json @@ -0,0 +1,17 @@ +{ + "build": { + "cpu": "cortex-m0", + "f_cpu": "48000000L", + "mcu": "stm32f070rbt6" + }, + "frameworks": [ + "mbed" + ], + "name": "ST Nucleo F070RB", + "upload": { + "maximum_ram_size": 16384, + "maximum_size": 131072 + }, + "url": "https://developer.mbed.org/platforms/ST-Nucleo-F070RB/", + "vendor": "ST" +} \ No newline at end of file diff --git a/boards/nucleo_f072rb.json b/boards/nucleo_f072rb.json new file mode 100644 index 0000000..776bac2 --- /dev/null +++ b/boards/nucleo_f072rb.json @@ -0,0 +1,17 @@ +{ + "build": { + "cpu": "cortex-m0", + "f_cpu": "48000000L", + "mcu": "stm32f072rbt6" + }, + "frameworks": [ + "mbed" + ], + "name": "ST Nucleo F072RB", + "upload": { + "maximum_ram_size": 16384, + "maximum_size": 131072 + }, + "url": "https://developer.mbed.org/platforms/ST-Nucleo-F072RB/", + "vendor": "ST" +} \ No newline at end of file diff --git a/boards/nucleo_f091rc.json b/boards/nucleo_f091rc.json new file mode 100644 index 0000000..b99d30b --- /dev/null +++ b/boards/nucleo_f091rc.json @@ -0,0 +1,17 @@ +{ + "build": { + "cpu": "cortex-m0", + "f_cpu": "48000000L", + "mcu": "stm32f091rct6" + }, + "frameworks": [ + "mbed" + ], + "name": "ST Nucleo F091RC", + "upload": { + "maximum_ram_size": 32768, + "maximum_size": 262144 + }, + "url": "https://developer.mbed.org/platforms/ST-Nucleo-F091RC/", + "vendor": "ST" +} \ No newline at end of file diff --git a/boards/nucleo_f103rb.json b/boards/nucleo_f103rb.json new file mode 100644 index 0000000..4be7dff --- /dev/null +++ b/boards/nucleo_f103rb.json @@ -0,0 +1,21 @@ +{ + "build": { + "core": "stm32", + "cpu": "cortex-m3", + "f_cpu": "72000000L", + "ldscript": "stm32f103xb.ld", + "mcu": "stm32f103rbt6", + "variant": "stm32f1" + }, + "frameworks": [ + "mbed", + "libopencm3" + ], + "name": "ST Nucleo F103RB", + "upload": { + "maximum_ram_size": 20480, + "maximum_size": 131072 + }, + "url": "https://developer.mbed.org/platforms/ST-Nucleo-F103RB/", + "vendor": "ST" +} \ No newline at end of file diff --git a/boards/nucleo_f302r8.json b/boards/nucleo_f302r8.json new file mode 100644 index 0000000..fe14036 --- /dev/null +++ b/boards/nucleo_f302r8.json @@ -0,0 +1,17 @@ +{ + "build": { + "cpu": "cortex-m4", + "f_cpu": "72000000L", + "mcu": "stm32f302r8t6" + }, + "frameworks": [ + "mbed" + ], + "name": "ST Nucleo F302R8", + "upload": { + "maximum_ram_size": 16384, + "maximum_size": 65536 + }, + "url": "https://developer.mbed.org/platforms/ST-Nucleo-F302R8/", + "vendor": "ST" +} \ No newline at end of file diff --git a/boards/nucleo_f303k8.json b/boards/nucleo_f303k8.json new file mode 100644 index 0000000..d1529bf --- /dev/null +++ b/boards/nucleo_f303k8.json @@ -0,0 +1,17 @@ +{ + "build": { + "cpu": "cortex-m4", + "f_cpu": "72000000L", + "mcu": "stm32f303k8t6" + }, + "frameworks": [ + "mbed" + ], + "name": "ST Nucleo F303K8", + "upload": { + "maximum_ram_size": 16384, + "maximum_size": 65536 + }, + "url": "https://developer.mbed.org/platforms/ST-Nucleo-F303K8/", + "vendor": "ST" +} \ No newline at end of file diff --git a/boards/nucleo_f303re.json b/boards/nucleo_f303re.json new file mode 100644 index 0000000..96405b1 --- /dev/null +++ b/boards/nucleo_f303re.json @@ -0,0 +1,17 @@ +{ + "build": { + "cpu": "cortex-m4", + "f_cpu": "72000000L", + "mcu": "stm32f303ret6" + }, + "frameworks": [ + "mbed" + ], + "name": "ST Nucleo F303RE", + "upload": { + "maximum_ram_size": 65536, + "maximum_size": 524288 + }, + "url": "http://developer.mbed.org/platforms/ST-Nucleo-F303RE/", + "vendor": "ST" +} \ No newline at end of file diff --git a/boards/nucleo_f334r8.json b/boards/nucleo_f334r8.json new file mode 100644 index 0000000..6e9df5c --- /dev/null +++ b/boards/nucleo_f334r8.json @@ -0,0 +1,17 @@ +{ + "build": { + "cpu": "cortex-m4", + "f_cpu": "72000000L", + "mcu": "stm32f334r8t6" + }, + "frameworks": [ + "mbed" + ], + "name": "ST Nucleo F334R8", + "upload": { + "maximum_ram_size": 16384, + "maximum_size": 65536 + }, + "url": "https://developer.mbed.org/platforms/ST-Nucleo-F334R8/", + "vendor": "ST" +} \ No newline at end of file diff --git a/boards/nucleo_f401re.json b/boards/nucleo_f401re.json new file mode 100644 index 0000000..b31da80 --- /dev/null +++ b/boards/nucleo_f401re.json @@ -0,0 +1,23 @@ +{ + "build": { + "core": "stm32", + "cpu": "cortex-m4", + "extra_flags": "-DSTM32F4 -DSTM32F401xE -DSTM32F40_41xxx", + "f_cpu": "84000000L", + "ldscript": "stm32f401xe.ld", + "mcu": "stm32f401ret6", + "variant": "stm32f401xe" + }, + "frameworks": [ + "mbed", + "cmsis", + "spl" + ], + "name": "ST Nucleo F401RE", + "upload": { + "maximum_ram_size": 98304, + "maximum_size": 524288 + }, + "url": "https://developer.mbed.org/platforms/ST-Nucleo-F401RE/", + "vendor": "ST" +} \ No newline at end of file diff --git a/boards/nucleo_f410rb.json b/boards/nucleo_f410rb.json new file mode 100644 index 0000000..015e7d2 --- /dev/null +++ b/boards/nucleo_f410rb.json @@ -0,0 +1,17 @@ +{ + "build": { + "cpu": "cortex-m4", + "f_cpu": "100000000L", + "mcu": "stm32f410rbt6" + }, + "frameworks": [ + "mbed" + ], + "name": "ST Nucleo F410RB", + "upload": { + "maximum_ram_size": 32768, + "maximum_size": 131072 + }, + "url": "https://developer.mbed.org/platforms/ST-Nucleo-F410RB/", + "vendor": "ST" +} \ No newline at end of file diff --git a/boards/nucleo_f411re.json b/boards/nucleo_f411re.json new file mode 100644 index 0000000..7fa6fe8 --- /dev/null +++ b/boards/nucleo_f411re.json @@ -0,0 +1,17 @@ +{ + "build": { + "cpu": "cortex-m4", + "f_cpu": "100000000L", + "mcu": "stm32f411ret6" + }, + "frameworks": [ + "mbed" + ], + "name": "ST Nucleo F411RE", + "upload": { + "maximum_ram_size": 131072, + "maximum_size": 524288 + }, + "url": "https://developer.mbed.org/platforms/ST-Nucleo-F411RE/", + "vendor": "ST" +} \ No newline at end of file diff --git a/boards/nucleo_f446re.json b/boards/nucleo_f446re.json new file mode 100644 index 0000000..786ffa8 --- /dev/null +++ b/boards/nucleo_f446re.json @@ -0,0 +1,17 @@ +{ + "build": { + "cpu": "cortex-m4", + "f_cpu": "180000000L", + "mcu": "stm32f446ret6" + }, + "frameworks": [ + "mbed" + ], + "name": "ST Nucleo F446RE", + "upload": { + "maximum_ram_size": 131072, + "maximum_size": 524288 + }, + "url": "https://developer.mbed.org/platforms/ST-Nucleo-F446RE/", + "vendor": "ST" +} \ No newline at end of file diff --git a/boards/nucleo_l053r8.json b/boards/nucleo_l053r8.json new file mode 100644 index 0000000..e300bf1 --- /dev/null +++ b/boards/nucleo_l053r8.json @@ -0,0 +1,17 @@ +{ + "build": { + "cpu": "cortex-m0", + "f_cpu": "48000000L", + "mcu": "stm32l053r8t6" + }, + "frameworks": [ + "mbed" + ], + "name": "ST Nucleo L053R8", + "upload": { + "maximum_ram_size": 8192, + "maximum_size": 65536 + }, + "url": "https://developer.mbed.org/platforms/ST-Nucleo-L053R8/", + "vendor": "ST" +} \ No newline at end of file diff --git a/boards/nucleo_l073rz.json b/boards/nucleo_l073rz.json new file mode 100644 index 0000000..7be0932 --- /dev/null +++ b/boards/nucleo_l073rz.json @@ -0,0 +1,17 @@ +{ + "build": { + "cpu": "cortex-m0plus", + "f_cpu": "32000000L", + "mcu": "stm32l073rz" + }, + "frameworks": [ + "mbed" + ], + "name": "ST Nucleo L073RZ", + "upload": { + "maximum_ram_size": 20480, + "maximum_size": 196608 + }, + "url": "https://developer.mbed.org/platforms/ST-Nucleo-L073RZ/", + "vendor": "ST" +} \ No newline at end of file diff --git a/boards/nucleo_l152re.json b/boards/nucleo_l152re.json new file mode 100644 index 0000000..bbb3279 --- /dev/null +++ b/boards/nucleo_l152re.json @@ -0,0 +1,17 @@ +{ + "build": { + "cpu": "cortex-m3", + "f_cpu": "32000000L", + "mcu": "stm32l152ret6" + }, + "frameworks": [ + "mbed" + ], + "name": "ST Nucleo L152RE", + "upload": { + "maximum_ram_size": 81920, + "maximum_size": 524288 + }, + "url": "https://developer.mbed.org/platforms/ST-Nucleo-L152RE/", + "vendor": "ST" +} \ No newline at end of file diff --git a/boards/nucleo_l476rg.json b/boards/nucleo_l476rg.json new file mode 100644 index 0000000..ca51eff --- /dev/null +++ b/boards/nucleo_l476rg.json @@ -0,0 +1,17 @@ +{ + "build": { + "cpu": "cortex-m4", + "f_cpu": "80000000L", + "mcu": "stm32l476rgt6" + }, + "frameworks": [ + "mbed" + ], + "name": "ST Nucleo L476RG", + "upload": { + "maximum_ram_size": 131072, + "maximum_size": 1048576 + }, + "url": "https://developer.mbed.org/platforms/ST-Nucleo-L476RG/", + "vendor": "ST" +} \ No newline at end of file diff --git a/boards/seeedArchMax.json b/boards/seeedArchMax.json new file mode 100644 index 0000000..ec91fd4 --- /dev/null +++ b/boards/seeedArchMax.json @@ -0,0 +1,17 @@ +{ + "build": { + "cpu": "cortex-m4", + "f_cpu": "168000000L", + "mcu": "stm32f407vet6" + }, + "frameworks": [ + "mbed" + ], + "name": "SeeedStudio Arch Max", + "upload": { + "maximum_ram_size": 196608, + "maximum_size": 524288 + }, + "url": "https://developer.mbed.org/platforms/Seeed-Arch-Max/", + "vendor": "SeeedStudio" +} \ No newline at end of file diff --git a/builder/frameworks/cmsis.py b/builder/frameworks/cmsis.py new file mode 100644 index 0000000..fbb9d7b --- /dev/null +++ b/builder/frameworks/cmsis.py @@ -0,0 +1,92 @@ +# Copyright 2014-present Ivan Kravets +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +""" +CMSIS + +The ARM Cortex Microcontroller Software Interface Standard (CMSIS) is a +vendor-independent hardware abstraction layer for the Cortex-M processor +series and specifies debugger interfaces. The CMSIS enables consistent and +simple software interfaces to the processor for interface peripherals, +real-time operating systems, and middleware. It simplifies software +re-use, reducing the learning curve for new microcontroller developers +and cutting the time-to-market for devices. + +http://www.arm.com/products/processors/cortex-m/cortex-microcontroller-software-interface-standard.php +""" + +from os.path import isdir, isfile, join + +from SCons.Script import DefaultEnvironment + +env = DefaultEnvironment() +platform = env.DevPlatform() + +FRAMEWORK_DIR = platform.get_package_dir("framework-cmsis") +assert isdir(FRAMEWORK_DIR) + +env.VariantDirWrap( + join("$BUILD_DIR", "FrameworkCMSIS"), + join(FRAMEWORK_DIR, "cores", env.BoardConfig().get("build.core")) +) + +env.Append( + CPPPATH=[ + join("$BUILD_DIR", "FrameworkCMSIS"), + join("$BUILD_DIR", "FrameworkCMSISCommon"), + join("$BUILD_DIR", "FrameworkCMSISVariant") + ] +) + +envsafe = env.Clone() + +# +# Target: Build Core Library +# + +# use mbed ldscript with bootloader section +ldscript = env.BoardConfig().get("build.ldscript") +if not isfile(join(platform.get_dir(), "ldscripts", ldscript)): + if "mbed" in env.BoardConfig().get("frameworks", []): + env.Append( + LINKFLAGS=[ + '-Wl,-T"%s"' % + join( + platform.get_package_dir("framework-mbed"), "variant", + env.subst("$BOARD").upper(), "mbed", + "TARGET_%s" % env.subst("$BOARD").upper(), + "TOOLCHAIN_GCC_ARM", "%s.ld" % ldscript.upper()[:-3] + ) + ] + ) + +libs = [] +libs.append(envsafe.BuildLibrary( + join("$BUILD_DIR", "FrameworkCMSISVariant"), + join( + FRAMEWORK_DIR, "variants", + env.BoardConfig().get("build.variant")[0:7], + env.BoardConfig().get("build.variant") + ) +)) + +libs.append(envsafe.BuildLibrary( + join("$BUILD_DIR", "FrameworkCMSISCommon"), + join( + FRAMEWORK_DIR, "variants", + env.BoardConfig().get("build.variant")[0:7], "common" + ) +)) + +env.Append(LIBS=libs) diff --git a/builder/frameworks/libopencm3 b/builder/frameworks/libopencm3 new file mode 160000 index 0000000..bebcfa5 --- /dev/null +++ b/builder/frameworks/libopencm3 @@ -0,0 +1 @@ +Subproject commit bebcfa54a47c6f61fbb836200fe4a045cd568a38 diff --git a/builder/frameworks/mbed b/builder/frameworks/mbed new file mode 160000 index 0000000..7167dac --- /dev/null +++ b/builder/frameworks/mbed @@ -0,0 +1 @@ +Subproject commit 7167dac0023505f9a433a5e4215bdeaafa46d41f diff --git a/builder/frameworks/spl.py b/builder/frameworks/spl.py new file mode 100644 index 0000000..0d89f48 --- /dev/null +++ b/builder/frameworks/spl.py @@ -0,0 +1,118 @@ +# Copyright 2014-present Ivan Kravets +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +""" +SPL + +The ST Standard Peripheral Library provides a set of functions for +handling the peripherals on the STM32 Cortex-M3 family. +The idea is to save the user (the new user, in particular) having to deal +directly with the registers. + +http://www.st.com/web/en/catalog/tools/FM147/CL1794/SC961/SS1743?sc=stm32embeddedsoftware +""" + +from os.path import isdir, isfile, join + +from SCons.Script import DefaultEnvironment + +env = DefaultEnvironment() +platform = env.DevPlatform() + +FRAMEWORK_DIR = platform.get_package_dir("framework-spl") +assert isdir(FRAMEWORK_DIR) + +env.VariantDirWrap( + join("$BUILD_DIR", "FrameworkCMSIS"), + join(FRAMEWORK_DIR, env.BoardConfig().get("build.core"), + "cmsis", "cores", env.BoardConfig().get("build.core")) +) + +env.VariantDirWrap( + join("$BUILD_DIR", "FrameworkSPLInc"), + join( + FRAMEWORK_DIR, env.BoardConfig().get("build.core"), "spl", + "variants", env.BoardConfig().get("build.variant")[0:7], + "inc" + ) +) + +env.Append( + CPPPATH=[ + join("$BUILD_DIR", "FrameworkCMSIS"), + join("$BUILD_DIR", "FrameworkCMSISVariant"), + join("$BUILD_DIR", "FrameworkSPLInc"), + join("$BUILD_DIR", "FrameworkSPL") + ] +) + +envsafe = env.Clone() + +envsafe.Append( + CPPPATH=["$BUILDSRC_DIR"], + CPPDEFINES=[ + "USE_STDPERIPH_DRIVER" + ] +) + +# +# Target: Build SPL Library +# + +# use mbed ldscript with bootloader section +ldscript = env.BoardConfig().get("build.ldscript") +if not isfile(join(platform.get_dir(), "ldscripts", ldscript)): + if "mbed" in env.BoardConfig().get("frameworks", []): + env.Append( + LINKFLAGS=[ + '-Wl,-T"%s"' % + join( + platform.get_package_dir("framework-mbed"), "variant", + env.subst("$BOARD").upper(), "mbed", + "TARGET_%s" % env.subst("$BOARD").upper(), + "TOOLCHAIN_GCC_ARM", "%s.ld" % ldscript.upper()[:-3] + ) + ] + ) + +extra_flags = env.BoardConfig().get("build.extra_flags", "") +src_filter_patterns = ["+<*>"] +if "STM32F40_41xxx" in extra_flags: + src_filter_patterns += ["-"] +if "STM32F427_437xx" in extra_flags: + src_filter_patterns += ["-"] +elif "STM32F303xC" in extra_flags: + src_filter_patterns += ["-"] +elif "STM32L1XX_MD" in extra_flags: + src_filter_patterns += ["-"] + +libs = [] + +libs.append(envsafe.BuildLibrary( + join("$BUILD_DIR", "FrameworkCMSISVariant"), + join( + FRAMEWORK_DIR, env.BoardConfig().get("build.core"), "cmsis", + "variants", env.BoardConfig().get("build.variant")[0:7] + ) +)) + +libs.append(envsafe.BuildLibrary( + join("$BUILD_DIR", "FrameworkSPL"), + join(FRAMEWORK_DIR, env.BoardConfig().get("build.core"), + "spl", "variants", + env.BoardConfig().get("build.variant")[0:7], "src"), + src_filter=" ".join(src_filter_patterns) +)) + +env.Append(LIBS=libs) diff --git a/builder/main.py b/builder/main.py new file mode 100644 index 0000000..8c546ec --- /dev/null +++ b/builder/main.py @@ -0,0 +1,184 @@ +# Copyright 2014-present Ivan Kravets +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +""" + Builder for ST STM32 Series ARM microcontrollers. +""" + +from os.path import isfile, join + +from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Builder, Default, + DefaultEnvironment) + +env = DefaultEnvironment() + +env.Replace( + AR="arm-none-eabi-ar", + AS="arm-none-eabi-as", + CC="arm-none-eabi-gcc", + CXX="arm-none-eabi-g++", + OBJCOPY="arm-none-eabi-objcopy", + RANLIB="arm-none-eabi-ranlib", + SIZETOOL="arm-none-eabi-size", + + ARFLAGS=["rcs"], + + ASFLAGS=["-x", "assembler-with-cpp"], + + CCFLAGS=[ + "-g", # include debugging info (so errors include line numbers) + "-Os", # optimize for size + "-ffunction-sections", # place each function in its own section + "-fdata-sections", + "-Wall", + "-mthumb", + "-nostdlib" + ], + + CXXFLAGS=[ + "-fno-rtti", + "-fno-exceptions" + ], + + CPPDEFINES=[ + "F_CPU=$BOARD_F_CPU" + ], + + LINKFLAGS=[ + "-Os", + "-Wl,--gc-sections,--relax", + "-mthumb", + "-nostartfiles", + "-nostdlib" + ], + + LIBS=["c", "gcc", "m", "stdc++", "nosys"], + + UPLOADER="st-flash", + UPLOADERFLAGS=[ + "write", # write in flash + "$SOURCES", # firmware path to flash + "0x08000000" # flash start adress + ], + UPLOADCMD='$UPLOADER $UPLOADERFLAGS', + + SIZEPRINTCMD='$SIZETOOL -B -d $SOURCES', + + PROGNAME="firmware", + PROGSUFFIX=".elf" +) + +if "BOARD" in env: + env.Append( + CCFLAGS=[ + "-mcpu=%s" % env.BoardConfig().get("build.cpu") + ], + CPPDEFINES=[ + env.BoardConfig().get("build.variant", "").upper() + ], + LINKFLAGS=[ + "-mcpu=%s" % env.BoardConfig().get("build.cpu") + ] + ) + +env.Append( + ASFLAGS=env.get("CCFLAGS", [])[:], + + BUILDERS=dict( + ElfToBin=Builder( + action=" ".join([ + "$OBJCOPY", + "-O", + "binary", + "$SOURCES", + "$TARGET"]), + suffix=".bin" + ), + ElfToHex=Builder( + action=" ".join([ + "$OBJCOPY", + "-O", + "ihex", + "-R", + ".eeprom", + "$SOURCES", + "$TARGET"]), + suffix=".hex" + ) + ) +) + +if env.subst("$UPLOAD_PROTOCOL") == "gdb": + if not isfile(join(env.subst("$PROJECT_DIR"), "upload.gdb")): + env.Exit( + "Error: You are using GDB as firmware uploader. " + "Please specify upload commands in upload.gdb " + "file in project directory!" + ) + env.Replace( + UPLOADER="arm-none-eabi-gdb", + UPLOADERFLAGS=[ + join("$BUILD_DIR", "firmware.elf"), + "-batch", + "-x", + '"%s"' % join("$PROJECT_DIR", "upload.gdb") + ], + + UPLOADCMD='$UPLOADER $UPLOADERFLAGS' + ) + +# +# Target: Build executable and linkable firmware +# + +target_elf = env.BuildProgram() + +# +# Target: Build the .bin file +# + +if "uploadlazy" in COMMAND_LINE_TARGETS: + target_firm = join("$BUILD_DIR", "firmware.bin") +else: + target_firm = env.ElfToBin(join("$BUILD_DIR", "firmware"), target_elf) + +# +# Target: Print binary size +# + +target_size = env.Alias("size", target_elf, "$SIZEPRINTCMD") +AlwaysBuild(target_size) + +# +# Target: Upload by default .bin file +# + +if "mbed" in env.subst("$FRAMEWORK") and not env.subst("$UPLOAD_PROTOCOL"): + upload = env.Alias(["upload", "uploadlazy"], + target_firm, env.UploadToDisk) +else: + upload = env.Alias(["upload", "uploadlazy"], target_firm, "$UPLOADCMD") +AlwaysBuild(upload) + +# +# Target: Unit Testing +# + +AlwaysBuild(env.Alias("test", [target_firm, target_size])) + +# +# Target: Define targets +# + +Default([target_firm, target_size]) diff --git a/examples/cmsis-blink/.gitignore b/examples/cmsis-blink/.gitignore new file mode 100644 index 0000000..5402c18 --- /dev/null +++ b/examples/cmsis-blink/.gitignore @@ -0,0 +1,3 @@ +.pioenvs +.clang_complete +.gcc-flags.json diff --git a/examples/cmsis-blink/.travis.yml b/examples/cmsis-blink/.travis.yml new file mode 100644 index 0000000..b636184 --- /dev/null +++ b/examples/cmsis-blink/.travis.yml @@ -0,0 +1,65 @@ +# Continuous Integration (CI) is the practice, in software +# engineering, of merging all developer working copies with a shared mainline +# several times a day < http://docs.platformio.org/en/latest/ci/index.html > +# +# Documentation: +# +# * Travis CI Embedded Builds with PlatformIO +# < https://docs.travis-ci.com/user/integration/platformio/ > +# +# * PlatformIO integration with Travis CI +# < http://docs.platformio.org/en/latest/ci/travis.html > +# +# * User Guide for `platformio ci` command +# < http://docs.platformio.org/en/latest/userguide/cmd_ci.html > +# +# +# Please choose one of the following templates (proposed below) and uncomment +# it (remove "# " before each line) or use own configuration according to the +# Travis CI documentation (see above). +# + + +# +# Template #1: General project. Test it using existing `platformio.ini`. +# + +# language: python +# python: +# - "2.7" +# +# sudo: false +# cache: +# directories: +# - "~/.platformio" +# +# install: +# - pip install -U platformio +# +# script: +# - platformio run + + +# +# Template #2: The project is intended to by used as a library with examples +# + +# language: python +# python: +# - "2.7" +# +# sudo: false +# cache: +# directories: +# - "~/.platformio" +# +# env: +# - PLATFORMIO_CI_SRC=path/to/test/file.c +# - PLATFORMIO_CI_SRC=examples/file.ino +# - PLATFORMIO_CI_SRC=path/to/test/directory +# +# install: +# - pip install -U platformio +# +# script: +# - platformio ci --lib="." --board=ID_1 --board=ID_2 --board=ID_N diff --git a/examples/cmsis-blink/README.rst b/examples/cmsis-blink/README.rst new file mode 100644 index 0000000..420b192 --- /dev/null +++ b/examples/cmsis-blink/README.rst @@ -0,0 +1,38 @@ +.. Copyright 2014-present Ivan Kravets + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +How to build PlatformIO based project +===================================== + +1. `Install PlatformIO `_ +2. Download `development platform with examples `_ +3. Extract ZIP archive +4. Run these commands: + +.. code-block:: bash + + # Change directory to example + > cd platform-ststm32/examples/cmsis-blink + + # Build project + > platformio run + + # Upload firmware + > platformio run --target upload + + # Build specific environment + > platformio run -e disco_f407vg + + # Upload firmware for the specific environment + > platformio run -e disco_f407vg --target upload + + # Clean build files + > platformio run --target clean diff --git a/examples/cmsis-blink/lib/readme.txt b/examples/cmsis-blink/lib/readme.txt new file mode 100644 index 0000000..607a92a --- /dev/null +++ b/examples/cmsis-blink/lib/readme.txt @@ -0,0 +1,38 @@ + +This directory is intended for the project specific (private) libraries. +PlatformIO will compile them to static libraries and link to executable file. + +The source code of each library should be placed in separate directory, like +"lib/private_lib/[here are source files]". + +For example, see how can be organized `Foo` and `Bar` libraries: + +|--lib +| |--Bar +| | |--docs +| | |--examples +| | |--src +| | |- Bar.c +| | |- Bar.h +| |--Foo +| | |- Foo.c +| | |- Foo.h +| |- readme.txt --> THIS FILE +|- platformio.ini +|--src + |- main.c + +Then in `src/main.c` you should use: + +#include +#include + +// rest H/C/CPP code + +PlatformIO will find your libraries automatically, configure preprocessor's +include paths and build them. + +See additional options for PlatformIO Library Dependency Finder `lib_*`: + +http://docs.platformio.org/en/latest/projectconf.html#lib-install + diff --git a/examples/cmsis-blink/platformio.ini b/examples/cmsis-blink/platformio.ini new file mode 100644 index 0000000..d19acf8 --- /dev/null +++ b/examples/cmsis-blink/platformio.ini @@ -0,0 +1,33 @@ +# +# Project Configuration File +# +# A detailed documentation with the EXAMPLES is located here: +# http://docs.platformio.org/en/latest/projectconf.html +# + +# A sign `#` at the beginning of the line indicates a comment +# Comment lines are ignored. + +# Simple and base environment +# [env:mybaseenv] +# platform = %INSTALLED_PLATFORM_NAME_HERE% +# framework = +# board = +# +# Automatic targets - enable auto-uploading +# targets = upload + +[env:disco_f407vg] +platform = ststm32 +framework = cmsis +board = disco_f407vg + +[env:disco_l152rb] +platform = ststm32 +framework = cmsis +board = disco_l152rb + +[env:disco_f303vc] +platform = ststm32 +framework = cmsis +board = disco_f303vc \ No newline at end of file diff --git a/examples/cmsis-blink/src/main.c b/examples/cmsis-blink/src/main.c new file mode 100644 index 0000000..37757c8 --- /dev/null +++ b/examples/cmsis-blink/src/main.c @@ -0,0 +1,45 @@ +#ifdef STM32L1 + #include "stm32l1xx.h" + #define LEDPORT (GPIOB) + #define LED1 (6) + #define LED2 (7) + #define ENABLE_GPIO_CLOCK (RCC->AHBENR |= RCC_AHBENR_GPIOBEN) + #define GPIOMODER ((GPIO_MODER_MODER7_0|GPIO_MODER_MODER6_0)) +#elif STM32F3 + #include "stm32f3xx.h" + #define LEDPORT (GPIOE) + #define LED1 (8) + #define LED2 (9) + #define ENABLE_GPIO_CLOCK (RCC->AHBENR |= RCC_AHBENR_GPIOEEN) + #define GPIOMODER ((GPIO_MODER_MODER9_0|GPIO_MODER_MODER8_0)) +#elif STM32F4 + #include "stm32f4xx.h" + #define LEDPORT (GPIOD) + #define LED1 (12) + #define LED2 (13) + #define ENABLE_GPIO_CLOCK (RCC->AHB1ENR |= RCC_AHB1ENR_GPIODEN) + #define GPIOMODER ((GPIO_MODER_MODER13_0|GPIO_MODER_MODER12_0)) +#endif + + +void ms_delay(int ms) +{ + while (ms-- > 0) { + volatile int x=500; + while (x-- > 0) + __asm("nop"); + } +} + +//Alternates blue and green LEDs quickly +int main(void) +{ + ENABLE_GPIO_CLOCK; // enable the clock to GPIO + LEDPORT->MODER |= GPIOMODER; // set pins to be general purpose output + for (;;) { + ms_delay(500); + LEDPORT->ODR ^= (1< +# +# Documentation: +# +# * Travis CI Embedded Builds with PlatformIO +# < https://docs.travis-ci.com/user/integration/platformio/ > +# +# * PlatformIO integration with Travis CI +# < http://docs.platformio.org/en/latest/ci/travis.html > +# +# * User Guide for `platformio ci` command +# < http://docs.platformio.org/en/latest/userguide/cmd_ci.html > +# +# +# Please choose one of the following templates (proposed below) and uncomment +# it (remove "# " before each line) or use own configuration according to the +# Travis CI documentation (see above). +# + + +# +# Template #1: General project. Test it using existing `platformio.ini`. +# + +# language: python +# python: +# - "2.7" +# +# sudo: false +# cache: +# directories: +# - "~/.platformio" +# +# install: +# - pip install -U platformio +# +# script: +# - platformio run + + +# +# Template #2: The project is intended to by used as a library with examples +# + +# language: python +# python: +# - "2.7" +# +# sudo: false +# cache: +# directories: +# - "~/.platformio" +# +# env: +# - PLATFORMIO_CI_SRC=path/to/test/file.c +# - PLATFORMIO_CI_SRC=examples/file.ino +# - PLATFORMIO_CI_SRC=path/to/test/directory +# +# install: +# - pip install -U platformio +# +# script: +# - platformio ci --lib="." --board=ID_1 --board=ID_2 --board=ID_N diff --git a/examples/libopencm3-blink/README.rst b/examples/libopencm3-blink/README.rst new file mode 100644 index 0000000..a6846ba --- /dev/null +++ b/examples/libopencm3-blink/README.rst @@ -0,0 +1,38 @@ +.. Copyright 2014-present Ivan Kravets + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +How to build PlatformIO based project +===================================== + +1. `Install PlatformIO `_ +2. Download `development platform with examples `_ +3. Extract ZIP archive +4. Run these commands: + +.. code-block:: bash + + # Change directory to example + > cd platform-ststm32/examples/libopencm3-blink + + # Build project + > platformio run + + # Upload firmware + > platformio run --target upload + + # Build specific environment + > platformio run -e disco_f407vg + + # Upload firmware for the specific environment + > platformio run -e disco_f407vg --target upload + + # Clean build files + > platformio run --target clean diff --git a/examples/libopencm3-blink/lib/readme.txt b/examples/libopencm3-blink/lib/readme.txt new file mode 100644 index 0000000..607a92a --- /dev/null +++ b/examples/libopencm3-blink/lib/readme.txt @@ -0,0 +1,38 @@ + +This directory is intended for the project specific (private) libraries. +PlatformIO will compile them to static libraries and link to executable file. + +The source code of each library should be placed in separate directory, like +"lib/private_lib/[here are source files]". + +For example, see how can be organized `Foo` and `Bar` libraries: + +|--lib +| |--Bar +| | |--docs +| | |--examples +| | |--src +| | |- Bar.c +| | |- Bar.h +| |--Foo +| | |- Foo.c +| | |- Foo.h +| |- readme.txt --> THIS FILE +|- platformio.ini +|--src + |- main.c + +Then in `src/main.c` you should use: + +#include +#include + +// rest H/C/CPP code + +PlatformIO will find your libraries automatically, configure preprocessor's +include paths and build them. + +See additional options for PlatformIO Library Dependency Finder `lib_*`: + +http://docs.platformio.org/en/latest/projectconf.html#lib-install + diff --git a/examples/libopencm3-blink/platformio.ini b/examples/libopencm3-blink/platformio.ini new file mode 100644 index 0000000..2c04a6d --- /dev/null +++ b/examples/libopencm3-blink/platformio.ini @@ -0,0 +1,33 @@ +# +# Project Configuration File +# +# A detailed documentation with the EXAMPLES is located here: +# http://docs.platformio.org/en/latest/projectconf.html +# + +# A sign `#` at the beginning of the line indicates a comment +# Comment lines are ignored. + +# Simple and base environment +# [env:mybaseenv] +# platform = %INSTALLED_PLATFORM_NAME_HERE% +# framework = +# board = +# +# Automatic targets - enable auto-uploading +# targets = upload + +[env:disco_f407vg] +platform = ststm32 +framework = libopencm3 +board = disco_f407vg + +[env:disco_l152rb] +platform = ststm32 +framework = libopencm3 +board = disco_l152rb + +[env:disco_f303vc] +platform = ststm32 +framework = libopencm3 +board = disco_f303vc diff --git a/examples/libopencm3-blink/src/main.c b/examples/libopencm3-blink/src/main.c new file mode 100644 index 0000000..aae779b --- /dev/null +++ b/examples/libopencm3-blink/src/main.c @@ -0,0 +1,62 @@ +/* + * This file is part of the libopencm3 project. + * + * Copyright (C) 2009 Uwe Hermann + * Copyright (C) 2011 Stephen Caudle + * Copyright (C) 2012 Karl Palsson + * + * This library is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library. If not, see . + */ + +#include +#include +#ifdef STM32L1 + #define RCCLEDPORT (RCC_GPIOB) + #define LEDPORT (GPIOB) + #define LEDPIN (GPIO6) +#elif STM32F3 + #define RCCLEDPORT (RCC_GPIOE) + #define LEDPORT (GPIOE) + #define LEDPIN (GPIO8) +#elif STM32F4 + #define RCCLEDPORT (RCC_GPIOD) + #define LEDPORT (GPIOD) + #define LEDPIN (GPIO12) +#endif + +static void gpio_setup(void) +{ + /* Enable GPIO clock. */ + /* Using API functions: */ + rcc_periph_clock_enable(RCCLEDPORT); + /* Set pin to 'output push-pull'. */ + /* Using API functions: */ + gpio_mode_setup(LEDPORT, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, LEDPIN); +} + +int main(void) +{ + int i; + gpio_setup(); + /* Blink the LED on the board. */ + while (1) { + /* Using API function gpio_toggle(): */ + gpio_toggle(LEDPORT, LEDPIN); /* LED on/off */ + for (i = 0; i < 1000000; i++) { /* Wait a bit. */ + __asm__("nop"); + } + } + + return 0; +} diff --git a/examples/mbed-blink/.gitignore b/examples/mbed-blink/.gitignore new file mode 100644 index 0000000..5402c18 --- /dev/null +++ b/examples/mbed-blink/.gitignore @@ -0,0 +1,3 @@ +.pioenvs +.clang_complete +.gcc-flags.json diff --git a/examples/mbed-blink/.travis.yml b/examples/mbed-blink/.travis.yml new file mode 100644 index 0000000..b636184 --- /dev/null +++ b/examples/mbed-blink/.travis.yml @@ -0,0 +1,65 @@ +# Continuous Integration (CI) is the practice, in software +# engineering, of merging all developer working copies with a shared mainline +# several times a day < http://docs.platformio.org/en/latest/ci/index.html > +# +# Documentation: +# +# * Travis CI Embedded Builds with PlatformIO +# < https://docs.travis-ci.com/user/integration/platformio/ > +# +# * PlatformIO integration with Travis CI +# < http://docs.platformio.org/en/latest/ci/travis.html > +# +# * User Guide for `platformio ci` command +# < http://docs.platformio.org/en/latest/userguide/cmd_ci.html > +# +# +# Please choose one of the following templates (proposed below) and uncomment +# it (remove "# " before each line) or use own configuration according to the +# Travis CI documentation (see above). +# + + +# +# Template #1: General project. Test it using existing `platformio.ini`. +# + +# language: python +# python: +# - "2.7" +# +# sudo: false +# cache: +# directories: +# - "~/.platformio" +# +# install: +# - pip install -U platformio +# +# script: +# - platformio run + + +# +# Template #2: The project is intended to by used as a library with examples +# + +# language: python +# python: +# - "2.7" +# +# sudo: false +# cache: +# directories: +# - "~/.platformio" +# +# env: +# - PLATFORMIO_CI_SRC=path/to/test/file.c +# - PLATFORMIO_CI_SRC=examples/file.ino +# - PLATFORMIO_CI_SRC=path/to/test/directory +# +# install: +# - pip install -U platformio +# +# script: +# - platformio ci --lib="." --board=ID_1 --board=ID_2 --board=ID_N diff --git a/examples/mbed-blink/README.rst b/examples/mbed-blink/README.rst new file mode 100644 index 0000000..1b298c8 --- /dev/null +++ b/examples/mbed-blink/README.rst @@ -0,0 +1,38 @@ +.. Copyright 2014-present Ivan Kravets + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +How to build PlatformIO based project +===================================== + +1. `Install PlatformIO `_ +2. Download `development platform with examples `_ +3. Extract ZIP archive +4. Run these commands: + +.. code-block:: bash + + # Change directory to example + > cd platform-ststm32/examples/mbed-blink + + # Build project + > platformio run + + # Upload firmware + > platformio run --target upload + + # Build specific environment + > platformio run -e nucleo_f401re + + # Upload firmware for the specific environment + > platformio run -e nucleo_f401re --target upload + + # Clean build files + > platformio run --target clean diff --git a/examples/mbed-blink/lib/readme.txt b/examples/mbed-blink/lib/readme.txt new file mode 100644 index 0000000..607a92a --- /dev/null +++ b/examples/mbed-blink/lib/readme.txt @@ -0,0 +1,38 @@ + +This directory is intended for the project specific (private) libraries. +PlatformIO will compile them to static libraries and link to executable file. + +The source code of each library should be placed in separate directory, like +"lib/private_lib/[here are source files]". + +For example, see how can be organized `Foo` and `Bar` libraries: + +|--lib +| |--Bar +| | |--docs +| | |--examples +| | |--src +| | |- Bar.c +| | |- Bar.h +| |--Foo +| | |- Foo.c +| | |- Foo.h +| |- readme.txt --> THIS FILE +|- platformio.ini +|--src + |- main.c + +Then in `src/main.c` you should use: + +#include +#include + +// rest H/C/CPP code + +PlatformIO will find your libraries automatically, configure preprocessor's +include paths and build them. + +See additional options for PlatformIO Library Dependency Finder `lib_*`: + +http://docs.platformio.org/en/latest/projectconf.html#lib-install + diff --git a/examples/mbed-blink/platformio.ini b/examples/mbed-blink/platformio.ini new file mode 100644 index 0000000..e2b977a --- /dev/null +++ b/examples/mbed-blink/platformio.ini @@ -0,0 +1,78 @@ +# +# Project Configuration File +# +# A detailed documentation with the EXAMPLES is located here: +# http://docs.platformio.org/en/latest/projectconf.html +# + +# A sign `#` at the beginning of the line indicates a comment +# Comment lines are ignored. + +# Simple and base environment +# [env:mybaseenv] +# platform = %INSTALLED_PLATFORM_NAME_HERE% +# framework = +# board = +# +# Automatic targets - enable auto-uploading +# targets = upload + +[env:disco_f407vg] +platform = ststm32 +framework = mbed +board = disco_f407vg + +[env:disco_f303vc] +platform = ststm32 +framework = mbed +board = disco_f303vc + +[env:disco_f100rb] +platform = ststm32 +framework = mbed +board = disco_f100rb + +[env:nucleo_f030r8] +platform = ststm32 +framework = mbed +board = nucleo_f030r8 + +[env:nucleo_f103rb] +platform = ststm32 +framework = mbed +board = nucleo_f103rb + +[env:nucleo_f302r8] +platform = ststm32 +framework = mbed +board = nucleo_f302r8 + +[env:nucleo_f401re] +platform = ststm32 +framework = mbed +board = nucleo_f401re + +[env:nucleo_l053r8] +platform = ststm32 +framework = mbed +board = nucleo_l053r8 + +[env:nucleo_l152re] +platform = ststm32 +framework = mbed +board = nucleo_l152re + +[env:disco_l053c8] +platform = ststm32 +framework = mbed +board = disco_l053c8 + +[env:seeedArchMax] +platform = ststm32 +framework = mbed +board = seeedArchMax + +[env:mts_mdot_f411re] +platform = ststm32 +framework = mbed +board = mts_mdot_f411re diff --git a/examples/mbed-blink/src/main.cpp b/examples/mbed-blink/src/main.cpp new file mode 100644 index 0000000..8247a2e --- /dev/null +++ b/examples/mbed-blink/src/main.cpp @@ -0,0 +1,12 @@ +#include "mbed.h" + +DigitalOut myled(LED1); + +int main() { + while(1) { + myled = 1; + wait(1); + myled = 0; + wait(1); + } +} \ No newline at end of file diff --git a/examples/mbed-dsp/.gitignore b/examples/mbed-dsp/.gitignore new file mode 100644 index 0000000..5402c18 --- /dev/null +++ b/examples/mbed-dsp/.gitignore @@ -0,0 +1,3 @@ +.pioenvs +.clang_complete +.gcc-flags.json diff --git a/examples/mbed-dsp/.travis.yml b/examples/mbed-dsp/.travis.yml new file mode 100644 index 0000000..b636184 --- /dev/null +++ b/examples/mbed-dsp/.travis.yml @@ -0,0 +1,65 @@ +# Continuous Integration (CI) is the practice, in software +# engineering, of merging all developer working copies with a shared mainline +# several times a day < http://docs.platformio.org/en/latest/ci/index.html > +# +# Documentation: +# +# * Travis CI Embedded Builds with PlatformIO +# < https://docs.travis-ci.com/user/integration/platformio/ > +# +# * PlatformIO integration with Travis CI +# < http://docs.platformio.org/en/latest/ci/travis.html > +# +# * User Guide for `platformio ci` command +# < http://docs.platformio.org/en/latest/userguide/cmd_ci.html > +# +# +# Please choose one of the following templates (proposed below) and uncomment +# it (remove "# " before each line) or use own configuration according to the +# Travis CI documentation (see above). +# + + +# +# Template #1: General project. Test it using existing `platformio.ini`. +# + +# language: python +# python: +# - "2.7" +# +# sudo: false +# cache: +# directories: +# - "~/.platformio" +# +# install: +# - pip install -U platformio +# +# script: +# - platformio run + + +# +# Template #2: The project is intended to by used as a library with examples +# + +# language: python +# python: +# - "2.7" +# +# sudo: false +# cache: +# directories: +# - "~/.platformio" +# +# env: +# - PLATFORMIO_CI_SRC=path/to/test/file.c +# - PLATFORMIO_CI_SRC=examples/file.ino +# - PLATFORMIO_CI_SRC=path/to/test/directory +# +# install: +# - pip install -U platformio +# +# script: +# - platformio ci --lib="." --board=ID_1 --board=ID_2 --board=ID_N diff --git a/examples/mbed-dsp/README.rst b/examples/mbed-dsp/README.rst new file mode 100644 index 0000000..d9cbc9e --- /dev/null +++ b/examples/mbed-dsp/README.rst @@ -0,0 +1,38 @@ +.. Copyright 2014-present Ivan Kravets + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +How to build PlatformIO based project +===================================== + +1. `Install PlatformIO `_ +2. Download `development platform with examples `_ +3. Extract ZIP archive +4. Run these commands: + +.. code-block:: bash + + # Change directory to example + > cd platform-ststm32/examples/mbed-dsp + + # Build project + > platformio run + + # Upload firmware + > platformio run --target upload + + # Build specific environment + > platformio run -e nucleo_f401re + + # Upload firmware for the specific environment + > platformio run -e nucleo_f401re --target upload + + # Clean build files + > platformio run --target clean diff --git a/examples/mbed-dsp/lib/readme.txt b/examples/mbed-dsp/lib/readme.txt new file mode 100644 index 0000000..607a92a --- /dev/null +++ b/examples/mbed-dsp/lib/readme.txt @@ -0,0 +1,38 @@ + +This directory is intended for the project specific (private) libraries. +PlatformIO will compile them to static libraries and link to executable file. + +The source code of each library should be placed in separate directory, like +"lib/private_lib/[here are source files]". + +For example, see how can be organized `Foo` and `Bar` libraries: + +|--lib +| |--Bar +| | |--docs +| | |--examples +| | |--src +| | |- Bar.c +| | |- Bar.h +| |--Foo +| | |- Foo.c +| | |- Foo.h +| |- readme.txt --> THIS FILE +|- platformio.ini +|--src + |- main.c + +Then in `src/main.c` you should use: + +#include +#include + +// rest H/C/CPP code + +PlatformIO will find your libraries automatically, configure preprocessor's +include paths and build them. + +See additional options for PlatformIO Library Dependency Finder `lib_*`: + +http://docs.platformio.org/en/latest/projectconf.html#lib-install + diff --git a/examples/mbed-dsp/platformio.ini b/examples/mbed-dsp/platformio.ini new file mode 100644 index 0000000..e2b977a --- /dev/null +++ b/examples/mbed-dsp/platformio.ini @@ -0,0 +1,78 @@ +# +# Project Configuration File +# +# A detailed documentation with the EXAMPLES is located here: +# http://docs.platformio.org/en/latest/projectconf.html +# + +# A sign `#` at the beginning of the line indicates a comment +# Comment lines are ignored. + +# Simple and base environment +# [env:mybaseenv] +# platform = %INSTALLED_PLATFORM_NAME_HERE% +# framework = +# board = +# +# Automatic targets - enable auto-uploading +# targets = upload + +[env:disco_f407vg] +platform = ststm32 +framework = mbed +board = disco_f407vg + +[env:disco_f303vc] +platform = ststm32 +framework = mbed +board = disco_f303vc + +[env:disco_f100rb] +platform = ststm32 +framework = mbed +board = disco_f100rb + +[env:nucleo_f030r8] +platform = ststm32 +framework = mbed +board = nucleo_f030r8 + +[env:nucleo_f103rb] +platform = ststm32 +framework = mbed +board = nucleo_f103rb + +[env:nucleo_f302r8] +platform = ststm32 +framework = mbed +board = nucleo_f302r8 + +[env:nucleo_f401re] +platform = ststm32 +framework = mbed +board = nucleo_f401re + +[env:nucleo_l053r8] +platform = ststm32 +framework = mbed +board = nucleo_l053r8 + +[env:nucleo_l152re] +platform = ststm32 +framework = mbed +board = nucleo_l152re + +[env:disco_l053c8] +platform = ststm32 +framework = mbed +board = disco_l053c8 + +[env:seeedArchMax] +platform = ststm32 +framework = mbed +board = seeedArchMax + +[env:mts_mdot_f411re] +platform = ststm32 +framework = mbed +board = mts_mdot_f411re diff --git a/examples/mbed-dsp/src/data.cpp b/examples/mbed-dsp/src/data.cpp new file mode 100644 index 0000000..d946b36 --- /dev/null +++ b/examples/mbed-dsp/src/data.cpp @@ -0,0 +1,94 @@ +#include "arm_math.h" + +/* ---------------------------------------------------------------------- +** Test input signal contains 1000Hz + 15000 Hz +** ------------------------------------------------------------------- */ + +float32_t testInput_f32_1kHz_15kHz[320] = +{ ++0.0000000000f, +0.5924659585f, -0.0947343455f, +0.1913417162f, +1.0000000000f, +0.4174197128f, +0.3535533906f, +1.2552931065f, ++0.8660254038f, +0.4619397663f, +1.3194792169f, +1.1827865776f, +0.5000000000f, +1.1827865776f, +1.3194792169f, +0.4619397663f, ++0.8660254038f, +1.2552931065f, +0.3535533906f, +0.4174197128f, +1.0000000000f, +0.1913417162f, -0.0947343455f, +0.5924659585f, +-0.0000000000f, -0.5924659585f, +0.0947343455f, -0.1913417162f, -1.0000000000f, -0.4174197128f, -0.3535533906f, -1.2552931065f, +-0.8660254038f, -0.4619397663f, -1.3194792169f, -1.1827865776f, -0.5000000000f, -1.1827865776f, -1.3194792169f, -0.4619397663f, +-0.8660254038f, -1.2552931065f, -0.3535533906f, -0.4174197128f, -1.0000000000f, -0.1913417162f, +0.0947343455f, -0.5924659585f, ++0.0000000000f, +0.5924659585f, -0.0947343455f, +0.1913417162f, +1.0000000000f, +0.4174197128f, +0.3535533906f, +1.2552931065f, ++0.8660254038f, +0.4619397663f, +1.3194792169f, +1.1827865776f, +0.5000000000f, +1.1827865776f, +1.3194792169f, +0.4619397663f, ++0.8660254038f, +1.2552931065f, +0.3535533906f, +0.4174197128f, +1.0000000000f, +0.1913417162f, -0.0947343455f, +0.5924659585f, ++0.0000000000f, -0.5924659585f, +0.0947343455f, -0.1913417162f, -1.0000000000f, -0.4174197128f, -0.3535533906f, -1.2552931065f, +-0.8660254038f, -0.4619397663f, -1.3194792169f, -1.1827865776f, -0.5000000000f, -1.1827865776f, -1.3194792169f, -0.4619397663f, +-0.8660254038f, -1.2552931065f, -0.3535533906f, -0.4174197128f, -1.0000000000f, -0.1913417162f, +0.0947343455f, -0.5924659585f, ++0.0000000000f, +0.5924659585f, -0.0947343455f, +0.1913417162f, +1.0000000000f, +0.4174197128f, +0.3535533906f, +1.2552931065f, ++0.8660254038f, +0.4619397663f, +1.3194792169f, +1.1827865776f, +0.5000000000f, +1.1827865776f, +1.3194792169f, +0.4619397663f, ++0.8660254038f, +1.2552931065f, +0.3535533906f, +0.4174197128f, +1.0000000000f, +0.1913417162f, -0.0947343455f, +0.5924659585f, ++0.0000000000f, -0.5924659585f, +0.0947343455f, -0.1913417162f, -1.0000000000f, -0.4174197128f, -0.3535533906f, -1.2552931065f, +-0.8660254038f, -0.4619397663f, -1.3194792169f, -1.1827865776f, -0.5000000000f, -1.1827865776f, -1.3194792169f, -0.4619397663f, +-0.8660254038f, -1.2552931065f, -0.3535533906f, -0.4174197128f, -1.0000000000f, -0.1913417162f, +0.0947343455f, -0.5924659585f, +-0.0000000000f, +0.5924659585f, -0.0947343455f, +0.1913417162f, +1.0000000000f, +0.4174197128f, +0.3535533906f, +1.2552931065f, ++0.8660254038f, +0.4619397663f, +1.3194792169f, +1.1827865776f, +0.5000000000f, +1.1827865776f, +1.3194792169f, +0.4619397663f, ++0.8660254038f, +1.2552931065f, +0.3535533906f, +0.4174197128f, +1.0000000000f, +0.1913417162f, -0.0947343455f, +0.5924659585f, +-0.0000000000f, -0.5924659585f, +0.0947343455f, -0.1913417162f, -1.0000000000f, -0.4174197128f, -0.3535533906f, -1.2552931065f, +-0.8660254038f, -0.4619397663f, -1.3194792169f, -1.1827865776f, -0.5000000000f, -1.1827865776f, -1.3194792169f, -0.4619397663f, +-0.8660254038f, -1.2552931065f, -0.3535533906f, -0.4174197128f, -1.0000000000f, -0.1913417162f, +0.0947343455f, -0.5924659585f, ++0.0000000000f, +0.5924659585f, -0.0947343455f, +0.1913417162f, +1.0000000000f, +0.4174197128f, +0.3535533906f, +1.2552931065f, ++0.8660254038f, +0.4619397663f, +1.3194792169f, +1.1827865776f, +0.5000000000f, +1.1827865776f, +1.3194792169f, +0.4619397663f, ++0.8660254038f, +1.2552931065f, +0.3535533906f, +0.4174197128f, +1.0000000000f, +0.1913417162f, -0.0947343455f, +0.5924659585f, ++0.0000000000f, -0.5924659585f, +0.0947343455f, -0.1913417162f, -1.0000000000f, -0.4174197128f, -0.3535533906f, -1.2552931065f, +-0.8660254038f, -0.4619397663f, -1.3194792169f, -1.1827865776f, -0.5000000000f, -1.1827865776f, -1.3194792169f, -0.4619397663f, +-0.8660254038f, -1.2552931065f, -0.3535533906f, -0.4174197128f, -1.0000000000f, -0.1913417162f, +0.0947343455f, -0.5924659585f, +-0.0000000000f, +0.5924659585f, -0.0947343455f, +0.1913417162f, +1.0000000000f, +0.4174197128f, +0.3535533906f, +1.2552931065f, ++0.8660254038f, +0.4619397663f, +1.3194792169f, +1.1827865776f, +0.5000000000f, +1.1827865776f, +1.3194792169f, +0.4619397663f, ++0.8660254038f, +1.2552931065f, +0.3535533906f, +0.4174197128f, +1.0000000000f, +0.1913417162f, -0.0947343455f, +0.5924659585f, ++0.0000000000f, -0.5924659585f, +0.0947343455f, -0.1913417162f, -1.0000000000f, -0.4174197128f, -0.3535533906f, -1.2552931065f, +-0.8660254038f, -0.4619397663f, -1.3194792169f, -1.1827865776f, -0.5000000000f, -1.1827865776f, -1.3194792169f, -0.4619397663f, +-0.8660254038f, -1.2552931065f, -0.3535533906f, -0.4174197128f, -1.0000000000f, -0.1913417162f, +0.0947343455f, -0.5924659585f, +-0.0000000000f, +0.5924659585f, -0.0947343455f, +0.1913417162f, +1.0000000000f, +0.4174197128f, +0.3535533906f, +1.2552931065f, ++0.8660254038f, +0.4619397663f, +1.3194792169f, +1.1827865776f, +0.5000000000f, +1.1827865776f, +1.3194792169f, +0.4619397663f, ++0.8660254038f, +1.2552931065f, +0.3535533906f, +0.4174197128f, +1.0000000000f, +0.1913417162f, -0.0947343455f, +0.5924659585f, ++0.0000000000f, -0.5924659585f, +0.0947343455f, -0.1913417162f, -1.0000000000f, -0.4174197128f, -0.3535533906f, -1.2552931065f, +}; + +float32_t refOutput[320] = +{ ++0.0000000000f, -0.0010797829f, -0.0007681386f, -0.0001982932f, +0.0000644313f, +0.0020854271f, +0.0036891871f, +0.0015855941f, +-0.0026280805f, -0.0075907658f, -0.0119390538f, -0.0086665968f, +0.0088981202f, +0.0430539279f, +0.0974468742f, +0.1740405600f, ++0.2681416601f, +0.3747720089f, +0.4893362230f, +0.6024154672f, +0.7058740791f, +0.7968348987f, +0.8715901940f, +0.9277881093f, ++0.9682182661f, +0.9934674267f, +1.0012052245f, +0.9925859371f, +0.9681538347f, +0.9257026822f, +0.8679010068f, +0.7952493046f, ++0.7085021596f, +0.6100062330f, +0.5012752767f, +0.3834386057f, +0.2592435399f, +0.1309866321f, -0.0000000000f, -0.1309866321f, +-0.2592435399f, -0.3834386057f, -0.5012752767f, -0.6100062330f, -0.7085021596f, -0.7952493046f, -0.8679010068f, -0.9257026822f, +-0.9681538347f, -0.9936657199f, -1.0019733630f, -0.9936657199f, -0.9681538347f, -0.9257026822f, -0.8679010068f, -0.7952493046f, +-0.7085021596f, -0.6100062330f, -0.5012752767f, -0.3834386057f, -0.2592435399f, -0.1309866321f, +0.0000000000f, +0.1309866321f, ++0.2592435399f, +0.3834386057f, +0.5012752767f, +0.6100062330f, +0.7085021596f, +0.7952493046f, +0.8679010068f, +0.9257026822f, ++0.9681538347f, +0.9936657199f, +1.0019733630f, +0.9936657199f, +0.9681538347f, +0.9257026822f, +0.8679010068f, +0.7952493046f, ++0.7085021596f, +0.6100062330f, +0.5012752767f, +0.3834386057f, +0.2592435399f, +0.1309866321f, -0.0000000000f, -0.1309866321f, +-0.2592435399f, -0.3834386057f, -0.5012752767f, -0.6100062330f, -0.7085021596f, -0.7952493046f, -0.8679010068f, -0.9257026822f, +-0.9681538347f, -0.9936657199f, -1.0019733630f, -0.9936657199f, -0.9681538347f, -0.9257026822f, -0.8679010068f, -0.7952493046f, +-0.7085021596f, -0.6100062330f, -0.5012752767f, -0.3834386057f, -0.2592435399f, -0.1309866321f, +0.0000000000f, +0.1309866321f, ++0.2592435399f, +0.3834386057f, +0.5012752767f, +0.6100062330f, +0.7085021596f, +0.7952493046f, +0.8679010068f, +0.9257026822f, ++0.9681538347f, +0.9936657199f, +1.0019733630f, +0.9936657199f, +0.9681538347f, +0.9257026822f, +0.8679010068f, +0.7952493046f, ++0.7085021596f, +0.6100062330f, +0.5012752767f, +0.3834386057f, +0.2592435399f, +0.1309866321f, -0.0000000000f, -0.1309866321f, +-0.2592435399f, -0.3834386057f, -0.5012752767f, -0.6100062330f, -0.7085021596f, -0.7952493046f, -0.8679010068f, -0.9257026822f, +-0.9681538347f, -0.9936657199f, -1.0019733630f, -0.9936657199f, -0.9681538347f, -0.9257026822f, -0.8679010068f, -0.7952493046f, +-0.7085021596f, -0.6100062330f, -0.5012752767f, -0.3834386057f, -0.2592435399f, -0.1309866321f, +0.0000000000f, +0.1309866321f, ++0.2592435399f, +0.3834386057f, +0.5012752767f, +0.6100062330f, +0.7085021596f, +0.7952493046f, +0.8679010068f, +0.9257026822f, ++0.9681538347f, +0.9936657199f, +1.0019733630f, +0.9936657199f, +0.9681538347f, +0.9257026822f, +0.8679010068f, +0.7952493046f, ++0.7085021596f, +0.6100062330f, +0.5012752767f, +0.3834386057f, +0.2592435399f, +0.1309866321f, +0.0000000000f, -0.1309866321f, +-0.2592435399f, -0.3834386057f, -0.5012752767f, -0.6100062330f, -0.7085021596f, -0.7952493046f, -0.8679010068f, -0.9257026822f, +-0.9681538347f, -0.9936657199f, -1.0019733630f, -0.9936657199f, -0.9681538347f, -0.9257026822f, -0.8679010068f, -0.7952493046f, +-0.7085021596f, -0.6100062330f, -0.5012752767f, -0.3834386057f, -0.2592435399f, -0.1309866321f, +0.0000000000f, +0.1309866321f, ++0.2592435399f, +0.3834386057f, +0.5012752767f, +0.6100062330f, +0.7085021596f, +0.7952493046f, +0.8679010068f, +0.9257026822f, ++0.9681538347f, +0.9936657199f, +1.0019733630f, +0.9936657199f, +0.9681538347f, +0.9257026822f, +0.8679010068f, +0.7952493046f, ++0.7085021596f, +0.6100062330f, +0.5012752767f, +0.3834386057f, +0.2592435399f, +0.1309866321f, +0.0000000000f, -0.1309866321f, +-0.2592435399f, -0.3834386057f, -0.5012752767f, -0.6100062330f, -0.7085021596f, -0.7952493046f, -0.8679010068f, -0.9257026822f, +-0.9681538347f, -0.9936657199f, -1.0019733630f, -0.9936657199f, -0.9681538347f, -0.9257026822f, -0.8679010068f, -0.7952493046f, +-0.7085021596f, -0.6100062330f, -0.5012752767f, -0.3834386057f, -0.2592435399f, -0.1309866321f, -0.0000000000f, +0.1309866321f, ++0.2592435399f, +0.3834386057f, +0.5012752767f, +0.6100062330f, +0.7085021596f, +0.7952493046f, +0.8679010068f, +0.9257026822f, ++0.9681538347f, +0.9936657199f, +1.0019733630f, +0.9936657199f, +0.9681538347f, +0.9257026822f, +0.8679010068f, +0.7952493046f, ++0.7085021596f, +0.6100062330f, +0.5012752767f, +0.3834386057f, +0.2592435399f, +0.1309866321f, +0.0000000000f, -0.1309866321f, +-0.2592435399f, -0.3834386057f, -0.5012752767f, -0.6100062330f, -0.7085021596f, -0.7952493046f, -0.8679010068f, -0.9257026822f, +-0.9681538347f, -0.9936657199f, -1.0019733630f, -0.9936657199f, -0.9681538347f, -0.9257026822f, -0.8679010068f, -0.7952493046f, +-0.7085021596f, -0.6100062330f, -0.5012752767f, -0.3834386057f, -0.2592435399f, -0.1309866321f, +0.0000000000f, +0.1309866321f, ++0.2592435399f, +0.3834386057f, +0.5012752767f, +0.6100062330f, +0.7085021596f, +0.7952493046f, +0.8679010068f, +0.9257026822f, ++0.9681538347f, +0.9936657199f, +1.0019733630f, +0.9936657199f, +0.9681538347f, +0.9257026822f, +0.8679010068f, +0.7952493046f +}; + diff --git a/examples/mbed-dsp/src/main.cpp b/examples/mbed-dsp/src/main.cpp new file mode 100644 index 0000000..f6bdb4b --- /dev/null +++ b/examples/mbed-dsp/src/main.cpp @@ -0,0 +1,65 @@ +#include "arm_math.h" +#include "math_helper.h" +#include + +#define BLOCK_SIZE 32 +#define NUM_BLOCKS 10 + +#define TEST_LENGTH_SAMPLES (BLOCK_SIZE * NUM_BLOCKS) + +#define SNR_THRESHOLD_F32 140.0f +#define NUM_TAPS 29 + +/* ------------------------------------------------------------------- + * The input signal and reference output (computed with MATLAB) + * are defined externally in arm_fir_lpf_data.c. + * ------------------------------------------------------------------- */ +extern float32_t testInput_f32_1kHz_15kHz[TEST_LENGTH_SAMPLES]; +extern float32_t refOutput[TEST_LENGTH_SAMPLES]; + +/* ------------------------------------------------------------------- + * Declare State buffer of size (numTaps + blockSize - 1) + * ------------------------------------------------------------------- */ +static float32_t firStateF32[BLOCK_SIZE + NUM_TAPS - 1]; + +/* ---------------------------------------------------------------------- + * FIR Coefficients buffer generated using fir1() MATLAB function. + * fir1(28, 6/24) + * ------------------------------------------------------------------- */ +const float32_t firCoeffs32[NUM_TAPS] = { + -0.0018225230f, -0.0015879294f, +0.0000000000f, +0.0036977508f, +0.0080754303f, + +0.0085302217f, -0.0000000000f, -0.0173976984f, -0.0341458607f, -0.0333591565f, + +0.0000000000f, +0.0676308395f, +0.1522061835f, +0.2229246956f, +0.2504960933f, + +0.2229246956f, +0.1522061835f, +0.0676308395f, +0.0000000000f, -0.0333591565f, + -0.0341458607f, -0.0173976984f, -0.0000000000f, +0.0085302217f, +0.0080754303f, + +0.0036977508f, +0.0000000000f, -0.0015879294f, -0.0018225230f +}; + +/* ---------------------------------------------------------------------- + * FIR LPF Example + * ------------------------------------------------------------------- */ +int main(void) { + /* Call FIR init function to initialize the instance structure. */ + arm_fir_instance_f32 S; + arm_fir_init_f32(&S, NUM_TAPS, (float32_t *)&firCoeffs32[0], &firStateF32[0], BLOCK_SIZE); + + /* ---------------------------------------------------------------------- + * Call the FIR process function for every blockSize samples + * ------------------------------------------------------------------- */ + for (uint32_t i=0; i < NUM_BLOCKS; i++) { + float32_t* signal = testInput_f32_1kHz_15kHz + (i * BLOCK_SIZE); + arm_fir_f32(&S, signal, signal, BLOCK_SIZE); + } + + /* ---------------------------------------------------------------------- + * Compare the generated output against the reference output computed + * in MATLAB. + * ------------------------------------------------------------------- */ + float32_t snr = arm_snr_f32(refOutput, testInput_f32_1kHz_15kHz, TEST_LENGTH_SAMPLES); + printf("snr: %f\n\r", snr); + if (snr < SNR_THRESHOLD_F32) { + printf("Failed\n\r"); + } else { + printf("Success\n\r"); + } +} diff --git a/examples/mbed-rtos/.gitignore b/examples/mbed-rtos/.gitignore new file mode 100644 index 0000000..5402c18 --- /dev/null +++ b/examples/mbed-rtos/.gitignore @@ -0,0 +1,3 @@ +.pioenvs +.clang_complete +.gcc-flags.json diff --git a/examples/mbed-rtos/.travis.yml b/examples/mbed-rtos/.travis.yml new file mode 100644 index 0000000..b636184 --- /dev/null +++ b/examples/mbed-rtos/.travis.yml @@ -0,0 +1,65 @@ +# Continuous Integration (CI) is the practice, in software +# engineering, of merging all developer working copies with a shared mainline +# several times a day < http://docs.platformio.org/en/latest/ci/index.html > +# +# Documentation: +# +# * Travis CI Embedded Builds with PlatformIO +# < https://docs.travis-ci.com/user/integration/platformio/ > +# +# * PlatformIO integration with Travis CI +# < http://docs.platformio.org/en/latest/ci/travis.html > +# +# * User Guide for `platformio ci` command +# < http://docs.platformio.org/en/latest/userguide/cmd_ci.html > +# +# +# Please choose one of the following templates (proposed below) and uncomment +# it (remove "# " before each line) or use own configuration according to the +# Travis CI documentation (see above). +# + + +# +# Template #1: General project. Test it using existing `platformio.ini`. +# + +# language: python +# python: +# - "2.7" +# +# sudo: false +# cache: +# directories: +# - "~/.platformio" +# +# install: +# - pip install -U platformio +# +# script: +# - platformio run + + +# +# Template #2: The project is intended to by used as a library with examples +# + +# language: python +# python: +# - "2.7" +# +# sudo: false +# cache: +# directories: +# - "~/.platformio" +# +# env: +# - PLATFORMIO_CI_SRC=path/to/test/file.c +# - PLATFORMIO_CI_SRC=examples/file.ino +# - PLATFORMIO_CI_SRC=path/to/test/directory +# +# install: +# - pip install -U platformio +# +# script: +# - platformio ci --lib="." --board=ID_1 --board=ID_2 --board=ID_N diff --git a/examples/mbed-rtos/README.rst b/examples/mbed-rtos/README.rst new file mode 100644 index 0000000..00e67af --- /dev/null +++ b/examples/mbed-rtos/README.rst @@ -0,0 +1,38 @@ +.. Copyright 2014-present Ivan Kravets + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +How to build PlatformIO based project +==================================== + +1. `Install PlatformIO `_ +2. Download `development platform with examples `_ +3. Extract ZIP archive +4. Run these commands: + +.. code-block:: bash + + # Change directory to example + > cd platform-ststm32/examples/mbed-rtos + + # Build project + > platformio run + + # Upload firmware + > platformio run --target upload + + # Build specific environment + > platformio run -e nucleo_f401re + + # Upload firmware for the specific environment + > platformio run -e nucleo_f401re --target upload + + # Clean build files + > platformio run --target clean diff --git a/examples/mbed-rtos/lib/readme.txt b/examples/mbed-rtos/lib/readme.txt new file mode 100644 index 0000000..607a92a --- /dev/null +++ b/examples/mbed-rtos/lib/readme.txt @@ -0,0 +1,38 @@ + +This directory is intended for the project specific (private) libraries. +PlatformIO will compile them to static libraries and link to executable file. + +The source code of each library should be placed in separate directory, like +"lib/private_lib/[here are source files]". + +For example, see how can be organized `Foo` and `Bar` libraries: + +|--lib +| |--Bar +| | |--docs +| | |--examples +| | |--src +| | |- Bar.c +| | |- Bar.h +| |--Foo +| | |- Foo.c +| | |- Foo.h +| |- readme.txt --> THIS FILE +|- platformio.ini +|--src + |- main.c + +Then in `src/main.c` you should use: + +#include +#include + +// rest H/C/CPP code + +PlatformIO will find your libraries automatically, configure preprocessor's +include paths and build them. + +See additional options for PlatformIO Library Dependency Finder `lib_*`: + +http://docs.platformio.org/en/latest/projectconf.html#lib-install + diff --git a/examples/mbed-rtos/platformio.ini b/examples/mbed-rtos/platformio.ini new file mode 100644 index 0000000..fc1535b --- /dev/null +++ b/examples/mbed-rtos/platformio.ini @@ -0,0 +1,73 @@ +# +# Project Configuration File +# +# A detailed documentation with the EXAMPLES is located here: +# http://docs.platformio.org/en/latest/projectconf.html +# + +# A sign `#` at the beginning of the line indicates a comment +# Comment lines are ignored. + +# Simple and base environment +# [env:mybaseenv] +# platform = %INSTALLED_PLATFORM_NAME_HERE% +# framework = +# board = +# +# Automatic targets - enable auto-uploading +# targets = upload + +[env:disco_f407vg] +platform = ststm32 +framework = mbed +board = disco_f407vg + +[env:disco_f303vc] +platform = ststm32 +framework = mbed +board = disco_f303vc + +[env:disco_f100rb] +platform = ststm32 +framework = mbed +board = disco_f100rb + +[env:nucleo_f030r8] +platform = ststm32 +framework = mbed +board = nucleo_f030r8 + +[env:nucleo_f103rb] +platform = ststm32 +framework = mbed +board = nucleo_f103rb + +[env:nucleo_f302r8] +platform = ststm32 +framework = mbed +board = nucleo_f302r8 + +[env:nucleo_f401re] +platform = ststm32 +framework = mbed +board = nucleo_f401re + +[env:nucleo_l053r8] +platform = ststm32 +framework = mbed +board = nucleo_l053r8 + +[env:nucleo_l152re] +platform = ststm32 +framework = mbed +board = nucleo_l152re + +[env:disco_l053c8] +platform = ststm32 +framework = mbed +board = disco_l053c8 + +[env:seeedArchMax] +platform = ststm32 +framework = mbed +board = seeedArchMax diff --git a/examples/mbed-rtos/src/main.cpp b/examples/mbed-rtos/src/main.cpp new file mode 100644 index 0000000..a1aa46d --- /dev/null +++ b/examples/mbed-rtos/src/main.cpp @@ -0,0 +1,38 @@ +#include "mbed.h" +#include "rtos.h" + +/* + * The stack size is defined in cmsis_os.h mainly dependent on the underlying toolchain and + * the C standard library. For GCC, ARM_STD and IAR it is defined with a size of 2048 bytes + * and for ARM_MICRO 512. Because of reduce RAM size some targets need a reduced stacksize. + */ +#if defined(TARGET_STM32L053R8) || defined(TARGET_STM32L053C8) +#define STACK_SIZE DEFAULT_STACK_SIZE/4 +#else +#define STACK_SIZE DEFAULT_STACK_SIZE +#endif + +void print_char(char c = '*') { + printf("%c", c); + fflush(stdout); +} + +DigitalOut led1(LED1); +DigitalOut led2(LED2); + +void led2_thread(void const *argument) { + while (true) { + led2 = !led2; + Thread::wait(1000); + print_char(); + } +} + +int main() { + Thread thread(led2_thread, NULL, osPriorityNormal, STACK_SIZE); + + while (true) { + led1 = !led1; + Thread::wait(500); + } +} diff --git a/examples/mbed-serial/.gitignore b/examples/mbed-serial/.gitignore new file mode 100644 index 0000000..5402c18 --- /dev/null +++ b/examples/mbed-serial/.gitignore @@ -0,0 +1,3 @@ +.pioenvs +.clang_complete +.gcc-flags.json diff --git a/examples/mbed-serial/.travis.yml b/examples/mbed-serial/.travis.yml new file mode 100644 index 0000000..b636184 --- /dev/null +++ b/examples/mbed-serial/.travis.yml @@ -0,0 +1,65 @@ +# Continuous Integration (CI) is the practice, in software +# engineering, of merging all developer working copies with a shared mainline +# several times a day < http://docs.platformio.org/en/latest/ci/index.html > +# +# Documentation: +# +# * Travis CI Embedded Builds with PlatformIO +# < https://docs.travis-ci.com/user/integration/platformio/ > +# +# * PlatformIO integration with Travis CI +# < http://docs.platformio.org/en/latest/ci/travis.html > +# +# * User Guide for `platformio ci` command +# < http://docs.platformio.org/en/latest/userguide/cmd_ci.html > +# +# +# Please choose one of the following templates (proposed below) and uncomment +# it (remove "# " before each line) or use own configuration according to the +# Travis CI documentation (see above). +# + + +# +# Template #1: General project. Test it using existing `platformio.ini`. +# + +# language: python +# python: +# - "2.7" +# +# sudo: false +# cache: +# directories: +# - "~/.platformio" +# +# install: +# - pip install -U platformio +# +# script: +# - platformio run + + +# +# Template #2: The project is intended to by used as a library with examples +# + +# language: python +# python: +# - "2.7" +# +# sudo: false +# cache: +# directories: +# - "~/.platformio" +# +# env: +# - PLATFORMIO_CI_SRC=path/to/test/file.c +# - PLATFORMIO_CI_SRC=examples/file.ino +# - PLATFORMIO_CI_SRC=path/to/test/directory +# +# install: +# - pip install -U platformio +# +# script: +# - platformio ci --lib="." --board=ID_1 --board=ID_2 --board=ID_N diff --git a/examples/mbed-serial/README.rst b/examples/mbed-serial/README.rst new file mode 100644 index 0000000..402f368 --- /dev/null +++ b/examples/mbed-serial/README.rst @@ -0,0 +1,38 @@ +.. Copyright 2014-present Ivan Kravets + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +How to build PlatformIO based project +===================================== + +1. `Install PlatformIO `_ +2. Download `development platform with examples `_ +3. Extract ZIP archive +4. Run these commands: + +.. code-block:: bash + + # Change directory to example + > cd platform-ststm32/examples/mbed-serial + + # Build project + > platformio run + + # Upload firmware + > platformio run --target upload + + # Build specific environment + > platformio run -e nucleo_f401re + + # Upload firmware for the specific environment + > platformio run -e nucleo_f401re --target upload + + # Clean build files + > platformio run --target clean diff --git a/examples/mbed-serial/lib/readme.txt b/examples/mbed-serial/lib/readme.txt new file mode 100644 index 0000000..607a92a --- /dev/null +++ b/examples/mbed-serial/lib/readme.txt @@ -0,0 +1,38 @@ + +This directory is intended for the project specific (private) libraries. +PlatformIO will compile them to static libraries and link to executable file. + +The source code of each library should be placed in separate directory, like +"lib/private_lib/[here are source files]". + +For example, see how can be organized `Foo` and `Bar` libraries: + +|--lib +| |--Bar +| | |--docs +| | |--examples +| | |--src +| | |- Bar.c +| | |- Bar.h +| |--Foo +| | |- Foo.c +| | |- Foo.h +| |- readme.txt --> THIS FILE +|- platformio.ini +|--src + |- main.c + +Then in `src/main.c` you should use: + +#include +#include + +// rest H/C/CPP code + +PlatformIO will find your libraries automatically, configure preprocessor's +include paths and build them. + +See additional options for PlatformIO Library Dependency Finder `lib_*`: + +http://docs.platformio.org/en/latest/projectconf.html#lib-install + diff --git a/examples/mbed-serial/platformio.ini b/examples/mbed-serial/platformio.ini new file mode 100644 index 0000000..e2b977a --- /dev/null +++ b/examples/mbed-serial/platformio.ini @@ -0,0 +1,78 @@ +# +# Project Configuration File +# +# A detailed documentation with the EXAMPLES is located here: +# http://docs.platformio.org/en/latest/projectconf.html +# + +# A sign `#` at the beginning of the line indicates a comment +# Comment lines are ignored. + +# Simple and base environment +# [env:mybaseenv] +# platform = %INSTALLED_PLATFORM_NAME_HERE% +# framework = +# board = +# +# Automatic targets - enable auto-uploading +# targets = upload + +[env:disco_f407vg] +platform = ststm32 +framework = mbed +board = disco_f407vg + +[env:disco_f303vc] +platform = ststm32 +framework = mbed +board = disco_f303vc + +[env:disco_f100rb] +platform = ststm32 +framework = mbed +board = disco_f100rb + +[env:nucleo_f030r8] +platform = ststm32 +framework = mbed +board = nucleo_f030r8 + +[env:nucleo_f103rb] +platform = ststm32 +framework = mbed +board = nucleo_f103rb + +[env:nucleo_f302r8] +platform = ststm32 +framework = mbed +board = nucleo_f302r8 + +[env:nucleo_f401re] +platform = ststm32 +framework = mbed +board = nucleo_f401re + +[env:nucleo_l053r8] +platform = ststm32 +framework = mbed +board = nucleo_l053r8 + +[env:nucleo_l152re] +platform = ststm32 +framework = mbed +board = nucleo_l152re + +[env:disco_l053c8] +platform = ststm32 +framework = mbed +board = disco_l053c8 + +[env:seeedArchMax] +platform = ststm32 +framework = mbed +board = seeedArchMax + +[env:mts_mdot_f411re] +platform = ststm32 +framework = mbed +board = mts_mdot_f411re diff --git a/examples/mbed-serial/src/main.cpp b/examples/mbed-serial/src/main.cpp new file mode 100644 index 0000000..132ba17 --- /dev/null +++ b/examples/mbed-serial/src/main.cpp @@ -0,0 +1,10 @@ +#include "mbed.h" + +Serial pc(USBTX, USBRX); // tx, rx + +int main() { + pc.printf("Hello World!\n\r"); + while(1) { + pc.putc(pc.getc() + 1); // echo input back to terminal + } +} \ No newline at end of file diff --git a/examples/spl-blink/.gitignore b/examples/spl-blink/.gitignore new file mode 100644 index 0000000..5402c18 --- /dev/null +++ b/examples/spl-blink/.gitignore @@ -0,0 +1,3 @@ +.pioenvs +.clang_complete +.gcc-flags.json diff --git a/examples/spl-blink/.travis.yml b/examples/spl-blink/.travis.yml new file mode 100644 index 0000000..b636184 --- /dev/null +++ b/examples/spl-blink/.travis.yml @@ -0,0 +1,65 @@ +# Continuous Integration (CI) is the practice, in software +# engineering, of merging all developer working copies with a shared mainline +# several times a day < http://docs.platformio.org/en/latest/ci/index.html > +# +# Documentation: +# +# * Travis CI Embedded Builds with PlatformIO +# < https://docs.travis-ci.com/user/integration/platformio/ > +# +# * PlatformIO integration with Travis CI +# < http://docs.platformio.org/en/latest/ci/travis.html > +# +# * User Guide for `platformio ci` command +# < http://docs.platformio.org/en/latest/userguide/cmd_ci.html > +# +# +# Please choose one of the following templates (proposed below) and uncomment +# it (remove "# " before each line) or use own configuration according to the +# Travis CI documentation (see above). +# + + +# +# Template #1: General project. Test it using existing `platformio.ini`. +# + +# language: python +# python: +# - "2.7" +# +# sudo: false +# cache: +# directories: +# - "~/.platformio" +# +# install: +# - pip install -U platformio +# +# script: +# - platformio run + + +# +# Template #2: The project is intended to by used as a library with examples +# + +# language: python +# python: +# - "2.7" +# +# sudo: false +# cache: +# directories: +# - "~/.platformio" +# +# env: +# - PLATFORMIO_CI_SRC=path/to/test/file.c +# - PLATFORMIO_CI_SRC=examples/file.ino +# - PLATFORMIO_CI_SRC=path/to/test/directory +# +# install: +# - pip install -U platformio +# +# script: +# - platformio ci --lib="." --board=ID_1 --board=ID_2 --board=ID_N diff --git a/examples/spl-blink/README.rst b/examples/spl-blink/README.rst new file mode 100644 index 0000000..3b50d30 --- /dev/null +++ b/examples/spl-blink/README.rst @@ -0,0 +1,38 @@ +.. Copyright 2014-present Ivan Kravets + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +How to build PlatformIO based project +===================================== + +1. `Install PlatformIO `_ +2. Download `development platform with examples `_ +3. Extract ZIP archive +4. Run these commands: + +.. code-block:: bash + + # Change directory to example + > cd platform-ststm32/examples/spl-blink + + # Build project + > platformio run + + # Upload firmware + > platformio run --target upload + + # Build specific environment + > platformio run -e disco_f407vg + + # Upload firmware for the specific environment + > platformio run -e disco_f407vg --target upload + + # Clean build files + > platformio run --target clean diff --git a/examples/spl-blink/lib/readme.txt b/examples/spl-blink/lib/readme.txt new file mode 100644 index 0000000..607a92a --- /dev/null +++ b/examples/spl-blink/lib/readme.txt @@ -0,0 +1,38 @@ + +This directory is intended for the project specific (private) libraries. +PlatformIO will compile them to static libraries and link to executable file. + +The source code of each library should be placed in separate directory, like +"lib/private_lib/[here are source files]". + +For example, see how can be organized `Foo` and `Bar` libraries: + +|--lib +| |--Bar +| | |--docs +| | |--examples +| | |--src +| | |- Bar.c +| | |- Bar.h +| |--Foo +| | |- Foo.c +| | |- Foo.h +| |- readme.txt --> THIS FILE +|- platformio.ini +|--src + |- main.c + +Then in `src/main.c` you should use: + +#include +#include + +// rest H/C/CPP code + +PlatformIO will find your libraries automatically, configure preprocessor's +include paths and build them. + +See additional options for PlatformIO Library Dependency Finder `lib_*`: + +http://docs.platformio.org/en/latest/projectconf.html#lib-install + diff --git a/examples/spl-blink/platformio.ini b/examples/spl-blink/platformio.ini new file mode 100644 index 0000000..29d797e --- /dev/null +++ b/examples/spl-blink/platformio.ini @@ -0,0 +1,33 @@ +# +# Project Configuration File +# +# A detailed documentation with the EXAMPLES is located here: +# http://docs.platformio.org/en/latest/projectconf.html +# + +# A sign `#` at the beginning of the line indicates a comment +# Comment lines are ignored. + +# Simple and base environment +# [env:mybaseenv] +# platform = %INSTALLED_PLATFORM_NAME_HERE% +# framework = +# board = +# +# Automatic targets - enable auto-uploading +# targets = upload + +[env:disco_f407vg] +platform = ststm32 +framework = spl +board = disco_f407vg + +[env:disco_l152rb] +platform = ststm32 +framework = spl +board = disco_l152rb + +[env:disco_f303vc] +platform = ststm32 +framework = spl +board = disco_f303vc diff --git a/examples/spl-blink/src/main.c b/examples/spl-blink/src/main.c new file mode 100644 index 0000000..089cc39 --- /dev/null +++ b/examples/spl-blink/src/main.c @@ -0,0 +1,61 @@ +#ifdef STM32L1 + #include + #include + #define LEDPORT (GPIOB) + #define LEDPIN (GPIO_Pin_7) + #define ENABLE_GPIO_CLOCK (RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOB, ENABLE)) +#elif STM32F3 + #include + #include + #define LEDPORT (GPIOE) + #define LEDPIN (GPIO_Pin_8) + #define ENABLE_GPIO_CLOCK (RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOE, ENABLE)) +#elif STM32F4 + #include + #include + #define LEDPORT (GPIOD) + #define LEDPIN (GPIO_Pin_12) + #define ENABLE_GPIO_CLOCK (RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOD, ENABLE)) +#endif + +/* timing is not guaranteed :) */ +void simple_delay(uint32_t us) +{ + /* simple delay loop */ + while (us--) { + asm volatile ("nop"); + } +} + +/* system entry point */ +int main(void) +{ + /* gpio init struct */ + GPIO_InitTypeDef gpio; + /* reset rcc */ + RCC_DeInit(); + /* enable clock GPIO */ + ENABLE_GPIO_CLOCK; + /* use LED pin */ + gpio.GPIO_Pin = LEDPIN; + /* mode: output */ + gpio.GPIO_Mode = GPIO_Mode_OUT; + /* output type: push-pull */ + gpio.GPIO_OType = GPIO_OType_PP; + /* apply configuration */ + GPIO_Init(LEDPORT, &gpio); + /* main program loop */ + for (;;) { + /* set led on */ + GPIO_SetBits(LEDPORT, LEDPIN); + /* delay */ + simple_delay(100000); + /* clear led */ + GPIO_ResetBits(LEDPORT, LEDPIN); + /* delay */ + simple_delay(100000); + } + + /* never reached */ + return 0; +} \ No newline at end of file diff --git a/ldscripts/armstrap_eagle_1024.ld b/ldscripts/armstrap_eagle_1024.ld new file mode 100755 index 0000000..4dbd3f3 --- /dev/null +++ b/ldscripts/armstrap_eagle_1024.ld @@ -0,0 +1,188 @@ +/* +The MIT License (MIT) + +Copyright (c) 2014 ARMstrap Community + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +/* Entry Point */ +ENTRY(Reset_Handler) + +/* Highest address of the user mode stack */ +_estack = 0x2001FFFF; /* end of RAM */ + +/* Generate a link error if heap and stack don't fit into RAM */ +_Min_Heap_Size = 0; /* required amount of heap */ +_Min_Stack_Size = 0x400; /* required amount of stack */ + +/* Specify the memory areas for the STM32F417VGT6 Cortex-M4 Microcontroller */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 1024K + RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K + CCMRAM (rw) : ORIGIN = 0x10000000, LENGTH = 64K +} + +/* Define output sections */ +SECTIONS +{ + /* The startup code goes first into FLASH */ + .isr_vector : + { + . = ALIGN(4); + KEEP(*(.isr_vector)) /* Startup code */ + . = ALIGN(4); + } >FLASH + + /* The program code and other data goes into FLASH */ + .text : + { + . = ALIGN(4); + *(.text) /* .text sections (code) */ + *(.text*) /* .text* sections (code) */ + *(.glue_7) /* glue arm to thumb code */ + *(.glue_7t) /* glue thumb to arm code */ + *(.eh_frame) + + KEEP (*(.init)) + KEEP (*(.fini)) + + . = ALIGN(4); + _etext = .; /* define a global symbols at end of code */ + } >FLASH + + /* Constant data goes into FLASH */ + .rodata : + { + . = ALIGN(4); + *(.rodata) /* .rodata sections (constants, strings, etc.) */ + *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ + . = ALIGN(4); + } >FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } >FLASH + + .ARM : + { + __exidx_start = .; + *(.ARM.exidx*) + __exidx_end = .; + } >FLASH + + .preinit_array : + { + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP (*(.preinit_array*)) + PROVIDE_HIDDEN (__preinit_array_end = .); + } >FLASH + + .init_array : + { + PROVIDE_HIDDEN (__init_array_start = .); + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array*)) + PROVIDE_HIDDEN (__init_array_end = .); + } >FLASH + + .fini_array : + { + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP (*(SORT(.fini_array.*))) + KEEP (*(.fini_array*)) + PROVIDE_HIDDEN (__fini_array_end = .); + } >FLASH + + /* used by the startup to initialize data */ + _sidata = LOADADDR(.data); + + /* Initialized data sections goes into RAM, load LMA copy after code */ + .data : + { + . = ALIGN(4); + _sdata = .; /* create a global symbol at data start */ + *(.data) /* .data sections */ + *(.data*) /* .data* sections */ + + . = ALIGN(4); + _edata = .; /* define a global symbol at data end */ + } >RAM AT> FLASH + + _siccmram = LOADADDR(.ccmram); + + /* CCM-RAM section + * + * IMPORTANT NOTE! + * If initialized variables will be placed in this section, + * the startup code needs to be modified to copy the init-values. + */ + .ccmram : + { + . = ALIGN(4); + _sccmram = .; /* create a global symbol at ccmram start */ + *(.ccmram) + *(.ccmram*) + + . = ALIGN(4); + _eccmram = .; /* create a global symbol at ccmram end */ + } >CCMRAM AT> FLASH + + /* Uninitialized data section */ + . = ALIGN(4); + .bss : + { + /* This is used by the startup in order to initialize the .bss secion */ + _sbss = .; /* define a global symbol at bss start */ + __bss_start__ = _sbss; + *(.bss) + *(.bss*) + *(COMMON) + + . = ALIGN(4); + _ebss = .; /* define a global symbol at bss end */ + __bss_end__ = _ebss; + } >RAM + + /* User_heap_stack section, used to check that there is enough RAM left */ + ._user_heap_stack : + { + . = ALIGN(4); + PROVIDE ( end = . ); + PROVIDE ( _end = . ); + . = . + _Min_Heap_Size; + . = . + _Min_Stack_Size; + . = ALIGN(4); + } >RAM + + /* Remove information from the standard libraries */ + /DISCARD/ : + { + libc.a ( * ) + libm.a ( * ) + libgcc.a ( * ) + } + + .ARM.attributes 0 : + { + *(.ARM.attributes) + } +} \ No newline at end of file diff --git a/ldscripts/armstrap_eagle_2048.ld b/ldscripts/armstrap_eagle_2048.ld new file mode 100755 index 0000000..701474d --- /dev/null +++ b/ldscripts/armstrap_eagle_2048.ld @@ -0,0 +1,188 @@ +/* +The MIT License (MIT) + +Copyright (c) 2014 ARMstrap Community + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +/* Entry Point */ +ENTRY(Reset_Handler) + +/* Highest address of the user mode stack */ +_estack = 0x2002FFFF; /* end of RAM */ + +/* Generate a link error if heap and stack don't fit into RAM */ +_Min_Heap_Size = 0; /* required amount of heap */ +_Min_Stack_Size = 0x400; /* required amount of stack */ + +/* Specify the memory areas for the STM32F427VIT6 Cortex-M4 Microcontroller */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 2048K + RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 192K + CCMRAM (rw) : ORIGIN = 0x10000000, LENGTH = 64K +} + +/* Define output sections */ +SECTIONS +{ + /* The startup code goes first into FLASH */ + .isr_vector : + { + . = ALIGN(4); + KEEP(*(.isr_vector)) /* Startup code */ + . = ALIGN(4); + } >FLASH + + /* The program code and other data goes into FLASH */ + .text : + { + . = ALIGN(4); + *(.text) /* .text sections (code) */ + *(.text*) /* .text* sections (code) */ + *(.glue_7) /* glue arm to thumb code */ + *(.glue_7t) /* glue thumb to arm code */ + *(.eh_frame) + + KEEP (*(.init)) + KEEP (*(.fini)) + + . = ALIGN(4); + _etext = .; /* define a global symbols at end of code */ + } >FLASH + + /* Constant data goes into FLASH */ + .rodata : + { + . = ALIGN(4); + *(.rodata) /* .rodata sections (constants, strings, etc.) */ + *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ + . = ALIGN(4); + } >FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } >FLASH + + .ARM : + { + __exidx_start = .; + *(.ARM.exidx*) + __exidx_end = .; + } >FLASH + + .preinit_array : + { + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP (*(.preinit_array*)) + PROVIDE_HIDDEN (__preinit_array_end = .); + } >FLASH + + .init_array : + { + PROVIDE_HIDDEN (__init_array_start = .); + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array*)) + PROVIDE_HIDDEN (__init_array_end = .); + } >FLASH + + .fini_array : + { + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP (*(SORT(.fini_array.*))) + KEEP (*(.fini_array*)) + PROVIDE_HIDDEN (__fini_array_end = .); + } >FLASH + + /* used by the startup to initialize data */ + _sidata = LOADADDR(.data); + + /* Initialized data sections goes into RAM, load LMA copy after code */ + .data : + { + . = ALIGN(4); + _sdata = .; /* create a global symbol at data start */ + *(.data) /* .data sections */ + *(.data*) /* .data* sections */ + + . = ALIGN(4); + _edata = .; /* define a global symbol at data end */ + } >RAM AT> FLASH + + _siccmram = LOADADDR(.ccmram); + + /* CCM-RAM section + * + * IMPORTANT NOTE! + * If initialized variables will be placed in this section, + * the startup code needs to be modified to copy the init-values. + */ + .ccmram : + { + . = ALIGN(4); + _sccmram = .; /* create a global symbol at ccmram start */ + *(.ccmram) + *(.ccmram*) + + . = ALIGN(4); + _eccmram = .; /* create a global symbol at ccmram end */ + } >CCMRAM AT> FLASH + + /* Uninitialized data section */ + . = ALIGN(4); + .bss : + { + /* This is used by the startup in order to initialize the .bss secion */ + _sbss = .; /* define a global symbol at bss start */ + __bss_start__ = _sbss; + *(.bss) + *(.bss*) + *(COMMON) + + . = ALIGN(4); + _ebss = .; /* define a global symbol at bss end */ + __bss_end__ = _ebss; + } >RAM + + /* User_heap_stack section, used to check that there is enough RAM left */ + ._user_heap_stack : + { + . = ALIGN(4); + PROVIDE ( end = . ); + PROVIDE ( _end = . ); + . = . + _Min_Heap_Size; + . = . + _Min_Stack_Size; + . = ALIGN(4); + } >RAM + + /* Remove information from the standard libraries */ + /DISCARD/ : + { + libc.a ( * ) + libm.a ( * ) + libgcc.a ( * ) + } + + .ARM.attributes 0 : + { + *(.ARM.attributes) + } +} \ No newline at end of file diff --git a/ldscripts/armstrap_eagle_512.ld b/ldscripts/armstrap_eagle_512.ld new file mode 100755 index 0000000..b6a9d55 --- /dev/null +++ b/ldscripts/armstrap_eagle_512.ld @@ -0,0 +1,188 @@ +/* +The MIT License (MIT) + +Copyright (c) 2014 ARMstrap Community + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +/* Entry Point */ +ENTRY(Reset_Handler) + +/* Highest address of the user mode stack */ +_estack = 0x2001FFFF; /* end of RAM */ + +/* Generate a link error if heap and stack don't fit into RAM */ +_Min_Heap_Size = 0; /* required amount of heap */ +_Min_Stack_Size = 0x400; /* required amount of stack */ + +/* Specify the memory areas for the STM32F407VET6 Cortex-M4 Microcontroller */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 512K + RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K + CCMRAM (rw) : ORIGIN = 0x10000000, LENGTH = 64K +} + +/* Define output sections */ +SECTIONS +{ + /* The startup code goes first into FLASH */ + .isr_vector : + { + . = ALIGN(4); + KEEP(*(.isr_vector)) /* Startup code */ + . = ALIGN(4); + } >FLASH + + /* The program code and other data goes into FLASH */ + .text : + { + . = ALIGN(4); + *(.text) /* .text sections (code) */ + *(.text*) /* .text* sections (code) */ + *(.glue_7) /* glue arm to thumb code */ + *(.glue_7t) /* glue thumb to arm code */ + *(.eh_frame) + + KEEP (*(.init)) + KEEP (*(.fini)) + + . = ALIGN(4); + _etext = .; /* define a global symbols at end of code */ + } >FLASH + + /* Constant data goes into FLASH */ + .rodata : + { + . = ALIGN(4); + *(.rodata) /* .rodata sections (constants, strings, etc.) */ + *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ + . = ALIGN(4); + } >FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } >FLASH + + .ARM : + { + __exidx_start = .; + *(.ARM.exidx*) + __exidx_end = .; + } >FLASH + + .preinit_array : + { + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP (*(.preinit_array*)) + PROVIDE_HIDDEN (__preinit_array_end = .); + } >FLASH + + .init_array : + { + PROVIDE_HIDDEN (__init_array_start = .); + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array*)) + PROVIDE_HIDDEN (__init_array_end = .); + } >FLASH + + .fini_array : + { + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP (*(SORT(.fini_array.*))) + KEEP (*(.fini_array*)) + PROVIDE_HIDDEN (__fini_array_end = .); + } >FLASH + + /* used by the startup to initialize data */ + _sidata = LOADADDR(.data); + + /* Initialized data sections goes into RAM, load LMA copy after code */ + .data : + { + . = ALIGN(4); + _sdata = .; /* create a global symbol at data start */ + *(.data) /* .data sections */ + *(.data*) /* .data* sections */ + + . = ALIGN(4); + _edata = .; /* define a global symbol at data end */ + } >RAM AT> FLASH + + _siccmram = LOADADDR(.ccmram); + + /* CCM-RAM section + * + * IMPORTANT NOTE! + * If initialized variables will be placed in this section, + * the startup code needs to be modified to copy the init-values. + */ + .ccmram : + { + . = ALIGN(4); + _sccmram = .; /* create a global symbol at ccmram start */ + *(.ccmram) + *(.ccmram*) + + . = ALIGN(4); + _eccmram = .; /* create a global symbol at ccmram end */ + } >CCMRAM AT> FLASH + + /* Uninitialized data section */ + . = ALIGN(4); + .bss : + { + /* This is used by the startup in order to initialize the .bss secion */ + _sbss = .; /* define a global symbol at bss start */ + __bss_start__ = _sbss; + *(.bss) + *(.bss*) + *(COMMON) + + . = ALIGN(4); + _ebss = .; /* define a global symbol at bss end */ + __bss_end__ = _ebss; + } >RAM + + /* User_heap_stack section, used to check that there is enough RAM left */ + ._user_heap_stack : + { + . = ALIGN(4); + PROVIDE ( end = . ); + PROVIDE ( _end = . ); + . = . + _Min_Heap_Size; + . = . + _Min_Stack_Size; + . = ALIGN(4); + } >RAM + + /* Remove information from the standard libraries */ + /DISCARD/ : + { + libc.a ( * ) + libm.a ( * ) + libgcc.a ( * ) + } + + .ARM.attributes 0 : + { + *(.ARM.attributes) + } +} \ No newline at end of file diff --git a/ldscripts/stm32f30xx.ld b/ldscripts/stm32f30xx.ld new file mode 100755 index 0000000..f56fbf4 --- /dev/null +++ b/ldscripts/stm32f30xx.ld @@ -0,0 +1,170 @@ +/* +***************************************************************************** +** +** File : STM32-FLASH.ld +** +** Abstract : Linker script for STM32F30x Device with +** 256KByte FLASH and 40KByte RAM +** +** Set heap size, stack size and stack location according +** to application requirements. +** +** Set memory bank area and size if external memory is used. +** +** Target : STMicroelectronics STM32 +** +** Environment : Atollic TrueSTUDIO(R) +** +** Distribution: The file is distributed "as is," without any warranty +** of any kind. +** +** (c)Copyright Atollic AB. +** You may use this file as-is or modify it according to the needs of your +** project. Distribution of this file (unmodified or modified) is not +** permitted. Atollic AB permit registered Atollic TrueSTUDIO(R) users the +** rights to distribute the assembled, compiled & linked contents of this +** file as part of an application binary file, provided that it is built +** using the Atollic TrueSTUDIO(R) toolchain. +** +***************************************************************************** +*/ + +/* Entry Point */ +ENTRY(Reset_Handler) + +/* Highest address of the user mode stack */ +_estack = 0x2000A000; /* end of 40K RAM */ + +/* Generate a link error if heap and stack don't fit into RAM */ +_Min_Heap_Size = 0x200; /* required amount of heap */ +_Min_Stack_Size = 0x400; /* required amount of stack */ + +/* Specify the memory areas */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 256K + RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 40K + MEMORY_B1 (rx) : ORIGIN = 0x60000000, LENGTH = 0K +} + +/* Define output sections */ +SECTIONS +{ + /* The startup code goes first into FLASH */ + .isr_vector : + { + . = ALIGN(4); + KEEP(*(.isr_vector)) /* Startup code */ + . = ALIGN(4); + } >FLASH + + /* The program code and other data goes into FLASH */ + .text : + { + . = ALIGN(4); + *(.text) /* .text sections (code) */ + *(.text*) /* .text* sections (code) */ + *(.rodata) /* .rodata sections (constants, strings, etc.) */ + *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ + *(.glue_7) /* glue arm to thumb code */ + *(.glue_7t) /* glue thumb to arm code */ + + KEEP (*(.init)) + KEEP (*(.fini)) + + . = ALIGN(4); + _etext = .; /* define a global symbols at end of code */ + } >FLASH + + + .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH + .ARM : { + __exidx_start = .; + *(.ARM.exidx*) + __exidx_end = .; + } >FLASH + + .preinit_array : + { + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP (*(.preinit_array*)) + PROVIDE_HIDDEN (__preinit_array_end = .); + } >FLASH + .init_array : + { + PROVIDE_HIDDEN (__init_array_start = .); + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array*)) + PROVIDE_HIDDEN (__init_array_end = .); + } >FLASH + .fini_array : + { + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP (*(.fini_array*)) + KEEP (*(SORT(.fini_array.*))) + PROVIDE_HIDDEN (__fini_array_end = .); + } >FLASH + + /* used by the startup to initialize data */ + _sidata = .; + + /* Initialized data sections goes into RAM, load LMA copy after code */ + .data : AT ( _sidata ) + { + . = ALIGN(4); + _sdata = .; /* create a global symbol at data start */ + *(.data) /* .data sections */ + *(.data*) /* .data* sections */ + + . = ALIGN(4); + _edata = .; /* define a global symbol at data end */ + } >RAM + + /* Uninitialized data section */ + . = ALIGN(4); + .bss : + { + /* This is used by the startup in order to initialize the .bss secion */ + _sbss = .; /* define a global symbol at bss start */ + __bss_start__ = _sbss; + *(.bss) + *(.bss*) + *(COMMON) + + . = ALIGN(4); + _ebss = .; /* define a global symbol at bss end */ + __bss_end__ = _ebss; + } >RAM + + PROVIDE ( end = _ebss ); + PROVIDE ( _end = _ebss ); + + /* User_heap_stack section, used to check that there is enough RAM left */ + ._user_heap_stack : + { + . = ALIGN(4); + . = . + _Min_Heap_Size; + . = . + _Min_Stack_Size; + . = ALIGN(4); + } >RAM + + /* MEMORY_bank1 section, code must be located here explicitly */ + /* Example: extern int foo(void) __attribute__ ((section (".mb1text"))); */ + .memory_b1_text : + { + *(.mb1text) /* .mb1text sections (code) */ + *(.mb1text*) /* .mb1text* sections (code) */ + *(.mb1rodata) /* read-only data (constants) */ + *(.mb1rodata*) + } >MEMORY_B1 + + /* Remove information from the standard libraries */ + /DISCARD/ : + { + libc.a ( * ) + libm.a ( * ) + libgcc.a ( * ) + } + + .ARM.attributes 0 : { *(.ARM.attributes) } +} diff --git a/ldscripts/stm32f405x6.ld b/ldscripts/stm32f405x6.ld new file mode 100755 index 0000000..df6ac9a --- /dev/null +++ b/ldscripts/stm32f405x6.ld @@ -0,0 +1,174 @@ +/* +***************************************************************************** +** +** File : stm32_flash.ld +** +** Abstract : Linker script for STM32F407VG Device with +** 1024KByte FLASH, 192KByte RAM +** +** Set heap size, stack size and stack location according +** to application requirements. +** +** Set memory bank area and size if external memory is used. +** +** Target : STMicroelectronics STM32 +** +** Environment : Atollic TrueSTUDIO(R) +** +** Distribution: The file is distributed as is, without any warranty +** of any kind. +** +** (c)Copyright Atollic AB. +** You may use this file as-is or modify it according to the needs of your +** project. Distribution of this file (unmodified or modified) is not +** permitted. Atollic AB permit registered Atollic TrueSTUDIO(R) users the +** rights to distribute the assembled, compiled & linked contents of this +** file as part of an application binary file, provided that it is built +** using the Atollic TrueSTUDIO(R) toolchain. +** +***************************************************************************** +*/ + +/* Highest address of the user mode stack */ +_estack = 0x20020000; /* end of 128K RAM on AHB bus*/ + +/* Generate a link error if heap and stack don't fit into RAM */ +_Min_Heap_Size = 0; /* required amount of heap */ +_Min_Stack_Size = 0x400; /* required amount of stack */ + +/* Specify the memory areas */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 1024K + RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K + CCMRAM (xrw) : ORIGIN = 0x10000000, LENGTH = 64K + MEMORY_B1 (rx) : ORIGIN = 0x60000000, LENGTH = 0K +} +/* Entry Point */ +ENTRY(Reset_Handler) + +/* Define output sections */ +SECTIONS +{ + /* The startup code goes first into FLASH */ + .isr_vector : + { + . = ALIGN(4); + KEEP(*(.isr_vector)) /* Startup code */ + . = ALIGN(4); + } >FLASH + + /* The program code and other data goes into FLASH */ + .text : + { + . = ALIGN(4); + *(.text.Reset_Handler) + *(.text.Default_Handler) + *(.text) /* .text sections (code) */ + *(.text*) /* .text* sections (code) */ + *(.text.*) /* .text* sections (code) */ + *(.rodata) /* .rodata sections (constants, strings, etc.) */ + *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ + *(.glue_7) /* glue arm to thumb code */ + *(.glue_7t) /* glue thumb to arm code */ + *(.eh_frame) + + KEEP (*(.init)) + KEEP (*(.fini)) + + . = ALIGN(4); + _etext = .; /* define a global symbols at end of code */ + } >FLASH + + + .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH + .ARM : { + __exidx_start = .; + *(.ARM.exidx*) + __exidx_end = .; + } >FLASH + + .preinit_array : + { + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP (*(.preinit_array*)) + PROVIDE_HIDDEN (__preinit_array_end = .); + } >FLASH + .init_array : + { + PROVIDE_HIDDEN (__init_array_start = .); + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array*)) + PROVIDE_HIDDEN (__init_array_end = .); + } >FLASH + .fini_array : + { + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP (*(.fini_array*)) + KEEP (*(SORT(.fini_array.*))) + PROVIDE_HIDDEN (__fini_array_end = .); + } >FLASH + + /* used by the startup to initialize data */ + _sidata = .; + + /* Initialized data sections goes into RAM, load LMA copy after code */ + .data : AT ( _sidata ) + { + . = ALIGN(4); + _sdata = .; /* create a global symbol at data start */ + *(.data) /* .data sections */ + *(.data*) /* .data* sections */ + + . = ALIGN(4); + _edata = .; /* define a global symbol at data end */ + } >RAM + + /* Uninitialized data section */ + . = ALIGN(4); + .bss : + { + /* This is used by the startup in order to initialize the .bss secion */ + _sbss = .; /* define a global symbol at bss start */ + __bss_start__ = _sbss; + *(.bss) + *(.bss*) + *(COMMON) + + . = ALIGN(4); + _ebss = .; /* define a global symbol at bss end */ + __bss_end__ = _ebss; + } >RAM + + /* User_heap_stack section, used to check that there is enough RAM left */ + + ._user_heap_stack : + { + . = ALIGN(4); + PROVIDE ( end = . ); + PROVIDE ( _end = . ); + . = . + _Min_Heap_Size; + . = . + _Min_Stack_Size; + . = ALIGN(4); + } >RAM + + /* MEMORY_bank1 section, code must be located here explicitly */ + /* Example: extern int foo(void) __attribute__ ((section (".mb1text"))); */ + .memory_b1_text : + { + *(.mb1text) /* .mb1text sections (code) */ + *(.mb1text*) /* .mb1text* sections (code) */ + *(.mb1rodata) /* read-only data (constants) */ + *(.mb1rodata*) + } >MEMORY_B1 + + /* Remove information from the standard libraries */ + /DISCARD/ : + { + libc.a ( * ) + libm.a ( * ) + libgcc.a ( * ) + } + + .ARM.attributes 0 : { *(.ARM.attributes) } +} \ No newline at end of file diff --git a/ldscripts/stm32l15xx6.ld b/ldscripts/stm32l15xx6.ld new file mode 100755 index 0000000..146b16e --- /dev/null +++ b/ldscripts/stm32l15xx6.ld @@ -0,0 +1,173 @@ +/* +***************************************************************************** +** +** File : stm32_flash.ld +** +** Abstract : Linker script for STM32L152RB Device with +** 128KByte FLASH, 16KByte RAM +** +** Set heap size, stack size and stack location according +** to application requirements. +** +** Set memory bank area and size if external memory is used. +** +** Target : STMicroelectronics STM32 +** +** Environment : Atollic TrueSTUDIO(R) +** +** Distribution: The file is distributed “as is,” without any warranty +** of any kind. +** +** (c)Copyright Atollic AB. +** You may use this file as-is or modify it according to the needs of your +** project. Distribution of this file (unmodified or modified) is not +** permitted. Atollic AB permit registered Atollic TrueSTUDIO(R) users the +** rights to distribute the assembled, compiled & linked contents of this +** file as part of an application binary file, provided that it is built +** using the Atollic TrueSTUDIO(R) toolchain. +** +***************************************************************************** +*/ + +/* Entry Point */ +ENTRY(Reset_Handler) + +/* Highest address of the user mode stack */ +_estack = 0x20004000; /* end of 16K RAM */ + +/* Generate a link error if heap and stack don't fit into RAM */ +_Min_Heap_Size = 0; /* required amount of heap */ +_Min_Stack_Size = 0x80; /* required amount of stack */ + +/* Specify the memory areas */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 128K + RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 16K + MEMORY_B1 (rx) : ORIGIN = 0x60000000, LENGTH = 0K + RW_EEPROM (rw) : ORIGIN = 0x08080000, LENGTH = 32 +} + +/* Define output sections */ +SECTIONS +{ + /* The startup code goes first into FLASH */ + .isr_vector : + { + . = ALIGN(4); + KEEP(*(.isr_vector)) /* Startup code */ + . = ALIGN(4); + } >FLASH + + /* The program code and other data goes into FLASH */ + .text : + { + . = ALIGN(4); + *(.text) /* .text sections (code) */ + *(.text*) /* .text* sections (code) */ + *(.rodata) /* .rodata sections (constants, strings, etc.) */ + *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ + *(.glue_7) /* glue arm to thumb code */ + *(.glue_7t) /* glue thumb to arm code */ + *(.eh_frame) + + KEEP (*(.init)) + KEEP (*(.fini)) + + . = ALIGN(4); + _etext = .; /* define a global symbols at end of code */ + } >FLASH + + + .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH + .ARM : { + __exidx_start = .; + *(.ARM.exidx*) + __exidx_end = .; + } >FLASH + + .preinit_array : + { + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP (*(.preinit_array*)) + PROVIDE_HIDDEN (__preinit_array_end = .); + } >FLASH + .init_array : + { + PROVIDE_HIDDEN (__init_array_start = .); + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array*)) + PROVIDE_HIDDEN (__init_array_end = .); + } >FLASH + .fini_array : + { + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP (*(.fini_array*)) + KEEP (*(SORT(.fini_array.*))) + PROVIDE_HIDDEN (__fini_array_end = .); + } >FLASH + + /* used by the startup to initialize data */ + _sidata = .; + + /* Initialized data sections goes into RAM, load LMA copy after code */ + .data : AT ( _sidata ) + { + . = ALIGN(4); + _sdata = .; /* create a global symbol at data start */ + *(.data) /* .data sections */ + *(.data*) /* .data* sections */ + + . = ALIGN(4); + _edata = .; /* define a global symbol at data end */ + } >RAM + + /* Uninitialized data section */ + . = ALIGN(4); + .bss : + { + /* This is used by the startup in order to initialize the .bss secion */ + _sbss = .; /* define a global symbol at bss start */ + __bss_start__ = _sbss; + *(.bss) + *(.bss*) + *(COMMON) + + . = ALIGN(4); + _ebss = .; /* define a global symbol at bss end */ + __bss_end__ = _ebss; + } >RAM + + /* User_heap_stack section, used to check that there is enough RAM left */ + ._user_heap_stack : + { + . = ALIGN(4); + PROVIDE ( end = . ); + PROVIDE ( _end = . ); + . = . + _Min_Heap_Size; + . = . + _Min_Stack_Size; + . = ALIGN(4); + } >RAM + + /* MEMORY_bank1 section, code must be located here explicitly */ + /* Example: extern int foo(void) __attribute__ ((section (".mb1text"))); */ + .memory_b1_text : + { + *(.mb1text) /* .mb1text sections (code) */ + *(.mb1text*) /* .mb1text* sections (code) */ + *(.mb1rodata) /* read-only data (constants) */ + *(.mb1rodata*) + } >MEMORY_B1 + + /* Remove information from the standard libraries */ + /DISCARD/ : + { + libc.a ( * ) + libm.a ( * ) + libgcc.a ( * ) + } + + .ARM.attributes 0 : { *(.ARM.attributes) } + + .DataFlash (NOLOAD): {*(.DataFlash)} >RW_EEPROM +} diff --git a/platform.json b/platform.json new file mode 100644 index 0000000..8b07aa1 --- /dev/null +++ b/platform.json @@ -0,0 +1,74 @@ +{ + "name": "ststm32", + "title": "ST STM32", + "description": "The STM32 family of 32-bit Flash MCUs based on the ARM Cortex-M processor is designed to offer new degrees of freedom to MCU users. It offers a 32-bit product range that combines very high performance, real-time capabilities, digital signal processing, and low-power, low-voltage operation, while maintaining full integration and ease of development.", + "url": "http://www.st.com/web/en/catalog/mmc/FM141/SC1169?sc=stm32", + "homepage": "http://platformio.org/platforms/ststm32", + "license": { + "type": "Apache-2.0", + "url": "http://opensource.org/licenses/apache2.0.php" + }, + "engines": { + "platformio": "~3.0.0", + "scons": ">=2.3.0,<2.6.0" + }, + "repository": { + "type": "git", + "url": "https://github.com/platformio/platform-ststm32.git" + }, + "version": "0.0.0", + "packageRepositories": [ + "https://dl.bintray.com/platformio/dl-packages/manifest.json", + "https://sourceforge.net/projects/platformio-storage/files/packages/manifest.json/download", + "http://dl.platformio.org/packages/manifest.json" + ], + "frameworks": { + "mbed": { + "package": "framework-mbed", + "script": "builder/frameworks/mbed/mbed.py" + }, + "cmsis": { + "package": "framework-cmsis", + "script": "builder/frameworks/cmsis.py" + }, + "spl": { + "package": "framework-spl", + "script": "builder/frameworks/spl.py" + }, + "libopencm3": { + "package": "framework-libopencm3", + "script": "builder/frameworks/libopencm3/libopencm3.py" + } + }, + "packages": { + "toolchain-gccarmnoneeabi": { + "type": "toolchain", + "version": ">=1.40803.0,<1.40805.0" + }, + "framework-mbed": { + "type": "framework", + "optional": true, + "version": "~1.117.0" + }, + "framework-cmsis": { + "type": "framework", + "optional": true, + "version": "~1.40300.0" + }, + "framework-spl": { + "type": "framework", + "optional": true, + "version": "~1.10201.0" + }, + "framework-libopencm3": { + "type": "framework", + "optional": true, + "version": "~1.1.0" + }, + "tool-stlink": { + "type": "uploader", + "optional": true, + "version": "~1.1.0" + } + } +}