Clone of official tools
export/sw4stm32/__init__.py@47:21ae3e5a7128, 2021-02-04 (annotated)
- Committer:
- Anders Blomdell
- Date:
- Thu Feb 04 17:17:13 2021 +0100
- Revision:
- 47:21ae3e5a7128
- Parent:
- 43:2a7da56ebd24
Add a few normpath calls
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
The Other Jimmy |
35:da9c89f8be7d | 1 | """ |
The Other Jimmy |
35:da9c89f8be7d | 2 | mbed SDK |
theotherjimmy |
40:7d3fa6b99b2b | 3 | Copyright (c) 2011-2017 ARM Limited |
The Other Jimmy |
35:da9c89f8be7d | 4 | |
The Other Jimmy |
35:da9c89f8be7d | 5 | Licensed under the Apache License, Version 2.0 (the "License"); |
The Other Jimmy |
35:da9c89f8be7d | 6 | you may not use this file except in compliance with the License. |
The Other Jimmy |
35:da9c89f8be7d | 7 | You may obtain a copy of the License at |
The Other Jimmy |
35:da9c89f8be7d | 8 | |
The Other Jimmy |
35:da9c89f8be7d | 9 | http://www.apache.org/licenses/LICENSE-2.0 |
The Other Jimmy |
35:da9c89f8be7d | 10 | |
The Other Jimmy |
35:da9c89f8be7d | 11 | Unless required by applicable law or agreed to in writing, software |
The Other Jimmy |
35:da9c89f8be7d | 12 | distributed under the License is distributed on an "AS IS" BASIS, |
The Other Jimmy |
35:da9c89f8be7d | 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
The Other Jimmy |
35:da9c89f8be7d | 14 | See the License for the specific language governing permissions and |
The Other Jimmy |
35:da9c89f8be7d | 15 | limitations under the License. |
The Other Jimmy |
35:da9c89f8be7d | 16 | """ |
theotherjimmy |
43:2a7da56ebd24 | 17 | from __future__ import print_function, absolute_import |
theotherjimmy |
43:2a7da56ebd24 | 18 | from builtins import str |
theotherjimmy |
40:7d3fa6b99b2b | 19 | |
theotherjimmy |
43:2a7da56ebd24 | 20 | from os.path import splitext, basename, relpath, join |
theotherjimmy |
43:2a7da56ebd24 | 21 | import shutil |
The Other Jimmy |
35:da9c89f8be7d | 22 | from tools.utils import mkdir |
theotherjimmy |
40:7d3fa6b99b2b | 23 | from tools.export.gnuarmeclipse import GNUARMEclipse |
theotherjimmy |
40:7d3fa6b99b2b | 24 | from tools.export.gnuarmeclipse import UID |
theotherjimmy |
40:7d3fa6b99b2b | 25 | from tools.build_api import prepare_toolchain |
theotherjimmy |
43:2a7da56ebd24 | 26 | from tools.targets import TARGET_MAP |
theotherjimmy |
40:7d3fa6b99b2b | 27 | from sys import flags, platform |
theotherjimmy |
40:7d3fa6b99b2b | 28 | |
theotherjimmy |
40:7d3fa6b99b2b | 29 | # Global random number generator instance. |
theotherjimmy |
40:7d3fa6b99b2b | 30 | u = UID() |
The Other Jimmy |
35:da9c89f8be7d | 31 | |
The Other Jimmy |
35:da9c89f8be7d | 32 | |
theotherjimmy |
40:7d3fa6b99b2b | 33 | class Sw4STM32(GNUARMEclipse): |
theotherjimmy |
40:7d3fa6b99b2b | 34 | """ |
theotherjimmy |
40:7d3fa6b99b2b | 35 | Sw4STM32 class |
theotherjimmy |
40:7d3fa6b99b2b | 36 | """ |
The Other Jimmy |
35:da9c89f8be7d | 37 | NAME = 'Sw4STM32' |
The Other Jimmy |
35:da9c89f8be7d | 38 | TOOLCHAIN = 'GCC_ARM' |
The Other Jimmy |
35:da9c89f8be7d | 39 | |
The Other Jimmy |
35:da9c89f8be7d | 40 | BOARDS = { |
theotherjimmy |
40:7d3fa6b99b2b | 41 | 'B96B_F446VE': |
theotherjimmy |
40:7d3fa6b99b2b | 42 | { |
theotherjimmy |
40:7d3fa6b99b2b | 43 | 'name': 'B96B-F446VE', |
theotherjimmy |
40:7d3fa6b99b2b | 44 | 'mcuId': 'STM32F446VETx' |
theotherjimmy |
40:7d3fa6b99b2b | 45 | }, |
theotherjimmy |
40:7d3fa6b99b2b | 46 | 'DISCO_F051R8': |
theotherjimmy |
40:7d3fa6b99b2b | 47 | { |
theotherjimmy |
40:7d3fa6b99b2b | 48 | 'name': 'STM32F0DISCOVERY', |
theotherjimmy |
40:7d3fa6b99b2b | 49 | 'mcuId': 'STM32F051R8Tx' |
theotherjimmy |
40:7d3fa6b99b2b | 50 | }, |
theotherjimmy |
40:7d3fa6b99b2b | 51 | 'DISCO_F303VC': |
theotherjimmy |
40:7d3fa6b99b2b | 52 | { |
theotherjimmy |
40:7d3fa6b99b2b | 53 | 'name': 'STM32F3DISCOVERY', |
theotherjimmy |
40:7d3fa6b99b2b | 54 | 'mcuId': 'STM32F303VCTx' |
theotherjimmy |
40:7d3fa6b99b2b | 55 | }, |
theotherjimmy |
40:7d3fa6b99b2b | 56 | 'DISCO_F334C8': |
theotherjimmy |
40:7d3fa6b99b2b | 57 | { |
theotherjimmy |
40:7d3fa6b99b2b | 58 | 'name': 'STM32F3348DISCOVERY', |
theotherjimmy |
40:7d3fa6b99b2b | 59 | 'mcuId': 'STM32F334C8Tx' |
theotherjimmy |
40:7d3fa6b99b2b | 60 | }, |
theotherjimmy |
40:7d3fa6b99b2b | 61 | 'DISCO_F401VC': |
theotherjimmy |
40:7d3fa6b99b2b | 62 | { |
theotherjimmy |
40:7d3fa6b99b2b | 63 | 'name': 'STM32F401C-DISCO', |
theotherjimmy |
40:7d3fa6b99b2b | 64 | 'mcuId': 'STM32F401VCTx' |
theotherjimmy |
40:7d3fa6b99b2b | 65 | }, |
theotherjimmy |
40:7d3fa6b99b2b | 66 | 'DISCO_F407VG': |
theotherjimmy |
40:7d3fa6b99b2b | 67 | { |
theotherjimmy |
40:7d3fa6b99b2b | 68 | 'name': 'STM32F4DISCOVERY', |
theotherjimmy |
40:7d3fa6b99b2b | 69 | 'mcuId': 'STM32F407VGTx' |
theotherjimmy |
40:7d3fa6b99b2b | 70 | }, |
theotherjimmy |
40:7d3fa6b99b2b | 71 | 'DISCO_F413ZH': |
theotherjimmy |
40:7d3fa6b99b2b | 72 | { |
theotherjimmy |
40:7d3fa6b99b2b | 73 | 'name': 'DISCO_F413', |
theotherjimmy |
40:7d3fa6b99b2b | 74 | 'mcuId': 'STM32F413ZHTx' |
theotherjimmy |
40:7d3fa6b99b2b | 75 | }, |
theotherjimmy |
40:7d3fa6b99b2b | 76 | 'DISCO_F429ZI': |
theotherjimmy |
40:7d3fa6b99b2b | 77 | { |
theotherjimmy |
40:7d3fa6b99b2b | 78 | 'name': 'STM32F429I-DISCO', |
theotherjimmy |
40:7d3fa6b99b2b | 79 | 'mcuId': 'STM32F429ZITx' |
theotherjimmy |
40:7d3fa6b99b2b | 80 | }, |
theotherjimmy |
40:7d3fa6b99b2b | 81 | 'DISCO_F469NI': |
theotherjimmy |
40:7d3fa6b99b2b | 82 | { |
theotherjimmy |
40:7d3fa6b99b2b | 83 | 'name': 'DISCO-F469NI', |
theotherjimmy |
40:7d3fa6b99b2b | 84 | 'mcuId': 'STM32F469NIHx' |
theotherjimmy |
40:7d3fa6b99b2b | 85 | }, |
theotherjimmy |
40:7d3fa6b99b2b | 86 | 'DISCO_F746NG': |
theotherjimmy |
40:7d3fa6b99b2b | 87 | { |
theotherjimmy |
40:7d3fa6b99b2b | 88 | 'name': 'STM32F746G-DISCO', |
theotherjimmy |
40:7d3fa6b99b2b | 89 | 'mcuId': 'STM32F746NGHx' |
theotherjimmy |
40:7d3fa6b99b2b | 90 | }, |
theotherjimmy |
40:7d3fa6b99b2b | 91 | 'DISCO_F769NI': |
theotherjimmy |
40:7d3fa6b99b2b | 92 | { |
theotherjimmy |
40:7d3fa6b99b2b | 93 | 'name': 'DISCO-F769NI', |
theotherjimmy |
40:7d3fa6b99b2b | 94 | 'mcuId': 'STM32F769NIHx' |
theotherjimmy |
40:7d3fa6b99b2b | 95 | }, |
theotherjimmy |
40:7d3fa6b99b2b | 96 | 'DISCO_L053C8': |
theotherjimmy |
40:7d3fa6b99b2b | 97 | { |
theotherjimmy |
40:7d3fa6b99b2b | 98 | 'name': 'STM32L0538DISCOVERY', |
theotherjimmy |
40:7d3fa6b99b2b | 99 | 'mcuId': 'STM32L053C8Tx' |
theotherjimmy |
40:7d3fa6b99b2b | 100 | }, |
theotherjimmy |
40:7d3fa6b99b2b | 101 | 'DISCO_L072CZ_LRWAN1': |
theotherjimmy |
40:7d3fa6b99b2b | 102 | { |
theotherjimmy |
40:7d3fa6b99b2b | 103 | 'name': 'DISCO-L072CZ-LRWAN1', |
theotherjimmy |
40:7d3fa6b99b2b | 104 | 'mcuId': 'STM32L072CZTx' |
theotherjimmy |
40:7d3fa6b99b2b | 105 | }, |
theotherjimmy |
43:2a7da56ebd24 | 106 | 'MTB_MURATA_ABZ': |
theotherjimmy |
43:2a7da56ebd24 | 107 | { |
theotherjimmy |
43:2a7da56ebd24 | 108 | 'name': 'MTB-MURATA-ABZ', |
theotherjimmy |
43:2a7da56ebd24 | 109 | 'mcuId': 'STM32L0x2xZ' |
theotherjimmy |
43:2a7da56ebd24 | 110 | }, |
theotherjimmy |
40:7d3fa6b99b2b | 111 | 'DISCO_L475VG_IOT01A': |
theotherjimmy |
40:7d3fa6b99b2b | 112 | { |
theotherjimmy |
40:7d3fa6b99b2b | 113 | 'name': 'STM32L475G-DISCO', |
theotherjimmy |
40:7d3fa6b99b2b | 114 | 'mcuId': 'STM32L475VGTx' |
theotherjimmy |
40:7d3fa6b99b2b | 115 | }, |
theotherjimmy |
40:7d3fa6b99b2b | 116 | 'DISCO_L476VG': |
theotherjimmy |
40:7d3fa6b99b2b | 117 | { |
theotherjimmy |
40:7d3fa6b99b2b | 118 | 'name': 'STM32L476G-DISCO', |
theotherjimmy |
40:7d3fa6b99b2b | 119 | 'mcuId': 'STM32L476VGTx' |
theotherjimmy |
40:7d3fa6b99b2b | 120 | }, |
theotherjimmy |
40:7d3fa6b99b2b | 121 | 'NUCLEO_F030R8': |
theotherjimmy |
40:7d3fa6b99b2b | 122 | { |
theotherjimmy |
40:7d3fa6b99b2b | 123 | 'name': 'NUCLEO-F030R8', |
theotherjimmy |
40:7d3fa6b99b2b | 124 | 'mcuId': 'STM32F030R8Tx' |
theotherjimmy |
40:7d3fa6b99b2b | 125 | }, |
theotherjimmy |
40:7d3fa6b99b2b | 126 | 'NUCLEO_F031K6': |
theotherjimmy |
40:7d3fa6b99b2b | 127 | { |
theotherjimmy |
40:7d3fa6b99b2b | 128 | 'name': 'NUCLEO-F031K6', |
theotherjimmy |
40:7d3fa6b99b2b | 129 | 'mcuId': 'STM32F031K6Tx' |
theotherjimmy |
40:7d3fa6b99b2b | 130 | }, |
theotherjimmy |
40:7d3fa6b99b2b | 131 | 'NUCLEO_F042K6': |
theotherjimmy |
40:7d3fa6b99b2b | 132 | { |
theotherjimmy |
40:7d3fa6b99b2b | 133 | 'name': 'NUCLEO-F042K6', |
theotherjimmy |
40:7d3fa6b99b2b | 134 | 'mcuId': 'STM32F042K6Tx' |
theotherjimmy |
40:7d3fa6b99b2b | 135 | }, |
theotherjimmy |
40:7d3fa6b99b2b | 136 | 'NUCLEO_F070RB': |
theotherjimmy |
40:7d3fa6b99b2b | 137 | { |
theotherjimmy |
40:7d3fa6b99b2b | 138 | 'name': 'NUCLEO-F070RB', |
theotherjimmy |
40:7d3fa6b99b2b | 139 | 'mcuId': 'STM32F070RBTx' |
theotherjimmy |
40:7d3fa6b99b2b | 140 | }, |
theotherjimmy |
40:7d3fa6b99b2b | 141 | 'NUCLEO_F072RB': |
theotherjimmy |
40:7d3fa6b99b2b | 142 | { |
theotherjimmy |
40:7d3fa6b99b2b | 143 | 'name': 'NUCLEO-F072RB', |
theotherjimmy |
40:7d3fa6b99b2b | 144 | 'mcuId': 'STM32F072RBTx' |
theotherjimmy |
40:7d3fa6b99b2b | 145 | }, |
theotherjimmy |
40:7d3fa6b99b2b | 146 | 'NUCLEO_F091RC': |
theotherjimmy |
40:7d3fa6b99b2b | 147 | { |
theotherjimmy |
40:7d3fa6b99b2b | 148 | 'name': 'NUCLEO-F091RC', |
theotherjimmy |
40:7d3fa6b99b2b | 149 | 'mcuId': 'STM32F091RCTx' |
theotherjimmy |
40:7d3fa6b99b2b | 150 | }, |
theotherjimmy |
40:7d3fa6b99b2b | 151 | 'NUCLEO_F103RB': |
theotherjimmy |
40:7d3fa6b99b2b | 152 | { |
theotherjimmy |
40:7d3fa6b99b2b | 153 | 'name': 'NUCLEO-F103RB', |
theotherjimmy |
40:7d3fa6b99b2b | 154 | 'mcuId': 'STM32F103RBTx' |
theotherjimmy |
40:7d3fa6b99b2b | 155 | }, |
theotherjimmy |
40:7d3fa6b99b2b | 156 | 'NUCLEO_F207ZG': |
theotherjimmy |
40:7d3fa6b99b2b | 157 | { |
theotherjimmy |
40:7d3fa6b99b2b | 158 | 'name': 'NUCLEO-F207ZG', |
theotherjimmy |
40:7d3fa6b99b2b | 159 | 'mcuId': 'STM32F207ZGTx' |
theotherjimmy |
40:7d3fa6b99b2b | 160 | }, |
theotherjimmy |
40:7d3fa6b99b2b | 161 | 'NUCLEO_F302R8': |
theotherjimmy |
40:7d3fa6b99b2b | 162 | { |
theotherjimmy |
40:7d3fa6b99b2b | 163 | 'name': 'NUCLEO-F302R8', |
theotherjimmy |
40:7d3fa6b99b2b | 164 | 'mcuId': 'STM32F302R8Tx' |
theotherjimmy |
40:7d3fa6b99b2b | 165 | }, |
theotherjimmy |
40:7d3fa6b99b2b | 166 | 'NUCLEO_F303K8': |
theotherjimmy |
40:7d3fa6b99b2b | 167 | { |
theotherjimmy |
40:7d3fa6b99b2b | 168 | 'name': 'NUCLEO-F303K8', |
theotherjimmy |
40:7d3fa6b99b2b | 169 | 'mcuId': 'STM32F303K8Tx' |
theotherjimmy |
40:7d3fa6b99b2b | 170 | }, |
theotherjimmy |
40:7d3fa6b99b2b | 171 | 'NUCLEO_F303RE': |
theotherjimmy |
40:7d3fa6b99b2b | 172 | { |
theotherjimmy |
40:7d3fa6b99b2b | 173 | 'name': 'NUCLEO-F303RE', |
theotherjimmy |
40:7d3fa6b99b2b | 174 | 'mcuId': 'STM32F303RETx' |
theotherjimmy |
40:7d3fa6b99b2b | 175 | }, |
theotherjimmy |
40:7d3fa6b99b2b | 176 | 'NUCLEO_F303ZE': |
theotherjimmy |
40:7d3fa6b99b2b | 177 | { |
theotherjimmy |
40:7d3fa6b99b2b | 178 | 'name': 'NUCLEO-F303ZE', |
theotherjimmy |
40:7d3fa6b99b2b | 179 | 'mcuId': 'STM32F303ZETx' |
theotherjimmy |
40:7d3fa6b99b2b | 180 | }, |
theotherjimmy |
40:7d3fa6b99b2b | 181 | 'NUCLEO_F334R8': |
theotherjimmy |
40:7d3fa6b99b2b | 182 | { |
theotherjimmy |
40:7d3fa6b99b2b | 183 | 'name': 'NUCLEO-F334R8', |
theotherjimmy |
40:7d3fa6b99b2b | 184 | 'mcuId': 'STM32F334R8Tx' |
theotherjimmy |
40:7d3fa6b99b2b | 185 | }, |
theotherjimmy |
40:7d3fa6b99b2b | 186 | 'NUCLEO_F401RE': |
theotherjimmy |
40:7d3fa6b99b2b | 187 | { |
theotherjimmy |
40:7d3fa6b99b2b | 188 | 'name': 'NUCLEO-F401RE', |
theotherjimmy |
40:7d3fa6b99b2b | 189 | 'mcuId': 'STM32F401RETx' |
theotherjimmy |
40:7d3fa6b99b2b | 190 | }, |
theotherjimmy |
40:7d3fa6b99b2b | 191 | 'NUCLEO_F410RB': |
theotherjimmy |
40:7d3fa6b99b2b | 192 | { |
theotherjimmy |
40:7d3fa6b99b2b | 193 | 'name': 'NUCLEO-F410RB', |
theotherjimmy |
40:7d3fa6b99b2b | 194 | 'mcuId': 'STM32F410RBTx' |
theotherjimmy |
40:7d3fa6b99b2b | 195 | }, |
theotherjimmy |
40:7d3fa6b99b2b | 196 | 'NUCLEO_F411RE': |
theotherjimmy |
40:7d3fa6b99b2b | 197 | { |
theotherjimmy |
40:7d3fa6b99b2b | 198 | 'name': 'NUCLEO-F411RE', |
theotherjimmy |
40:7d3fa6b99b2b | 199 | 'mcuId': 'STM32F411RETx' |
theotherjimmy |
40:7d3fa6b99b2b | 200 | }, |
theotherjimmy |
43:2a7da56ebd24 | 201 | 'NUCLEO_F413ZH': |
theotherjimmy |
43:2a7da56ebd24 | 202 | { |
theotherjimmy |
43:2a7da56ebd24 | 203 | 'name': 'NUCLEO-F413ZH', |
theotherjimmy |
43:2a7da56ebd24 | 204 | 'mcuId': 'STM32F413ZHTx' |
theotherjimmy |
43:2a7da56ebd24 | 205 | }, |
theotherjimmy |
40:7d3fa6b99b2b | 206 | 'NUCLEO_F429ZI': |
theotherjimmy |
40:7d3fa6b99b2b | 207 | { |
theotherjimmy |
40:7d3fa6b99b2b | 208 | 'name': 'NUCLEO-F429ZI', |
theotherjimmy |
40:7d3fa6b99b2b | 209 | 'mcuId': 'STM32F429ZITx' |
theotherjimmy |
40:7d3fa6b99b2b | 210 | }, |
theotherjimmy |
40:7d3fa6b99b2b | 211 | 'NUCLEO_F446RE': |
theotherjimmy |
40:7d3fa6b99b2b | 212 | { |
theotherjimmy |
40:7d3fa6b99b2b | 213 | 'name': 'NUCLEO-F446RE', |
theotherjimmy |
40:7d3fa6b99b2b | 214 | 'mcuId': 'STM32F446RETx' |
theotherjimmy |
40:7d3fa6b99b2b | 215 | }, |
theotherjimmy |
40:7d3fa6b99b2b | 216 | 'NUCLEO_F446ZE': |
theotherjimmy |
40:7d3fa6b99b2b | 217 | { |
theotherjimmy |
40:7d3fa6b99b2b | 218 | 'name': 'NUCLEO-F446ZE', |
theotherjimmy |
40:7d3fa6b99b2b | 219 | 'mcuId': 'STM32F446ZETx' |
theotherjimmy |
40:7d3fa6b99b2b | 220 | }, |
theotherjimmy |
40:7d3fa6b99b2b | 221 | 'NUCLEO_F746ZG': |
theotherjimmy |
40:7d3fa6b99b2b | 222 | { |
theotherjimmy |
40:7d3fa6b99b2b | 223 | 'name': 'NUCLEO-F746ZG', |
theotherjimmy |
40:7d3fa6b99b2b | 224 | 'mcuId': 'STM32F746ZGTx' |
theotherjimmy |
40:7d3fa6b99b2b | 225 | }, |
theotherjimmy |
40:7d3fa6b99b2b | 226 | 'NUCLEO_F767ZI': |
theotherjimmy |
40:7d3fa6b99b2b | 227 | { |
theotherjimmy |
40:7d3fa6b99b2b | 228 | 'name': 'NUCLEO-F767ZI', |
theotherjimmy |
40:7d3fa6b99b2b | 229 | 'mcuId': 'STM32F767ZITx' |
theotherjimmy |
40:7d3fa6b99b2b | 230 | }, |
theotherjimmy |
40:7d3fa6b99b2b | 231 | 'NUCLEO_L011K4': |
theotherjimmy |
40:7d3fa6b99b2b | 232 | { |
theotherjimmy |
40:7d3fa6b99b2b | 233 | 'name': 'NUCLEO-L011K4', |
theotherjimmy |
40:7d3fa6b99b2b | 234 | 'mcuId': 'STM32L011K4Tx' |
theotherjimmy |
40:7d3fa6b99b2b | 235 | }, |
theotherjimmy |
40:7d3fa6b99b2b | 236 | 'NUCLEO_L031K6': |
theotherjimmy |
40:7d3fa6b99b2b | 237 | { |
theotherjimmy |
40:7d3fa6b99b2b | 238 | 'name': 'NUCLEO-L031K6', |
theotherjimmy |
40:7d3fa6b99b2b | 239 | 'mcuId': 'STM32L031K6Tx' |
theotherjimmy |
40:7d3fa6b99b2b | 240 | }, |
theotherjimmy |
40:7d3fa6b99b2b | 241 | 'NUCLEO_L053R8': |
theotherjimmy |
40:7d3fa6b99b2b | 242 | { |
theotherjimmy |
40:7d3fa6b99b2b | 243 | 'name': 'NUCLEO-L053R8', |
theotherjimmy |
40:7d3fa6b99b2b | 244 | 'mcuId': 'STM32L053R8Tx' |
theotherjimmy |
40:7d3fa6b99b2b | 245 | }, |
theotherjimmy |
40:7d3fa6b99b2b | 246 | 'NUCLEO_L073RZ': |
theotherjimmy |
40:7d3fa6b99b2b | 247 | { |
theotherjimmy |
40:7d3fa6b99b2b | 248 | 'name': 'NUCLEO-L073RZ', |
theotherjimmy |
40:7d3fa6b99b2b | 249 | 'mcuId': 'STM32L073RZTx' |
theotherjimmy |
40:7d3fa6b99b2b | 250 | }, |
theotherjimmy |
43:2a7da56ebd24 | 251 | 'MTB_RAK811': |
theotherjimmy |
43:2a7da56ebd24 | 252 | { |
theotherjimmy |
43:2a7da56ebd24 | 253 | 'name': 'MTB-RAK-811', |
theotherjimmy |
43:2a7da56ebd24 | 254 | 'mcuId': 'STM32L151CBUxA' |
theotherjimmy |
43:2a7da56ebd24 | 255 | }, |
theotherjimmy |
40:7d3fa6b99b2b | 256 | 'NUCLEO_L152RE': |
theotherjimmy |
40:7d3fa6b99b2b | 257 | { |
theotherjimmy |
40:7d3fa6b99b2b | 258 | 'name': 'NUCLEO-L152RE', |
theotherjimmy |
40:7d3fa6b99b2b | 259 | 'mcuId': 'STM32L152RETx' |
theotherjimmy |
40:7d3fa6b99b2b | 260 | }, |
theotherjimmy |
40:7d3fa6b99b2b | 261 | 'NUCLEO_L432KC': |
theotherjimmy |
40:7d3fa6b99b2b | 262 | { |
theotherjimmy |
40:7d3fa6b99b2b | 263 | 'name': 'NUCLEO-L432KC', |
theotherjimmy |
40:7d3fa6b99b2b | 264 | 'mcuId': 'STM32L432KCUx' |
theotherjimmy |
40:7d3fa6b99b2b | 265 | }, |
theotherjimmy |
43:2a7da56ebd24 | 266 | 'MTB_ADV_WISE_1510': |
theotherjimmy |
43:2a7da56ebd24 | 267 | { |
theotherjimmy |
43:2a7da56ebd24 | 268 | 'name': 'MTB-ADV-WISE-1510', |
theotherjimmy |
43:2a7da56ebd24 | 269 | 'mcuId': 'STM32L443xC' |
theotherjimmy |
43:2a7da56ebd24 | 270 | }, |
theotherjimmy |
40:7d3fa6b99b2b | 271 | 'NUCLEO_L476RG': |
theotherjimmy |
40:7d3fa6b99b2b | 272 | { |
theotherjimmy |
40:7d3fa6b99b2b | 273 | 'name': 'NUCLEO-L476RG', |
theotherjimmy |
40:7d3fa6b99b2b | 274 | 'mcuId': 'STM32L476RGTx' |
theotherjimmy |
40:7d3fa6b99b2b | 275 | }, |
theotherjimmy |
41:2a77626a4c21 | 276 | 'NUCLEO_L486RG': |
theotherjimmy |
41:2a77626a4c21 | 277 | { |
theotherjimmy |
41:2a77626a4c21 | 278 | 'name': 'NUCLEO-L486RG', |
theotherjimmy |
41:2a77626a4c21 | 279 | 'mcuId': 'STM32L486RGTx' |
theotherjimmy |
41:2a77626a4c21 | 280 | }, |
theotherjimmy |
42:2cf3f29fece1 | 281 | 'NUCLEO_L496ZG': |
theotherjimmy |
42:2cf3f29fece1 | 282 | { |
theotherjimmy |
42:2cf3f29fece1 | 283 | 'name': 'NUCLEO-L496ZG', |
theotherjimmy |
42:2cf3f29fece1 | 284 | 'mcuId': 'STM32L496ZGTx' |
theotherjimmy |
43:2a7da56ebd24 | 285 | }, |
theotherjimmy |
43:2a7da56ebd24 | 286 | 'NUCLEO_L496ZG_P': |
theotherjimmy |
43:2a7da56ebd24 | 287 | { |
theotherjimmy |
43:2a7da56ebd24 | 288 | 'name': 'NUCLEO-L496ZG', |
theotherjimmy |
43:2a7da56ebd24 | 289 | 'mcuId': 'STM32L496ZGTx' |
theotherjimmy |
43:2a7da56ebd24 | 290 | }, |
The Other Jimmy |
35:da9c89f8be7d | 291 | } |
The Other Jimmy |
35:da9c89f8be7d | 292 | |
theotherjimmy |
43:2a7da56ebd24 | 293 | @classmethod |
theotherjimmy |
43:2a7da56ebd24 | 294 | def is_target_supported(cls, target_name): |
theotherjimmy |
43:2a7da56ebd24 | 295 | target = TARGET_MAP[target_name] |
theotherjimmy |
43:2a7da56ebd24 | 296 | target_supported = bool(set(target.resolution_order_names) |
theotherjimmy |
43:2a7da56ebd24 | 297 | .intersection(set(cls.BOARDS.keys()))) |
theotherjimmy |
43:2a7da56ebd24 | 298 | toolchain_supported = cls.TOOLCHAIN in target.supported_toolchains |
theotherjimmy |
43:2a7da56ebd24 | 299 | return target_supported and toolchain_supported |
The Other Jimmy |
35:da9c89f8be7d | 300 | |
theotherjimmy |
40:7d3fa6b99b2b | 301 | def __gen_dir(self, dir_name): |
theotherjimmy |
40:7d3fa6b99b2b | 302 | """ |
theotherjimmy |
40:7d3fa6b99b2b | 303 | Method that creates directory |
theotherjimmy |
40:7d3fa6b99b2b | 304 | """ |
theotherjimmy |
40:7d3fa6b99b2b | 305 | settings = join(self.export_dir, dir_name) |
The Other Jimmy |
35:da9c89f8be7d | 306 | mkdir(settings) |
The Other Jimmy |
35:da9c89f8be7d | 307 | |
theotherjimmy |
40:7d3fa6b99b2b | 308 | def get_fpu_hardware(self, fpu_unit): |
theotherjimmy |
40:7d3fa6b99b2b | 309 | """ |
theotherjimmy |
40:7d3fa6b99b2b | 310 | Convert fpu unit name into hardware name. |
theotherjimmy |
40:7d3fa6b99b2b | 311 | """ |
theotherjimmy |
40:7d3fa6b99b2b | 312 | hw = '' |
theotherjimmy |
40:7d3fa6b99b2b | 313 | fpus = { |
theotherjimmy |
40:7d3fa6b99b2b | 314 | 'fpv4spd16': 'fpv4-sp-d16', |
theotherjimmy |
40:7d3fa6b99b2b | 315 | 'fpv5d16': 'fpv5-d16', |
theotherjimmy |
40:7d3fa6b99b2b | 316 | 'fpv5spd16': 'fpv5-sp-d16' |
theotherjimmy |
40:7d3fa6b99b2b | 317 | } |
theotherjimmy |
40:7d3fa6b99b2b | 318 | if fpu_unit in fpus: |
theotherjimmy |
40:7d3fa6b99b2b | 319 | hw = fpus[fpu_unit] |
theotherjimmy |
40:7d3fa6b99b2b | 320 | return hw |
theotherjimmy |
40:7d3fa6b99b2b | 321 | |
theotherjimmy |
40:7d3fa6b99b2b | 322 | def process_sw_options(self, opts, flags_in): |
theotherjimmy |
40:7d3fa6b99b2b | 323 | """ |
theotherjimmy |
40:7d3fa6b99b2b | 324 | Process System Workbench specific options. |
theotherjimmy |
40:7d3fa6b99b2b | 325 | |
theotherjimmy |
40:7d3fa6b99b2b | 326 | System Workbench for STM32 has some compile options, which are not recognized by the GNUARMEclipse exporter. |
theotherjimmy |
40:7d3fa6b99b2b | 327 | Those are handled in this method. |
theotherjimmy |
40:7d3fa6b99b2b | 328 | """ |
theotherjimmy |
40:7d3fa6b99b2b | 329 | opts['c']['preprocess'] = False |
theotherjimmy |
40:7d3fa6b99b2b | 330 | if '-E' in flags_in['c_flags']: |
theotherjimmy |
40:7d3fa6b99b2b | 331 | opts['c']['preprocess'] = True |
theotherjimmy |
40:7d3fa6b99b2b | 332 | opts['cpp']['preprocess'] = False |
theotherjimmy |
40:7d3fa6b99b2b | 333 | if '-E' in flags_in['cxx_flags']: |
theotherjimmy |
40:7d3fa6b99b2b | 334 | opts['cpp']['preprocess'] = True |
theotherjimmy |
40:7d3fa6b99b2b | 335 | opts['c']['slowflashdata'] = False |
theotherjimmy |
40:7d3fa6b99b2b | 336 | if '-mslow-flash-data' in flags_in['c_flags']: |
theotherjimmy |
40:7d3fa6b99b2b | 337 | opts['c']['slowflashdata'] = True |
theotherjimmy |
40:7d3fa6b99b2b | 338 | opts['cpp']['slowflashdata'] = False |
theotherjimmy |
40:7d3fa6b99b2b | 339 | if '-mslow-flash-data' in flags_in['cxx_flags']: |
theotherjimmy |
40:7d3fa6b99b2b | 340 | opts['cpp']['slowflashdata'] = True |
theotherjimmy |
40:7d3fa6b99b2b | 341 | if opts['common']['optimization.messagelength']: |
theotherjimmy |
40:7d3fa6b99b2b | 342 | opts['common']['optimization.other'] += ' -fmessage-length=0' |
theotherjimmy |
40:7d3fa6b99b2b | 343 | if opts['common']['optimization.signedchar']: |
theotherjimmy |
40:7d3fa6b99b2b | 344 | opts['common']['optimization.other'] += ' -fsigned-char' |
theotherjimmy |
40:7d3fa6b99b2b | 345 | if opts['common']['optimization.nocommon']: |
theotherjimmy |
40:7d3fa6b99b2b | 346 | opts['common']['optimization.other'] += ' -fno-common' |
theotherjimmy |
40:7d3fa6b99b2b | 347 | if opts['common']['optimization.noinlinefunctions']: |
theotherjimmy |
40:7d3fa6b99b2b | 348 | opts['common']['optimization.other'] += ' -fno-inline-functions' |
theotherjimmy |
40:7d3fa6b99b2b | 349 | if opts['common']['optimization.freestanding']: |
theotherjimmy |
40:7d3fa6b99b2b | 350 | opts['common']['optimization.other'] += ' -ffreestanding' |
theotherjimmy |
40:7d3fa6b99b2b | 351 | if opts['common']['optimization.nobuiltin']: |
theotherjimmy |
40:7d3fa6b99b2b | 352 | opts['common']['optimization.other'] += ' -fno-builtin' |
theotherjimmy |
40:7d3fa6b99b2b | 353 | if opts['common']['optimization.spconstant']: |
theotherjimmy |
40:7d3fa6b99b2b | 354 | opts['common']['optimization.other'] += ' -fsingle-precision-constant' |
theotherjimmy |
40:7d3fa6b99b2b | 355 | if opts['common']['optimization.nomoveloopinvariants']: |
theotherjimmy |
40:7d3fa6b99b2b | 356 | opts['common']['optimization.other'] += ' -fno-move-loop-invariants' |
theotherjimmy |
40:7d3fa6b99b2b | 357 | if opts['common']['warnings.unused']: |
theotherjimmy |
40:7d3fa6b99b2b | 358 | opts['common']['warnings.other'] += ' -Wunused' |
theotherjimmy |
40:7d3fa6b99b2b | 359 | if opts['common']['warnings.uninitialized']: |
theotherjimmy |
40:7d3fa6b99b2b | 360 | opts['common']['warnings.other'] += ' -Wuninitialized' |
theotherjimmy |
40:7d3fa6b99b2b | 361 | if opts['common']['warnings.missingdeclaration']: |
theotherjimmy |
40:7d3fa6b99b2b | 362 | opts['common']['warnings.other'] += ' -Wmissing-declarations' |
theotherjimmy |
40:7d3fa6b99b2b | 363 | if opts['common']['warnings.pointerarith']: |
theotherjimmy |
40:7d3fa6b99b2b | 364 | opts['common']['warnings.other'] += ' -Wpointer-arith' |
theotherjimmy |
40:7d3fa6b99b2b | 365 | if opts['common']['warnings.padded']: |
theotherjimmy |
40:7d3fa6b99b2b | 366 | opts['common']['warnings.other'] += ' -Wpadded' |
theotherjimmy |
40:7d3fa6b99b2b | 367 | if opts['common']['warnings.shadow']: |
theotherjimmy |
40:7d3fa6b99b2b | 368 | opts['common']['warnings.other'] += ' -Wshadow' |
theotherjimmy |
40:7d3fa6b99b2b | 369 | if opts['common']['warnings.logicalop']: |
theotherjimmy |
40:7d3fa6b99b2b | 370 | opts['common']['warnings.other'] += ' -Wlogical-op' |
theotherjimmy |
40:7d3fa6b99b2b | 371 | if opts['common']['warnings.agreggatereturn']: |
theotherjimmy |
40:7d3fa6b99b2b | 372 | opts['common']['warnings.other'] += ' -Waggregate-return' |
theotherjimmy |
40:7d3fa6b99b2b | 373 | if opts['common']['warnings.floatequal']: |
theotherjimmy |
40:7d3fa6b99b2b | 374 | opts['common']['warnings.other'] += ' -Wfloat-equal' |
theotherjimmy |
40:7d3fa6b99b2b | 375 | opts['ld']['strip'] = False |
theotherjimmy |
40:7d3fa6b99b2b | 376 | if '-s' in flags_in['ld_flags']: |
theotherjimmy |
40:7d3fa6b99b2b | 377 | opts['ld']['strip'] = True |
theotherjimmy |
40:7d3fa6b99b2b | 378 | opts['ld']['shared'] = False |
theotherjimmy |
40:7d3fa6b99b2b | 379 | if '-shared' in flags_in['ld_flags']: |
theotherjimmy |
40:7d3fa6b99b2b | 380 | opts['ld']['shared'] = True |
theotherjimmy |
40:7d3fa6b99b2b | 381 | opts['ld']['soname'] = '' |
theotherjimmy |
40:7d3fa6b99b2b | 382 | opts['ld']['implname'] = '' |
theotherjimmy |
40:7d3fa6b99b2b | 383 | opts['ld']['defname'] = '' |
theotherjimmy |
40:7d3fa6b99b2b | 384 | for item in flags_in['ld_flags']: |
theotherjimmy |
40:7d3fa6b99b2b | 385 | if item.startswith('-Wl,-soname='): |
theotherjimmy |
40:7d3fa6b99b2b | 386 | opts['ld']['soname'] = item[len('-Wl,-soname='):] |
theotherjimmy |
40:7d3fa6b99b2b | 387 | if item.startswith('-Wl,--out-implib='): |
theotherjimmy |
40:7d3fa6b99b2b | 388 | opts['ld']['implname'] = item[len('-Wl,--out-implib='):] |
theotherjimmy |
40:7d3fa6b99b2b | 389 | if item.startswith('-Wl,--output-def='): |
theotherjimmy |
40:7d3fa6b99b2b | 390 | opts['ld']['defname'] = item[len('-Wl,--output-def='):] |
theotherjimmy |
40:7d3fa6b99b2b | 391 | opts['common']['arm.target.fpu.hardware'] = self.get_fpu_hardware( |
theotherjimmy |
40:7d3fa6b99b2b | 392 | opts['common']['arm.target.fpu.unit']) |
theotherjimmy |
40:7d3fa6b99b2b | 393 | opts['common']['debugging.codecov'] = False |
theotherjimmy |
40:7d3fa6b99b2b | 394 | if '-fprofile-arcs' in flags_in['common_flags'] and '-ftest-coverage' in flags_in['common_flags']: |
theotherjimmy |
40:7d3fa6b99b2b | 395 | opts['common']['debugging.codecov'] = True |
theotherjimmy |
40:7d3fa6b99b2b | 396 | # Passing linker options to linker with '-Wl,'-prefix. |
theotherjimmy |
40:7d3fa6b99b2b | 397 | for index in range(len(opts['ld']['flags'])): |
theotherjimmy |
40:7d3fa6b99b2b | 398 | item = opts['ld']['flags'][index] |
theotherjimmy |
40:7d3fa6b99b2b | 399 | if not item.startswith('-Wl,'): |
theotherjimmy |
40:7d3fa6b99b2b | 400 | opts['ld']['flags'][index] = '-Wl,' + item |
theotherjimmy |
40:7d3fa6b99b2b | 401 | # Strange System Workbench feature: If first parameter in Other flags is a |
theotherjimmy |
40:7d3fa6b99b2b | 402 | # define (-D...), Other flags will be replaced by defines and other flags |
theotherjimmy |
40:7d3fa6b99b2b | 403 | # are completely ignored. Moving -D parameters to defines. |
theotherjimmy |
40:7d3fa6b99b2b | 404 | for compiler in ['c', 'cpp', 'as']: |
theotherjimmy |
40:7d3fa6b99b2b | 405 | tmpList = opts[compiler]['other'].split(' ') |
theotherjimmy |
40:7d3fa6b99b2b | 406 | otherList = [] |
theotherjimmy |
40:7d3fa6b99b2b | 407 | for item in tmpList: |
theotherjimmy |
40:7d3fa6b99b2b | 408 | if item.startswith('-D'): |
theotherjimmy |
40:7d3fa6b99b2b | 409 | opts[compiler]['defines'].append(str(item[2:])) |
theotherjimmy |
40:7d3fa6b99b2b | 410 | else: |
theotherjimmy |
40:7d3fa6b99b2b | 411 | otherList.append(item) |
theotherjimmy |
40:7d3fa6b99b2b | 412 | opts[compiler]['other'] = ' '.join(otherList) |
theotherjimmy |
40:7d3fa6b99b2b | 413 | # Assembler options |
theotherjimmy |
40:7d3fa6b99b2b | 414 | for as_def in opts['as']['defines']: |
theotherjimmy |
40:7d3fa6b99b2b | 415 | if '=' in as_def: |
theotherjimmy |
40:7d3fa6b99b2b | 416 | opts['as']['other'] += ' --defsym ' + as_def |
theotherjimmy |
40:7d3fa6b99b2b | 417 | else: |
theotherjimmy |
40:7d3fa6b99b2b | 418 | opts['as']['other'] += ' --defsym ' + as_def + '=1' |
The Other Jimmy |
35:da9c89f8be7d | 419 | |
The Other Jimmy |
35:da9c89f8be7d | 420 | def generate(self): |
theotherjimmy |
40:7d3fa6b99b2b | 421 | """ |
theotherjimmy |
40:7d3fa6b99b2b | 422 | Generate the .project and .cproject files. |
theotherjimmy |
40:7d3fa6b99b2b | 423 | """ |
theotherjimmy |
40:7d3fa6b99b2b | 424 | options = {} |
theotherjimmy |
40:7d3fa6b99b2b | 425 | |
theotherjimmy |
40:7d3fa6b99b2b | 426 | if not self.resources.linker_script: |
theotherjimmy |
40:7d3fa6b99b2b | 427 | raise NotSupportedException("No linker script found.") |
theotherjimmy |
40:7d3fa6b99b2b | 428 | |
theotherjimmy |
43:2a7da56ebd24 | 429 | print('\nCreate a System Workbench for STM32 managed project') |
theotherjimmy |
43:2a7da56ebd24 | 430 | print('Project name: {0}'.format(self.project_name)) |
theotherjimmy |
43:2a7da56ebd24 | 431 | print('Target: {0}'.format(self.toolchain.target.name)) |
theotherjimmy |
43:2a7da56ebd24 | 432 | print('Toolchain: {0}'.format(self.TOOLCHAIN) + '\n') |
theotherjimmy |
40:7d3fa6b99b2b | 433 | |
theotherjimmy |
40:7d3fa6b99b2b | 434 | self.resources.win_to_unix() |
theotherjimmy |
40:7d3fa6b99b2b | 435 | |
The Other Jimmy |
35:da9c89f8be7d | 436 | libraries = [] |
theotherjimmy |
43:2a7da56ebd24 | 437 | for lib in self.libraries: |
theotherjimmy |
40:7d3fa6b99b2b | 438 | library, _ = splitext(basename(lib)) |
theotherjimmy |
40:7d3fa6b99b2b | 439 | libraries.append(library[3:]) |
theotherjimmy |
40:7d3fa6b99b2b | 440 | |
theotherjimmy |
40:7d3fa6b99b2b | 441 | self.system_libraries = [ |
theotherjimmy |
40:7d3fa6b99b2b | 442 | 'stdc++', 'supc++', 'm', 'c', 'gcc', 'nosys' |
theotherjimmy |
40:7d3fa6b99b2b | 443 | ] |
theotherjimmy |
40:7d3fa6b99b2b | 444 | |
theotherjimmy |
40:7d3fa6b99b2b | 445 | profiles = self.get_all_profiles() |
theotherjimmy |
40:7d3fa6b99b2b | 446 | self.as_defines = [s.replace('"', '"') |
theotherjimmy |
40:7d3fa6b99b2b | 447 | for s in self.toolchain.get_symbols(True)] |
theotherjimmy |
40:7d3fa6b99b2b | 448 | self.c_defines = [s.replace('"', '"') |
theotherjimmy |
40:7d3fa6b99b2b | 449 | for s in self.toolchain.get_symbols()] |
theotherjimmy |
40:7d3fa6b99b2b | 450 | self.cpp_defines = self.c_defines |
theotherjimmy |
40:7d3fa6b99b2b | 451 | |
theotherjimmy |
40:7d3fa6b99b2b | 452 | self.include_path = [] |
theotherjimmy |
40:7d3fa6b99b2b | 453 | for s in self.resources.inc_dirs: |
theotherjimmy |
40:7d3fa6b99b2b | 454 | self.include_path.append("../" + self.filter_dot(s)) |
theotherjimmy |
43:2a7da56ebd24 | 455 | print('Include folders: {0}'.format(len(self.include_path))) |
theotherjimmy |
40:7d3fa6b99b2b | 456 | |
theotherjimmy |
40:7d3fa6b99b2b | 457 | self.compute_exclusions() |
theotherjimmy |
40:7d3fa6b99b2b | 458 | |
theotherjimmy |
43:2a7da56ebd24 | 459 | print('Exclude folders: {0}'.format(len(self.excluded_folders))) |
theotherjimmy |
40:7d3fa6b99b2b | 460 | |
theotherjimmy |
40:7d3fa6b99b2b | 461 | ld_script = self.filter_dot(self.resources.linker_script) |
theotherjimmy |
43:2a7da56ebd24 | 462 | print('Linker script: {0}'.format(ld_script)) |
theotherjimmy |
40:7d3fa6b99b2b | 463 | |
theotherjimmy |
40:7d3fa6b99b2b | 464 | lib_dirs = [self.filter_dot(s) for s in self.resources.lib_dirs] |
theotherjimmy |
40:7d3fa6b99b2b | 465 | |
theotherjimmy |
40:7d3fa6b99b2b | 466 | preproc_cmd = basename(self.toolchain.preproc[0]) + " " + " ".join(self.toolchain.preproc[1:]) |
theotherjimmy |
40:7d3fa6b99b2b | 467 | |
theotherjimmy |
40:7d3fa6b99b2b | 468 | for id in ['debug', 'release']: |
theotherjimmy |
40:7d3fa6b99b2b | 469 | opts = {} |
theotherjimmy |
40:7d3fa6b99b2b | 470 | opts['common'] = {} |
theotherjimmy |
40:7d3fa6b99b2b | 471 | opts['as'] = {} |
theotherjimmy |
40:7d3fa6b99b2b | 472 | opts['c'] = {} |
theotherjimmy |
40:7d3fa6b99b2b | 473 | opts['cpp'] = {} |
theotherjimmy |
40:7d3fa6b99b2b | 474 | opts['ld'] = {} |
theotherjimmy |
40:7d3fa6b99b2b | 475 | |
theotherjimmy |
40:7d3fa6b99b2b | 476 | opts['id'] = id |
theotherjimmy |
40:7d3fa6b99b2b | 477 | opts['name'] = opts['id'].capitalize() |
theotherjimmy |
40:7d3fa6b99b2b | 478 | |
theotherjimmy |
40:7d3fa6b99b2b | 479 | profile = profiles[id] |
theotherjimmy |
40:7d3fa6b99b2b | 480 | |
theotherjimmy |
40:7d3fa6b99b2b | 481 | # A small hack, do not bother with src_path again, |
theotherjimmy |
40:7d3fa6b99b2b | 482 | # pass an empty string to avoid crashing. |
theotherjimmy |
40:7d3fa6b99b2b | 483 | src_paths = [''] |
theotherjimmy |
40:7d3fa6b99b2b | 484 | toolchain = prepare_toolchain( |
theotherjimmy |
40:7d3fa6b99b2b | 485 | src_paths, "", self.toolchain.target.name, self.TOOLCHAIN, build_profile=[profile]) |
theotherjimmy |
40:7d3fa6b99b2b | 486 | |
theotherjimmy |
40:7d3fa6b99b2b | 487 | # Hack to fill in build_dir |
theotherjimmy |
40:7d3fa6b99b2b | 488 | toolchain.build_dir = self.toolchain.build_dir |
theotherjimmy |
40:7d3fa6b99b2b | 489 | |
theotherjimmy |
40:7d3fa6b99b2b | 490 | flags = self.toolchain_flags(toolchain) |
theotherjimmy |
40:7d3fa6b99b2b | 491 | |
theotherjimmy |
40:7d3fa6b99b2b | 492 | # Most GNU ARM Eclipse options have a parent, |
theotherjimmy |
40:7d3fa6b99b2b | 493 | # either debug or release. |
theotherjimmy |
40:7d3fa6b99b2b | 494 | if '-O0' in flags['common_flags'] or '-Og' in flags['common_flags']: |
theotherjimmy |
40:7d3fa6b99b2b | 495 | opts['parent_id'] = 'debug' |
theotherjimmy |
40:7d3fa6b99b2b | 496 | else: |
theotherjimmy |
40:7d3fa6b99b2b | 497 | opts['parent_id'] = 'release' |
theotherjimmy |
40:7d3fa6b99b2b | 498 | |
theotherjimmy |
40:7d3fa6b99b2b | 499 | self.process_options(opts, flags) |
theotherjimmy |
40:7d3fa6b99b2b | 500 | |
theotherjimmy |
40:7d3fa6b99b2b | 501 | opts['c']['defines'] = self.c_defines |
theotherjimmy |
40:7d3fa6b99b2b | 502 | opts['cpp']['defines'] = self.cpp_defines |
theotherjimmy |
40:7d3fa6b99b2b | 503 | opts['as']['defines'] = self.as_defines |
theotherjimmy |
40:7d3fa6b99b2b | 504 | |
theotherjimmy |
40:7d3fa6b99b2b | 505 | self.process_sw_options(opts, flags) |
theotherjimmy |
40:7d3fa6b99b2b | 506 | |
theotherjimmy |
40:7d3fa6b99b2b | 507 | opts['ld']['library_paths'] = [ |
theotherjimmy |
40:7d3fa6b99b2b | 508 | self.filter_dot(s) for s in self.resources.lib_dirs] |
theotherjimmy |
40:7d3fa6b99b2b | 509 | |
theotherjimmy |
40:7d3fa6b99b2b | 510 | opts['ld']['user_libraries'] = libraries |
theotherjimmy |
40:7d3fa6b99b2b | 511 | opts['ld']['system_libraries'] = self.system_libraries |
theotherjimmy |
40:7d3fa6b99b2b | 512 | opts['ld']['script'] = "linker-script-" + id + ".ld" |
theotherjimmy |
40:7d3fa6b99b2b | 513 | |
theotherjimmy |
40:7d3fa6b99b2b | 514 | # Unique IDs used in multiple places. |
theotherjimmy |
40:7d3fa6b99b2b | 515 | uid = {} |
theotherjimmy |
40:7d3fa6b99b2b | 516 | uid['config'] = u.id |
theotherjimmy |
40:7d3fa6b99b2b | 517 | uid['tool_c_compiler'] = u.id |
theotherjimmy |
40:7d3fa6b99b2b | 518 | uid['tool_c_compiler_input'] = u.id |
theotherjimmy |
40:7d3fa6b99b2b | 519 | uid['tool_cpp_compiler'] = u.id |
theotherjimmy |
40:7d3fa6b99b2b | 520 | uid['tool_cpp_compiler_input'] = u.id |
theotherjimmy |
40:7d3fa6b99b2b | 521 | |
theotherjimmy |
40:7d3fa6b99b2b | 522 | opts['uid'] = uid |
theotherjimmy |
40:7d3fa6b99b2b | 523 | |
theotherjimmy |
40:7d3fa6b99b2b | 524 | options[id] = opts |
The Other Jimmy |
35:da9c89f8be7d | 525 | |
The Other Jimmy |
35:da9c89f8be7d | 526 | ctx = { |
The Other Jimmy |
35:da9c89f8be7d | 527 | 'name': self.project_name, |
theotherjimmy |
40:7d3fa6b99b2b | 528 | 'platform': platform, |
theotherjimmy |
40:7d3fa6b99b2b | 529 | 'include_paths': self.include_path, |
theotherjimmy |
43:2a7da56ebd24 | 530 | 'config_header': self.config_header_ref.name, |
theotherjimmy |
40:7d3fa6b99b2b | 531 | 'exclude_paths': '|'.join(self.excluded_folders), |
theotherjimmy |
40:7d3fa6b99b2b | 532 | 'ld_script': ld_script, |
theotherjimmy |
40:7d3fa6b99b2b | 533 | 'library_paths': lib_dirs, |
The Other Jimmy |
35:da9c89f8be7d | 534 | 'object_files': self.resources.objects, |
The Other Jimmy |
35:da9c89f8be7d | 535 | 'libraries': libraries, |
The Other Jimmy |
35:da9c89f8be7d | 536 | 'board_name': self.BOARDS[self.target.upper()]['name'], |
The Other Jimmy |
35:da9c89f8be7d | 537 | 'mcu_name': self.BOARDS[self.target.upper()]['mcuId'], |
theotherjimmy |
40:7d3fa6b99b2b | 538 | 'cpp_cmd': preproc_cmd, |
theotherjimmy |
40:7d3fa6b99b2b | 539 | 'options': options, |
theotherjimmy |
40:7d3fa6b99b2b | 540 | # id property of 'u' will generate new random identifier every time |
theotherjimmy |
40:7d3fa6b99b2b | 541 | # when called. |
theotherjimmy |
40:7d3fa6b99b2b | 542 | 'u': u |
The Other Jimmy |
35:da9c89f8be7d | 543 | } |
The Other Jimmy |
35:da9c89f8be7d | 544 | |
The Other Jimmy |
35:da9c89f8be7d | 545 | self.__gen_dir('.settings') |
theotherjimmy |
40:7d3fa6b99b2b | 546 | self.gen_file('sw4stm32/language_settings_commom.tmpl', |
theotherjimmy |
40:7d3fa6b99b2b | 547 | ctx, '.settings/language.settings.xml') |
The Other Jimmy |
35:da9c89f8be7d | 548 | self.gen_file('sw4stm32/project_common.tmpl', ctx, '.project') |
The Other Jimmy |
35:da9c89f8be7d | 549 | self.gen_file('sw4stm32/cproject_common.tmpl', ctx, '.cproject') |
theotherjimmy |
40:7d3fa6b99b2b | 550 | self.gen_file('sw4stm32/makefile.targets.tmpl', ctx, |
theotherjimmy |
40:7d3fa6b99b2b | 551 | 'makefile.targets', trim_blocks=True, lstrip_blocks=True) |
theotherjimmy |
40:7d3fa6b99b2b | 552 | self.gen_file('sw4stm32/launch.tmpl', ctx, self.project_name + |
theotherjimmy |
40:7d3fa6b99b2b | 553 | ' ' + options['debug']['name'] + '.launch') |
theotherjimmy |
43:2a7da56ebd24 | 554 | |
theotherjimmy |
43:2a7da56ebd24 | 555 | @staticmethod |
theotherjimmy |
43:2a7da56ebd24 | 556 | def clean(_): |
theotherjimmy |
43:2a7da56ebd24 | 557 | shutil.rmtree(".settings") |