1#!/usr/bin/env python3 2# encoding=utf-8 3# ============================================================================ 4# @brief common config of build system 5 6# Copyright (c) 2020 HiSilicon (Shanghai) Technologies CO., LIMITED. 7# Licensed under the Apache License, Version 2.0 (the "License"); 8# you may not use this file except in compliance with the License. 9# You may obtain a copy of the License at 10# 11# http://www.apache.org/licenses/LICENSE-2.0 12# 13# Unless required by applicable law or agreed to in writing, software 14# distributed under the License is distributed on an "AS IS" BASIS, 15# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16# See the License for the specific language governing permissions and 17# limitations under the License. 18# ============================================================================ 19 20 21component_set = { 22 'boot_rom': ['hw_sec', 'non_os_libc', 'non_os_isr', 'non_os_osal'], 23 'libra_public': ['libra_device'], 24 'std_common_lib': [ 25 "app_version", "build_version", "testsuite", "common_headers", "connectivity", 26 "cpu_load", "cpu_utils", "irmalloc", "lib_utils", "dfx_log", "dfx_log_reader", 27 "dfx_panic", "dfx_preserve", 28 ], 29 "ssb_libs": ["codeloader_ssb", "lib_utils", "jlink_load", "algorithm"], 30 'boot_common_lib': [ 31 "bootloader", "codeloader", "build_version", "common_headers", 'app_version', 32 "cpu_utils", "irmalloc", "dfx_panic", "dfx_preserve", 'error_code', 33 ], 34 'sec': ['hal_sec_common', 'hal_sec_sha', 'hal_sec_trng2', 'hal_sectors', 35 'sec_common', 'sec_rsa', 'sec_sha', 'sec_trng', "sec_port", "sec_rsa_port",], 36 'security': ['hal_hash', 'hash', 'hash_port', 'hal_trng', 'trng', 'trng_port', 'hal_pke', 37 'pke', 'pke_port', 'hal_cipher', 'cipher', 'cipher_port', 'hal_km', 'km', 'km_port'], 38 'mem': ['memory_core'], 39 'mem_monitor': ['mem_monitor', 'hal_mem_monitor', 'mem_monitor_port'], 40 'cpu': ['hal_cpu_core', 'reboot', 'hal_reg_config', 'hal_reboot', 'reboot_port'], 41 'can': ['can', 'hal_can', 'can_port'], 42 'watchdog': ['watchdog', 'hal_watchdog', 'watchdog_port'], 43 'reboot_set':['reboot', 'hal_reboot', 'reboot_port'], 44 'uart': ['hal_uart', 'uart', 'uart_port'], 45 'xip_os': ['hal_xip', 'xip_port'], 46 'xip_nonos': ['hal_xip', 'xip_port'], 47 'adc': ['hal_adc', 'adc', 'adc_port'], 48 'ipc': ['hal_ipc_old', 'ipc_old'], 49 'spi_os': ['hal_spi', 'spi_cmsis'], 50 'spi_nonos': ['hal_spi', 'spi_nonos'], 51 'sfc_flash_old': ['sfc_old', 'hal_sfc_old'], 52 'sfc_flash': ['sfc', 'hal_sfc'], 53 'dma': ['hal_dma_v100', 'dma', 'dma_port'], 54 'dmav151': ['hal_dma_v151', 'dma', 'dma_port'], 55 'dmav120': ['hal_dma_v120', 'dma', 'dma_port'], 56 'button': ['button', 'button_port'], 57 'epmu': ['epmu', 'epmu_port'], 58 'spi': ['spi', 'hal_spi', 'spi_porting'], 59 'lpc': ['hal_lpc', 'lpc'], 60 'otp': ['hal_otp', 'otp'], 61 'i2c': ['hal_i2c', 'i2c', 'i2c_porting'], 62 'pwm': ['hal_pwm', 'pwm', "pwm_port",], 63 'mmc': ['hal_mmc', 'mmc'], 64 'gpio_v150': ['hal_gpio_v150', 'gpio', "gpio_port"], 65 'gpio_v100': ['hal_gpio_v100', 'gpio', "gpio_port"], 66 'qspi': ['hal_qspi', 'qspi'], 67 'hso_log': ["dfx_log", "dfx_log_reader"], 68 'qdec' : ['hal_qdec', 'qdec', "qdec_port"], 69 'keyscan' : ['hal_keyscan', 'keyscan', "keyscan_port"], 70 'usb' : ["usb", "hal_usb", "usb_port"], 71 'usb_unified' : ['usb_unified', 'usb_unified_open', 'usb_unified_port'], 72 'pdm' : ['pdm', 'hal_pdm', "pdm_porting", "test_pdm"], 73 'embed_flash' : ['eflash', 'hal_eflash', 'eflash_port'], 74 'i2s' : ["i2s"], 75 'flash' : ["flash", "flash_porting"], 76 'sio_v150' : ['hal_sio', 'sio_port'], 77 'sio_v151' : ['hal_sio', 'sio_port'], 78 'cpu_trace': ['hal_cpu_trace', 'cpu_trace'], 79 'sdio_slave': ['sdio', 'hal_sdio', 'sdio_port'], 80 'time_set': ['systick', 'tcxo', 'drv_timer', 'hal_systick', 'hal_tcxo', 'hal_timer', 'rtc_unified', 'hal_rtc_unified', 'rtc_unified_port', 'timer_port', 'systick_port', 'tcxo_port'], 81 'systick_set':['systick', 'hal_systick', 'systick_port'], 82 'tcxo_set':['tcxo', 'hal_tcxo', 'tcxo_port'], 83 'rtc_unified': ['rtc_unified', 'hal_rtc_unified', 'rtc_unified_port'], 84 'local_stdlib': ['c', 'm', 'posix'], 85 'audio': ['audio_api', 'audio_core', 'audio_drv', 'audio_sample', 'audio_vendor'], 86 'bgh': ['bt_host_brandy_service', 'bt_host_brandy_sample', 'bt_host_sdk'], 87 'bgh-master': ['bt_app', 'bth_sample', 'bth_sdk', 'bg_common', 'bth_audio_manager_wrapper'], 88 'bgh_audio': ['bt_host_audio_manager_wrapper'], 89 'media': ['audio_capture', 'audio_manager', 'audio_service', 'audio_stream', 'audio_utils', 90 'media_sample_wrapper', 'player', 'media_common', 'audio_bluetooth_port', 'audio_hw', 91 'audio_primary_port','format_hw', 'hmf_demuxer', 'media_hal_common', 'plugin_demuxer_hmf', 92 'plugin_demuxer_mjpeg', 'plugin_protocol_https', 'audio_port_common', 'codec_hw', 'codec_plugin_vdec', 93 'camera_codec_hw', 'hdi_camera_intf', 'plugin_demuxer_raw', 'audio_modem_port'], 94 'media_melody': ['audio_manager', 'audio_service', 'audio_stream', 'audio_utils', 95 'media_common', 'audio_bluetooth_port', 'audio_hw', 96 'audio_primary_port', 'media_hal_common', 'audio_port_common', 'haid_manager', 'tone_player', 'tws_manager'], 97 'media_mini': ['audio_capture', 'audio_manager', 'audio_service', 'audio_stream', 'audio_utils', 98 'media_sample_wrapper', 'player', 'media_common', 'audio_bluetooth_port', 'audio_hw', 99 'audio_primary_port','format_hw', 'hmf_demuxer', 'media_hal_common', 'plugin_demuxer_hmf', 100 'plugin_demuxer_mjpeg', 'plugin_protocol_https', 'audio_port_common', 'plugin_demuxer_raw'], 101 'media_target4': ['audio_manager', 'audio_service', 'audio_stream', 'audio_utils', 'media_common', 'audio_hw', 102 'audio_primary_port', 'audio_bluetooth_port', 'audio_modem_port', 'media_hal_common', 103 'audio_port_common', 'media_sample_wrapper'], 104 'gpu': ['gfx_rm', 'gpu'], 105 'gpu_test': ['test_gpu'], 106 'graphic_uikit': ['cjson_static', 'display_gfx', 'display_gralloc', 'display_layer', 'graphic_input', 'graphic_service', 107 'freetype_static', 'graphic_ui', 'graphic_utils', 'qrcodegen', 'icu4c', 'harfbuzz', 'uikit_ext'], 108 'graphic_lvgl': ['display_gfx', 'display_gralloc', 'display_layer', 'graphic_input', 'freetype_static', 109 'lvgl', 'lvgl_sample', 'lvgl_demos', 'lvgl_proprietary', 'lvgl_service'], 110 'graphic_lvgl_mini': ['display_gfx', 'display_gralloc', 'display_layer', 'graphic_input', 'freetype_static', 111 'lvgl', 'lvgl_sample', 'lvgl_demos', 'lvgl_proprietary_mini', 'lvgl_service'], 112 'graphic_test': ['uikit_test'], 113 'calendar': ['calendar', 'hal_calendar', 'calendar_port'], 114 'update_app': ['update_common', 'update_storage', 'update_local', 'update_storage_brandy', 'update_common_brandy', 'lzma_21.07'], 115 'update_recovery': ['update_common', 'update_local', 'update_common_brandy', 'lzma_21.07'], 116 'pinctrl': ['pinctrl', 'hal_pinctrl', 'port_pinctrl'], 117 'pmp_set': ['pmp', 'hal_pmp', 'pmp_port'], 118 'mips': ['mips', 'hal_mips'], 119 'dfx_set': ['dfx_diag', "diag_dfx_cmd", 'dfx_panic', 'dfx_preserve', 'dfx_log', 'dfx_log_reader', 'dfx_exception', 'log_file', 'soc_log'], 120 'app_ux': ['ux_audio', 'ux_bt', 'ux_commu', 'ux_sensor', 'ux_spp', 'ux_cmn_header', 'ux_common'], 121 'pm_set': ['pm', 'pm_porting', 'pm_sleep', 'pm_sleep_porting', 'pm_veto', 'pm_veto_porting', 'pm_dev', 'pm_dev_porting', 'pm_fsm', 'pm_fsm_porting'], 122 'pm_pmu_set': ['pm_pmu', 'pm_pmu_porting'], 123 'pm_clock_set': ['pm_clock', 'pm_clock_porting'], 124 'ux_manager': ['fsm_box', 'fsm_master', 'fsm_pairing', 'ux_event', 'ux_earphone', 'ux_timer', 'ux_tone_config', 'ux_tone_service', 'ux_led_porting', 'ux_led_config', 125 'ux_led_frame', 'ux_master', 'at_ux_manager', 'at_ux_register', 'ux_voiceassistant', 'ux_feature'], 126 'ux_module': ['ux_box', 'ux_button', 'ux_pairing', 'ux_touchpad', 'ux_charge'], 127 'security_unified': ['hal_security_unified', 'drv_security_unified', 'security_unified_port'], 128 'efuse_v151': ['efuse_port', 'hal_efuse_v151', 'efuse'], 129 'efuse_v120': ['efuse', 'hal_efuse_v120', 'efuse_porting'], 130 'efuse_v100': ['efuse', 'hal_efuse_v100', 'efuse_porting'], 131 'efuse_v130': ['efuse', 'hal_efuse_v130', 'efuse_port'], 132 'codec_set': ['l2hc_dec_16k', 'l2hc_dec_48k_10ms', 'l2hc_dec_48k_5ms', 133 'opus_dec_half_itcm', 'opus_dec_half_flash', 'opus_dec_all_itcm', 'opus_dec_all_flash', 134 'opus_enc_half_itcm', 'opus_enc_half_flash', 'opus_enc_all_itcm', 'opus_enc_all_flash', 135 'opus_enc_2.5ms_itcm', 'opus_enc_2.5ms_flash', 'l2hc_enc_16k', 'l2hc_enc_48k_10ms','l2hc_enc_48k_5ms', 136 'sbc_dec_half_itcm', 'sbc_dec_half_flash', 'sbc_dec_all_itcm', 'sbc_dec_all_flash', 137 'sbc_enc_half_itcm', 'sbc_enc_half_flash', 'sbc_enc_all_itcm', 'sbc_enc_all_flash'], 138 'ohos_set' : ['bootstrap', 'samgr', 'ams', 'bms', 'bms_sign_mode', 'ace', 'ace_adapt', 'permission', 'appverify', 'jerryscript','js_player', 'js_audio_captuer','i18n', 'resmgr', 'syspara'], 139 'wearable_set' : ['nativeabilityfwk', 'nativelauncher', 'ai_voice_service', 'ai_voice_engine_hal', 'ai_voice_audio_stream_wrapper', 'ohos_deps', 140 'broadcast', 'msg_center', 'msg_center_adapt', 'ohos_startup'], 141} 142 143defines_set = { 144 'libsec_defines': [ 145 "SECUREC_HAVE_WCTOMB=0", "SECUREC_HAVE_MBTOWC=0", 146 "SECUREC_ENABLE_SCANF_FLOAT=0", "SECUREC_ENABLE_SPRINTF_FLOAT=0"], 147 'chip_defines': [ 148 "BS25_CHIP_FPGA=0", "BS25_CHIP_V100=0", "BRANDY_CHIP_FPGA=0", "BRANDY_CHIP_V100=0", "SOCMN1_CHIP_FPGA=0", 149 "SOCMN1_CHIP_V100=0", "SOCMN1_CHIP_V200=0", "LIBRA_CHIP_CS=0", "LIBRA_CHIP_FPGA=0", "SW39_CHIP_FPGA=0", 150 "TARGET_CHIP_BS25=0", "TARGET_CHIP_BRANDY=0", "TARGET_CHIP_SOCMN1=0", "TARGET_CHIP_SW39=0", 151 "TARGET_CHIP_LIBRA=0", "CHIP=1", "CHIP_VERSION=1", "CHIP_WS63=0", "SW21_CHIP_FPGA=0", 152 "TARGET_CHIP_SW21=0", "CHIP_WS53=0", "CONFIG_UART_SUPPORT_TX", "CONFIG_UART_SUPPORT_RX", 153 "CHIP_BS20=0", "CHIP_BS21=0", "CHIP_BS21A=0", "CHIP_BS21E=0", "CHIP_BS22=0", "CHIP_BS26=0", 154 ], 155 'version_defines': [], 156 'libepmu_defines':['EPMU_BUCK_LDO_EN', 'EPMU_RTC_EN', 'EPMU_PWR_KEY_EN', 'EPMU_GPIO_EN', 'EPMU_WDT_EN', 'EPMU_EXTEND_EN'], 157} 158 159common_ccflags = [ 160 '-std=gnu99', 161 '-Wall', 162 '-Werror', 163 '-Wextra', 164 '-Winit-self', 165 '-Wpointer-arith', 166 '-Wstrict-prototypes', 167 '-Wno-type-limits', 168 '-fno-strict-aliasing', 169 '-Os', 170 '-fno-unwind-tables', 171] 172 173common_linkflags = [ 174 '-Wl,--gc-section', 175 '-nostdlib', 176 '-static', 177] 178 179arch_config = { 180 'riscv70': { 181 'ccflags': [ 182 '--target=riscv32', 183 '-march=rv32imfcxlinxma_xlinxmb_xlinxmc', 184 '-mabi=ilp32f', 185 '-ffunction-sections', 186 '-fdata-sections', 187 '-fno-common', 188 '-fsigned-char', 189 '-fstack-protector-strong', 190 '-mllvm', 191 '-allow-unalign-ldst=false', 192 "-Wno-error=out-of-line-declaration", 193 "-Wno-error=uninitialized", 194 "-Wno-error=int-conversion", 195 "-Wno-error=enum-conversion", 196 "-Wno-error=long-long", 197 "-Wno-unused-variable", 198 "-Wno-error=unused-variable", 199 "-Wno-error=unused-value", 200 "-Wno-error=unused-function", 201 "-Wno-error=sign-compare", 202 "-Wno-error=unused-parameter", 203 "-Wno-error=tautological-compare", 204 "-Wno-error=bad-function-cast", 205 "-Wno-error=incompatible-pointer-types", 206 "-Wno-error=implicit-function-declaration", 207 "-Wno-missing-braces", 208 "-Wno-main-return-type", 209 "-Wno-unused-command-line-argument", 210 "-Wno-undef", 211 '-g', 212 ], 213 'linkflags': [ 214 '-Wl,--gc-section,--cref,-M', 215 '-static', 216 '-nostdlib', 217 '--target=riscv32', 218 ], 219 'rom_ccflags': [ 220 '--target=riscv32', 221 '-march=rv32imfcxlinxma_xlinxmb_xlinxmc', 222 '-mabi=ilp32f', 223 '-ffunction-sections', 224 '-fdata-sections', 225 '-fno-common', 226 '-fsigned-char', 227 '-Wno-error=main' 228 "-Wno-error=out-of-line-declaration", 229 "-Wno-error=uninitialized", 230 "-Wno-error=int-conversion", 231 "-Wno-error=enum-conversion", 232 "-Wno-error=long-long", 233 "-Wno-unused-variable", 234 "-Wno-error=unused-variable", 235 "-Wno-error=unused-value", 236 "-Wno-error=unused-function", 237 "-Wno-error=sign-compare", 238 "-Wno-error=unused-parameter", 239 "-Wno-error=tautological-compare", 240 "-Wno-error=bad-function-cast", 241 "-Wno-error=incompatible-pointer-types", 242 "-Wno-error=implicit-function-declaration", 243 "-Wno-missing-braces", 244 "-Wno-main-return-type", 245 "-Wno-unused-command-line-argument", 246 "-Wno-undef", 247 "-g" 248 ], 249 'std_libs': [ 250 ] 251 }, 252 253 'riscv32': { 254 'ccflags': [ 255 '--target=riscv32', 256 '-march=rv32imc_xlinxma_xlinxmb_xlinxmc_xlinxmd', 257 '-mabi=ilp32', 258 '-ffunction-sections', 259 '-fdata-sections', 260 '-fno-common', 261 '-fsigned-char', 262 '-fstack-protector-strong', 263 '-mllvm', 264 '-allow-unalign-ldst=false', 265 "-Wno-error=out-of-line-declaration", 266 "-Wno-error=uninitialized", 267 "-Wno-error=int-conversion", 268 "-Wno-error=enum-conversion", 269 "-Wno-error=long-long", 270 "-Wno-unused-variable", 271 "-Wno-error=unused-variable", 272 "-Wno-error=unused-value", 273 "-Wno-error=unused-function", 274 "-Wno-error=sign-compare", 275 "-Wno-error=unused-parameter", 276 "-Wno-error=tautological-compare", 277 "-Wno-error=bad-function-cast", 278 "-Wno-error=incompatible-pointer-types", 279 "-Wno-error=implicit-function-declaration", 280 "-Wno-missing-braces", 281 "-Wno-main-return-type", 282 "-Wno-unused-command-line-argument", 283 "-Wno-undef", 284 '-g', 285 ], 286 'linkflags': [ 287 '-Wl,--gc-section,--cref,-M', 288 '-static', 289 '-nostdlib', 290 '--target=riscv32', 291 ], 292 'rom_ccflags': [ 293 '--target=riscv32', 294 '-march=rv32imc_xlinxma_xlinxmb_xlinxmc_xlinxmd', 295 '-mabi=ilp32', 296 '-ffunction-sections', 297 '-fdata-sections', 298 '-fno-common', 299 '-fsigned-char', 300 '-Wno-error=main' 301 "-Wno-error=out-of-line-declaration", 302 "-Wno-error=uninitialized", 303 "-Wno-error=int-conversion", 304 "-Wno-error=enum-conversion", 305 "-Wno-error=long-long", 306 "-Wno-unused-variable", 307 "-Wno-error=unused-variable", 308 "-Wno-error=unused-value", 309 "-Wno-error=unused-function", 310 "-Wno-error=sign-compare", 311 "-Wno-error=unused-parameter", 312 "-Wno-error=tautological-compare", 313 "-Wno-error=bad-function-cast", 314 "-Wno-error=incompatible-pointer-types", 315 "-Wno-error=implicit-function-declaration", 316 "-Wno-missing-braces", 317 "-Wno-main-return-type", 318 "-Wno-unused-command-line-argument", 319 "-Wno-undef", 320 "-g" 321 ], 322 'std_libs': [ 323 ] 324 }, 325 'cortex_m7':{ 326 'ccflags': [ 327 '-fomit-frame-pointer', 328 '-ffreestanding', 329 '-fdata-sections', 330 '-ffunction-sections', 331 '-specs=nano.specs', 332 '-nostdlib', 333 '-pipe', 334 '-mno-unaligned-access', 335 "-fdebug-types-section", 336 '-Wtrampolines', 337 '-Wlogical-op', 338 '-funsigned-char', 339 '-Wformat=2', 340 '-Wdate-time', 341 #'-Wshadow', 342 '-Wno-return-local-addr', 343 #'-Wconversion', 344 #'-Wcast-align', 345 '-Wfloat-equal', 346 #'-Wswitch-default', 347 '-Wvla', 348 '-Wjump-misses-init', 349 '-march=armv7-m', 350 '-mfpu=fpv5-d16', 351 '-mthumb', 352 '--specs=nosys.specs', 353 '-Wno-incompatible-pointer-types', 354 '-Wno-sign-compare', 355 "-Wno-error=enum-conversion", 356 357 "-Wno-error=uninitialized", 358 "-Wno-error=int-conversion", 359 "-Wno-error=long-long", 360 "-Wno-unused-variable", 361 "-Wno-error=unused-variable", 362 "-Wno-error=unused-value", 363 "-Wno-error=unused-function", 364 "-Wno-error=sign-compare", 365 "-Wno-error=unused-parameter", 366 "-Wno-error=tautological-compare", 367 "-Wno-error=bad-function-cast", 368 "-Wno-error=cast-function-type", 369 "-Wno-error=discarded-qualifiers", 370 "-Wno-error=missing-field-initializers", 371 "-Wno-error=incompatible-pointer-types", 372 "-Wno-error=implicit-function-declaration", 373 "-Wno-missing-braces", 374 '-Wno-implicit-function-declaration' 375 ], 376 'linkflags': [ 377 '-Wl,--gc-section,--cref,--relax,-M', 378 '-mthumb', 379 '-flto=16', 380 '-march=armv7-m', 381 '-nostdlib' 382 ], 383 'rom_ccflags': [ 384 '-fomit-frame-pointer', 385 '-ffreestanding', 386 '-fdata-sections', 387 '-ffunction-sections', 388 '-specs=nano.specs', 389 '-nostdlib', 390 '-pipe', 391 '-mno-unaligned-access', 392 '-mthumb', 393 "-fdebug-types-section", 394 '-Wtrampolines', 395 '-Wlogical-op', 396 '-Wjump-misses-init', 397 '-march=armv7-m', 398 '-fno-inline-functions-called-once', 399 '-fno-inline-small-functions', 400 '--specs=nosys.specs', 401 ], 402 'std_libs': [ 403 ] 404 }, 405 'riscv31': { 406 'ccflags': [ 407 '-ffreestanding', 408 '-fdata-sections', 409 '-Wno-implicit-fallthrough', 410 '-ffunction-sections', 411 '-nostdlib', 412 '-pipe', 413 '-mabi=ilp32', 414 '-march=rv32imc', 415 '-fno-tree-scev-cprop', 416 '-fno-common', 417 '-mpush-pop', 418 '-msmall-data-limit=0', 419 '-fno-ipa-ra', 420 '-Wtrampolines', 421 '-Wlogical-op', 422 '-Wjump-misses-init', 423 "-Wa,-enable-c-lbu-sb", 424 "-Wa,-enable-c-lhu-sh", 425 "-fimm-compare", 426 "-femit-muliadd", 427 "-fmerge-immshf", 428 "-femit-uxtb-uxth", 429 "-femit-lli", 430 "-femit-clz", 431 "-fldm-stm-optimize", 432 '-g', 433 ], 434 'linkflags': [ 435 "-Wl,--enjal16", 436 "-nostdlib", 437 "-g", 438 ], 439 'rom_ccflags': [ 440 '-ffreestanding', 441 '-fdata-sections', 442 '-Wno-implicit-fallthrough', 443 '-ffunction-sections', 444 '-nostdlib', 445 '-pipe', 446 '-mabi=ilp32', 447 '-march=rv32imc', 448 '-fno-tree-scev-cprop', 449 '-fno-common', 450 '-mpush-pop', 451 '-msmall-data-limit=0', 452 '-fno-ipa-ra', 453 '-Wtrampolines', 454 '-Wlogical-op', 455 '-Wjump-misses-init', 456 "-Wa,-enable-c-lbu-sb", 457 "-Wa,-enable-c-lhu-sh", 458 "-fimm-compare", 459 "-femit-muliadd", 460 "-fmerge-immshf", 461 "-femit-uxtb-uxth", 462 "-femit-lli", 463 "-femit-clz", 464 "-fldm-stm-optimize", 465 "-g", 466 ], 467 'std_libs': [ 468 'gcc', 'm', 'c' 469 ] 470 }, 471} 472 473arch_family = { 474 "arm": [ 475 "cortex_m7", "cortex_m3" 476 ], 477 "riscv": [ 478 "riscv70", "riscv31", "riscv32" 479 ], 480} 481 482 483class CommonConfig: 484 def __init__(self, arch): 485 self.arch_config = arch_config[arch] 486 self.arch_family = '' 487 for arch_family_name in arch_family: 488 if arch in arch_family[arch_family_name]: 489 self.arch_family = arch_family_name 490 if not self.arch_family: 491 raise Exception(f"{arch} is not found in arch_family, please add it") 492 493 def get_ram_ccflags(self): 494 temp = [] 495 temp.extend(common_ccflags) 496 temp.extend(self.arch_config['ccflags']) 497 return temp 498 499 def get_rom_ccflags(self): 500 return common_ccflags + self.arch_config['rom_ccflags'] 501 502 def get_definse(self, set_name): 503 try: 504 return defines_set[set_name] 505 except KeyError: 506 print(f"{set_name} is not in defines_set!!") 507 raise 508 509 def get_linkflags(self): 510 return common_linkflags + self.arch_config['linkflags'] 511 512 def get_std_libs(self): 513 return self.arch_config['std_libs'] 514 515 def get_arch_family(self): 516 return self.arch_family 517 518 def get_component_set(self, set_name): 519 try: 520 return component_set[set_name] 521 except KeyError: 522 print(f"{set_name} is not in component_set!!") 523 raise 524