1#!/usr/bin/env python3 2# encoding=utf-8 3# ========================================================================= 4# @brief Target Definitions File 5# Copyright (c) 2020 HiSilicon (Shanghai) Technologies CO., LIMITED. 6# Licensed under the Apache License, Version 2.0 (the "License"); 7# you may not use this file except in compliance with the License. 8# You may obtain a copy of the License at 9# 10# http://www.apache.org/licenses/LICENSE-2.0 11# 12# Unless required by applicable law or agreed to in writing, software 13# distributed under the License is distributed on an "AS IS" BASIS, 14# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15# See the License for the specific language governing permissions and 16# limitations under the License. 17# ========================================================================= 18import os 19import copy 20 21codesize_flags = { 22 'ccflags':[ 23 '--short-enums', 24 "-madjust-regorder", 25 "-madjust-const-cost", 26 "-freorder-commu-args", 27 "-fimm-compare-expand", 28 "-frmv-str-zero", 29 "-mfp-const-opt", 30 "-frtl-sequence-abstract", 31 "-frtl-hoist-sink", 32 "-fsafe-alias-multipointer", 33 "-finline-optimize-size", 34 "-fmuliadd-expand", 35 "-mlli-expand", 36 "-Wa,-mcjal-expand", 37 "-foptimize-reg-alloc", 38 "-fsplit-multi-zero-assignments", 39 "-floop-optimize-size", 40 "-Wa,-mlli-relax", 41 "-mpattern-abstract", 42 "-foptimize-pro-and-epilogue", 43 ], 44 'linkflags':[ 45 "-Wl,--cjal-relax", 46 "-Wl,--dslf", 47 ], 48 'rom_ccflags':[ 49 '--short-enums', 50 "-madjust-regorder", 51 "-madjust-const-cost", 52 "-freorder-commu-args", 53 "-fimm-compare-expand", 54 "-frmv-str-zero", 55 "-mfp-const-opt", 56 "-frtl-sequence-abstract", 57 "-frtl-hoist-sink", 58 "-fsafe-alias-multipointer", 59 "-finline-optimize-size", 60 "-fmuliadd-expand", 61 "-mlli-expand", 62 "-Wa,-mcjal-expand", 63 "-foptimize-reg-alloc", 64 "-fsplit-multi-zero-assignments", 65 "-floop-optimize-size", 66 "-foptimize-pro-and-epilogue", 67 "-fno-inline-functions-called-once", 68 "-fno-inline-small-functions", 69 ] 70} 71 72fp_flags = { 73 '-:-mabi=ilp32', '-:-march=rv32imc', '-mabi=ilp32f', '-march=rv32imfc' 74} 75 76target_template = { 77 'target_ws63_app_rom_template': { 78 'chip': 'ws63', 79 'core': 'acore', 80 'arch': 'riscv31', 81 'tool_chain': 'riscv32_musl_100_fp', 82 'board': 'evb', 83 'build_type': 'COMPILE', 84 'CONFIG_TIMER_USING_V150': 'y', 85 'std_libs': ['m', 'c', 'gcc'], 86 'defines': ["SDK_VERSION=\"1.10.101\"", '-:CHIP_WS63=1', 'LIBCPU_UTILS', 'LIBLIB_UTILS', 'LIBPANIC', 'LIBAPP_VERSION', 87 'VERSION_STANDARD', 'LIBBUILD_VERSION', 88 "CONFIG_TIMER_MAX_NUM=3", "CONFIG_TIMER_MAX_TIMERS_NUM_0=0", "CONFIG_TIMER_MAX_TIMERS_NUM_1=6", "CONFIG_TIMER_MAX_TIMERS_NUM_2=4", 89 "CONFIG_TIMER_CLOCK_VALUE=24000000", "CONFIG_TIMER_0_WIDTH_64=0", "CONFIG_ADC_SUPPORT_AUTO_SCAN", "CONFIG_TCXO_WITH_TWO_DATA_REGS", 90 "CONFIG_SFC_SUPPORT_DMA", "CONFIG_SFC_ALREADY_INIT", "USE_WS63_ROM_REPO", "CONFIG_DMA_UART_SUPPORT_V151", 91 "EFUSE_BIT_OPERATION", "USE_ROM_SFC", 'CONFIG_UART_SUPPORT_TX_INT', 92 ], 93 'defines_set': ['libsec_defines', 'chip_defines', 'version_defines'], 94 95 'ram_component': [ 96 'osal', 'osal_adapt', 'common_headers', 'ws63_mem_config', 97 'driver_header', 'security_unified_header', 98 'efuse', 'hal_efuse_v151', 'efuse_port', 99 'tsensor', 'hal_tsensor', 'tsensor_port', 100 'pwm', 'hal_pwm', 'pwm_port', 'app_init', 101 'adc', 'hal_adc', 'adc_port', 102 'dma', 'hal_dma_v151', 'dma_port', 103 'spi', 'hal_spi', 'spi_porting', 104 'sfc_port_ws63', 'sfc_flash_config_ws63', 105 'pmp', 'hal_pmp', 'pmp_port', 106 'dyn_mem', 107 'plat_patch', 'wifi_rom_data', 'bgtp_rom_data', 108 'version_port', 'mac_addr_ws63', 109 'partition', 'partition_ws63', 110 ], 111 'ram_component_set': [ 112 'i2c', 'uart', 'hso_log', 'security_unified', 'dfx_set', 'sio_v151', 'i2s' 113 ], 114 'rom_component': [ 115 'wifi_driver_rom', "wifi_alg_radar_sensor_rom", 116 'sfc_rom', 'hal_sfc_rom', 117 'watchdog_rom', 'hal_watchdog_rom', 'watchdog_port_rom', 118 'pinctrl_rom', 'hal_pinctrl_rom', 'pinctrl_port_ws63_rom', 119 'systick_rom', 'systick_port_rom', 120 'drv_timer_rom', 'hal_timer_rom', 'timer_port_rom', 121 'tcxo_rom', 'hal_tcxo_rom', 'tcxo_port_rom', 122 'libboundscheck_rom', 'version_rom', 123 'bgtp_rom', 'bt_host_rom', 'bg_common_rom', 124 ], 125 'bin_name': 'application', 126 'ccflags': [ 127 *fp_flags, 128 *codesize_flags['ccflags'], 129 ], 130 'linkflags': codesize_flags['linkflags'], 131 'rom_ccflags': [ 132 *fp_flags, 133 *codesize_flags['rom_ccflags'], 134 "-DCONFIG_ROM_COMPILE", 135 "-DINLINE_TO_FORCEINLINE", 136 "-:-Wno-error=main", 137 "-:-Wno-type-limits", 138 "-:-Wno-implicit-fallthrough", 139 "-Wfloat-equal", 140 '-UFPGA_DEBUG', '-UPRE_FPGA', '-UBOARD_FPGA', '-UHI_BOARD_FPGA', '-UBOARD_ASIC' 141 ], 142 'arch': 'riscv31', 143 'build_rom_callback': True, 144 'rom_ram_check': True, 145 'rom_ram_compare': True, 146 'patch': True, 147 'fixed_rom': True, 148 'fixed_rom_path': '<root>/interim_binary/ws63/bin/rom_bin/ws63-liteos_rom.bin', 149 'rom_sym_path': '<root>/drivers/chips/ws63/rom_config/acore/acore.sym', 150 "rom_in_one": True, 151 'pke_rom_bin': True, 152 "fixed_pke": True, 153 "fixed_pke_path": '<root>/interim_binary/ws63/bin/rom_bin/pke_rom.bin', 154 'packet': True, 155 }, 156 'target_ws63_boot_template': { 157 'chip': 'ws63', 158 'core': 'acore', 159 'board': 'evb', 160 'tool_chain': 'riscv32_musl_100', 161 'build_type': 'COMPILE', 162 'os': 'non-os', 163 'std_libs': ['-:m', '-:c', 'gcc'], 164 'defines': ["SDK_VERSION=\"1.10.101\"", 'CHIP_WS63=1', "CONFIG_UART_FIFO_DEPTH=64", "OSAL_NO_PAL", 165 "CONFIG_TIMER_MAX_NUM=3", "CONFIG_TIMER_MAX_TIMERS_NUM_0=0", "CONFIG_TIMER_MAX_TIMERS_NUM_1=6", 166 "CONFIG_TIMER_MAX_TIMERS_NUM_2=4", "CONFIG_TCXO_WITH_TWO_DATA_REGS"], 167 'defines_set': ['libsec_defines'], 168 'ram_component': ['-:port_pinctrl', 'pinctrl_port_ws63', 'driver_header', 'security_unified_header'], 169 'ram_component_set': [], 170 'bin_name': 'boot', 171 'ccflags': ['--short-enums',], 172 'linkflags': [], 173 'arch': 'riscv31', 174 'copy_files_to_interim': True 175 }, 176 'target_ws63_xts_rom_template': { 177 'chip': 'ws63', 178 'core': 'acore', 179 'arch': 'riscv31', 180 'tool_chain': 'riscv32_musl_100_fp', 181 'board': 'evb', 182 'build_type': 'COMPILE', 183 'CONFIG_TIMER_USING_V150': 'y', 184 'std_libs': ['m', 'c', 'gcc', 'atomic'], 185 'defines': ["SDK_VERSION=\"1.10.101\"", '-:CHIP_WS63=1', 'LIBCPU_UTILS', 'LIBLIB_UTILS', 'LIBPANIC', 'LIBAPP_VERSION', 186 'VERSION_STANDARD', 'LIBBUILD_VERSION', 187 "CONFIG_TIMER_MAX_NUM=3", "CONFIG_TIMER_MAX_TIMERS_NUM_0=0", "CONFIG_TIMER_MAX_TIMERS_NUM_1=6", "CONFIG_TIMER_MAX_TIMERS_NUM_2=4", 188 "CONFIG_TIMER_CLOCK_VALUE=24000000", "CONFIG_TIMER_0_WIDTH_64=0", "CONFIG_ADC_SUPPORT_AUTO_SCAN", "CONFIG_TCXO_WITH_TWO_DATA_REGS", 189 "CONFIG_SFC_SUPPORT_DMA", "CONFIG_SFC_ALREADY_INIT", "USE_WS63_ROM_REPO", "CONFIG_DMA_UART_SUPPORT_V151", 190 "EFUSE_BIT_OPERATION", "USE_ROM_SFC", 'CONFIG_UART_SUPPORT_TX_INT', 191 ], 192 'defines_set': ['libsec_defines', 'chip_defines', 'version_defines'], 193 194 'ram_component': [ 195 'osal', 'osal_adapt', 'common_headers', 'ws63_mem_config', 196 'driver_header', 'security_unified_header', 197 'efuse', 'hal_efuse_v151', 'efuse_port', 198 'tsensor', 'hal_tsensor', 'tsensor_port', 199 'pwm', 'hal_pwm', 'pwm_port', 'app_init', 200 'adc', 'hal_adc', 'adc_port', 201 'dma', 'hal_dma_v151', 'dma_port', 202 'spi', 'hal_spi', 'spi_porting', 203 'sfc_port_ws63', 'sfc_flash_config_ws63', 204 'pmp', 'hal_pmp', 'pmp_port', 205 'dyn_mem', 'libboundscheck_sscanf_s', 206 'plat_patch', 'wifi_rom_data', 'bgtp_rom_data', 207 'version_port', 'mac_addr_ws63', 208 'partition', 'partition_ws63', 209 ], 210 'ram_component_set': [ 211 'i2c', 'uart', 'hso_log', 'security_unified', 'dfx_set', 'sio_v151', 'i2s' 212 ], 213 'rom_component': [ 214 'wifi_driver_rom', "wifi_alg_radar_sensor_rom", 215 'sfc_rom', 'hal_sfc_rom', 216 'watchdog_rom', 'hal_watchdog_rom', 'watchdog_port_rom', 217 'pinctrl_rom', 'hal_pinctrl_rom', 'pinctrl_port_ws63_rom', 218 'systick_rom', 'systick_port_rom', 219 'drv_timer_rom', 'hal_timer_rom', 'timer_port_rom', 220 'tcxo_rom', 'hal_tcxo_rom', 'tcxo_port_rom', 221 'libboundscheck_rom', 'version_rom', 222 'bgtp_rom', 'bt_host_rom', 'bg_common_rom', 223 ], 224 'bin_name': 'application', 225 'ccflags': [ 226 *fp_flags, 227 *codesize_flags['ccflags'], 228 ], 229 'linkflags': codesize_flags['linkflags'], 230 'rom_ccflags': [ 231 *fp_flags, 232 *codesize_flags['rom_ccflags'], 233 "-DCONFIG_ROM_COMPILE", 234 "-DINLINE_TO_FORCEINLINE", 235 "-:-Wno-error=main", 236 "-:-Wno-type-limits", 237 "-:-Wno-implicit-fallthrough", 238 "-Wfloat-equal", 239 '-UFPGA_DEBUG', '-UPRE_FPGA', '-UBOARD_FPGA', '-UHI_BOARD_FPGA', '-UBOARD_ASIC' 240 ], 241 'arch': 'riscv31', 242 'build_rom_callback': True, 243 'rom_ram_check': True, 244 'rom_ram_compare': True, 245 'patch': True, 246 'fixed_rom': True, 247 'fixed_rom_path': '<root>/interim_binary/ws63/bin/rom_bin/ws63-liteos_rom.bin', 248 'rom_sym_path': '<root>/drivers/chips/ws63/rom_config/acore/acore.sym', 249 "rom_in_one": True, 250 'pke_rom_bin': True, 251 "fixed_pke": True, 252 "fixed_pke_path": '<root>/interim_binary/ws63/bin/rom_bin/pke_rom.bin', 253 'packet': True, 254 }, 255} 256