1# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. 2# Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved. 3# 4# Redistribution and use in source and binary forms, with or without modification, 5# are permitted provided that the following conditions are met: 6# 7# 1. Redistributions of source code must retain the above copyright notice, this list of 8# conditions and the following disclaimer. 9# 10# 2. Redistributions in binary form must reproduce the above copyright notice, this list 11# of conditions and the following disclaimer in the documentation and/or other materials 12# provided with the distribution. 13# 14# 3. Neither the name of the copyright holder nor the names of its contributors may be used 15# to endorse or promote products derived from this software without specific prior written 16# permission. 17# 18# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 22# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 25# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 27# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 28# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 30mainmenu "Huawei LiteOS Configuration" 31 32menu "Compiler" 33choice 34 prompt "Compiler type" 35 default COMPILER_GCC 36 help 37 Choose compiler type. 38 39config COMPILER_GCC 40 bool "GCC" 41 42config COMPILER_CLANG_LLVM 43 bool "Clang" 44 45config COMPILER_ICCARM 46 bool "ICCARM" 47 48endchoice 49 50config COMPILE_DEBUG 51 bool "Enable debug options" 52 default n 53 help 54 Answer Y to add -g option in compile command. 55 56config COMPILE_OPTIMIZE 57 bool "Enable code optimization options" 58 default y 59 help 60 Answer Y to add optimization options for efficient code. 61 The final binary size will be smaller and execute faster. 62 But the debugging experience may be worst somehow. 63 64config COMPILE_OPTIMIZE_SIZE 65 bool "Enable code size optimization options" if COMPILE_OPTIMIZE 66 default y 67 help 68 Answer Y to add optimization options for small code size. 69 The final binary size will be smaller. 70 But the compile time may be a bit longer. 71 72config COMPILE_LTO 73 bool "Enable link time optimization (LTO)" if COMPILE_OPTIMIZE_SIZE 74 default y 75 help 76 Answer Y to add lto options for more smaller code size. 77 The final binary size will be smaller. 78 But the compile time may be much longer. 79 80endmenu 81 82menu "Platform" 83 84######################### config options of bsp ##################### 85config PLATFORM 86 string 87 default "virt" if PLATFORM_QEMU_ARM_VIRT_CM7 || PLATFORM_QEMU_ARM_VIRT_CM4 || PLATFORM_QEMU_ARM_VIRT_CM55 || PRODUCT_QEMU_RISCV32_VIRT || PLATFORM_QEMU_CSKY_SMARTL || PLATFORM_QEMU_XTENSA_ESP32 88 89config DEVICE_COMPANY 90 string 91 default "qemu" if PLATFORM_QEMU_ARM_VIRT_CM7 || PLATFORM_QEMU_ARM_VIRT_CM4 || PLATFORM_QEMU_ARM_VIRT_CM55 || PRODUCT_QEMU_RISCV32_VIRT || PLATFORM_QEMU_CSKY_SMARTL || PLATFORM_QEMU_XTENSA_ESP32 92 93choice 94 prompt "Chip" 95 default PLATFORM_QEMU_ARM_VIRT_CM7 96 help 97 Qemu ARM Virt variants (based on different CPU types): 98 - qemu_arm_virt_cm7 99 - qemu_arm_virt_cm4 100 - qemu_riscv32_virt 101 - qemu_csky_smartl 102 - qemu_xtensa_esp32 103 104config PLATFORM_QEMU_ARM_VIRT_CM7 105 bool "qemu_arm_virt_cm7" 106 select ARCH_CORTEX_M7 107 help 108 QEMU ARM Virtual Platform using Cortex-M7 CPU. 109 110config PLATFORM_QEMU_ARM_VIRT_CM4 111 bool "qemu_arm_virt_cm4" 112 select ARCH_CORTEX_M4 113 help 114 QEMU ARM Virtual Platform using Cortex-M4 CPU. 115 116config PLATFORM_QEMU_ARM_VIRT_CM55 117 bool "qemu_arm_virt_cm55" 118 select ARCH_CORTEX_M55 119 help 120 QEMU ARM Virtual Platform using Cortex-M55 CPU. 121 122config PLATFORM_QEMU_RISCV32_VIRT 123 bool "qemu_riscv32_virt" 124 select ARCH_RISCV32 125 help 126 QEMU RISCV Virtual Platform using riscv32 CPU. 127 128config PLATFORM_QEMU_CSKY_SMARTL 129 bool "qemu_csky_smartl" 130 select ARCH_CSKY 131 help 132 QEMU SmartL Virtual Platform using csky CPU. 133 134config PLATFORM_QEMU_XTENSA_ESP32 135 bool "qemu_xtensa_esp32" 136 select ARCH_XTENSA 137 help 138 QEMU ESP32 Virtual Platform using xtensa CPU. 139 140endchoice 141 142choice 143 prompt "Product" 144 help 145 Select your target board. 146 147config PRODUCT_QEMU_RISCV32_VIRT 148 bool "riscv32_virt" if PLATFORM_QEMU_RISCV32_VIRT 149 150endchoice 151 152 153######################### config options of cpu arch ################ 154source "arch/Kconfig" 155 156# Device Kconfig import 157osource "$(DEVICE_PATH)/Kconfig" 158 159config SOC_COMPANY 160 string "SoC company name to locate soc build path" 161 help 162 This option specifies the SoC company name, used to locate the build path for soc. This option is set by the 163 SoC's Kconfig file, and should be exactly the same with SoC company path, and the user should generally avoid 164 modifying it via the menu configuration. 165 166orsource "../../device/board/*/Kconfig.liteos_m.shields" 167 168orsource "../../device/board/$(BOARD_COMPANY)/Kconfig.liteos_m.defconfig.boards" 169 170choice 171 prompt "Board Selection" 172 173orsource "../../device/board/$(BOARD_COMPANY)/Kconfig.liteos_m.boards" 174 175endchoice 176 177orsource "../../device/soc/*/Kconfig.liteos_m.defconfig" 178 179choice 180 prompt "SoC Series Selection" 181 182orsource "../../device/soc/*/Kconfig.liteos_m.series" 183 184endchoice 185 186orsource "../../device/soc/*/Kconfig.liteos_m.soc" 187 188endmenu 189 190######################### config options of kernel ##################### 191menu "Kernel" 192 193######################### config options of extended ##################### 194 195config KERNEL_EXTKERNEL 196 bool "Enable Extend Kernel" 197 default y 198 help 199 This option will enable extend Kernel of LiteOS. Extend kernel include 200 cppsupport, cpup, etc. You can select one or some 201 of them. 202 203config KERNEL_BACKTRACE 204 bool "Enable Backtrace" 205 default n 206 depends on KERNEL_EXTKERNEL 207 help 208 If you wish to build LiteOS with support for backtrace. 209 210choice 211 prompt "Select Backtrace Type" 212 depends on KERNEL_BACKTRACE 213 214config BACKTRACE_TYPE_1 215 bool "1: Call stack analysis for cortex-m series by scanning the stack" 216 depends on ARCH_ARM && !ARCH_ARM9 217 218config BACKTRACE_TYPE_2 219 bool "2: Call stack analysis for risc-v by using frame pointer" 220 depends on ARCH_RISCV 221 222config BACKTRACE_TYPE_3 223 bool "3: Call stack analysis for risc-v by scanning the stack" 224 depends on ARCH_RISCV 225 226config BACKTRACE_TYPE_4 227 bool "4: Call stack analysis for xtensa by scanning the stack" 228 depends on ARCH_XTENSA 229 230config BACKTRACE_TYPE_5 231 bool "5: Call stack analysis for c-sky by scanning the stack" 232 depends on ARCH_CSKY 233 234config BACKTRACE_TYPE_6 235 bool "6: Call stack analysis for arm9 by scanning the stack" 236 depends on ARCH_ARM9 237 238endchoice 239 240config BACKTRACE_TYPE 241 int 242 default 0 if ! KERNEL_BACKTRACE 243 default 1 if BACKTRACE_TYPE_1 244 default 2 if BACKTRACE_TYPE_2 245 default 3 if BACKTRACE_TYPE_3 246 default 4 if BACKTRACE_TYPE_4 247 default 5 if BACKTRACE_TYPE_5 248 default 6 if BACKTRACE_TYPE_6 249 250config BACKTRACE_DEPTH 251 int "Backtrace depth" 252 default 15 253 depends on KERNEL_BACKTRACE 254 255config KERNEL_CPPSUPPORT 256 bool "Enable C++ Support" 257 default n 258 depends on KERNEL_EXTKERNEL 259 help 260 If you wish to build LiteOS with support for C++. 261 262rsource "components/signal/Kconfig" 263 264config BASE_CORE_CPUP 265 bool 266 default n 267 268config KERNEL_CPUP 269 bool "Enable Cpup" 270 default n 271 depends on KERNEL_EXTKERNEL 272 select BASE_CORE_CPUP 273 help 274 If you wish to build LiteOS with support for cpup. 275 276config CPUP_INCLUDE_IRQ 277 bool "Enable Cpup include irq" 278 default y 279 depends on KERNEL_CPUP 280 help 281 If you wish to include irq usage for cpup. 282 283config KERNEL_DYNLINK 284 bool "Enable Dynamic Link Feature" 285 default n 286 depends on KERNEL_EXTKERNEL && ARCH_ARM 287 help 288 If you wish to build LiteOS with support for dynamic link. 289 290config KERNEL_PM 291 bool "Enable Power Management" 292 default n 293 depends on KERNEL_EXTKERNEL 294 help 295 Configuration item for low power frame tailoring. 296 If you wish to build LiteOS with support for power management. 297 298config KERNEL_PM_IDLE 299 bool "Enable Power Management Idle" 300 default n 301 depends on KERNEL_PM 302 help 303 Configuration item for low power frame tailoring. 304 If you wish to build LiteOS with support for power management idle. 305 306config KERNEL_PM_DEBUG 307 bool "Power Management Debug" 308 default n 309 depends on KERNEL_PM 310 help 311 Configuration item for low power frame debug tailoring. 312 313config PLATFORM_EXC 314 bool "Enable Platform Exc Hook" 315 default n 316 depends on KERNEL_EXTKERNEL 317 318config KERNEL_LMK 319 bool "Enable Low Memory Killer" 320 default n 321 depends on KERNEL_EXTKERNEL 322 help 323 Configuration item for low memory killer tailoring. 324 If you wish to build LiteOS with support for low memory killer. 325 326config KERNEL_LMK_DEBUG 327 bool "Low Memory Killer Debug" 328 default n 329 depends on KERNEL_LMK 330 help 331 Configuration item forlow memory killer debug tailoring. 332 333######################### config options of trace ######################### 334source "components/trace/Kconfig" 335 336######################### config options of lms ######################### 337source "components/lms/Kconfig" 338 339endmenu 340 341######################### config options of compatibility ############## 342menu "Compat" 343 344rsource "kal/Kconfig" 345 346endmenu 347 348######################## config options of filesystem ################## 349menu "FileSystem" 350 351rsource "components/fs/Kconfig" 352 353endmenu 354 355######################## config options of net ############################ 356menu "Net" 357config NET_LWIP 358 bool "Enable Lwip" 359 default n 360 select NET_LWIP_SACK 361 362 help 363 Answer Y to enable LiteOS support lwip. 364 365config NET_LWIP_SACK 366 bool 367 default n 368 369endmenu 370 371######################## config options of debug ######################## 372menu "Debug" 373 374config THUMB 375 bool "Enable Thumb" 376 default n 377 depends on ARCH_ARM 378 help 379 Answer Y to build thumb version. This will make LiteOS smaller. 380 381config DEBUG_VERSION 382 bool "Enable a Debug Version" 383 default y 384 help 385 If you do not select this option that means you enable a release version for LiteOS. 386 It also means you do not want to use debug modules, like shell,telnet,tftp,nfs and 387 memory check, etc. 388 If you select this option that means you enable a debug version for LiteOS. 389 That means you want a opposite behaviour compared to release version. 390 391config DEBUG_KERNEL 392 bool "Enable Debug LiteOS Kernel Resource" 393 default n 394 depends on DEBUG_VERSION 395 help 396 If you select this option that means you enable debugging kernel resource. 397 It also means you want to get queue, mutex, semaphore, memory debug information. 398 That means you want a opposite behaviour compared to release version. 399 400config MUTEX_CREATE_TRACE 401 bool "Enable Mutex Trace Debugging" 402 default n 403 depends on ARCH_ARM 404 depends on DEBUG_KERNEL 405 help 406 Answer Y to enable debug mutex trace. 407 408config NET_LWIP_SACK_TFTP 409 bool "Enable Tftp" 410 default y 411 depends on SHELL && NET_LWIP_SACK && DEBUG_VERSION 412 help 413 Answer Y to enable LiteOS support tftp cmd and tftp tool. 414 415config DEBUG_HOOK 416 bool "Enable Hook Framework" 417 default n 418 depends on DEBUG_VERSION 419 help 420 Enable the kernel hook framework to support customized trace information capture. 421 422config SHELL_CMD_DEBUG 423 bool "Enable shell cmd Debug" 424 default n 425 depends on DEBUG_VERSION && SHELL 426 427config DEBUG_TOOLS 428 bool "Enable DEBUG TOOLS" 429 default n 430 depends on DEBUG_VERSION 431 help 432 Answer Y to enable LiteOS debug tools, include stackdump, hwidump, tasktrack. 433 434config MEM_DEBUG 435 bool "Enable MEM Debug" 436 default n 437 depends on DEBUG_VERSION 438 help 439 Answer Y to enable LiteOS support mem debug. 440 441config MEM_LEAKCHECK 442 bool "Enable Function call stack of Mem operation recorded" 443 default n 444 depends on DEBUG_VERSION && MEM_DEBUG 445 select KERNEL_BACKTRACE 446 help 447 Answer Y to enable record the LR of Function call stack of Mem operation, it can check the mem leak through the information of mem node. 448config BASE_MEM_NODE_INTEGRITY_CHECK 449 bool "Enable integrity check or not" 450 default n 451 depends on DEBUG_VERSION && MEM_DEBUG 452config MEM_WATERLINE 453 bool "Enable memory pool waterline or not" 454 default n 455 depends on DEBUG_VERSION && MEM_DEBUG 456 457config TASK_MEM_USED 458 bool "Enable show task mem used or not" 459 default n 460 depends on DEBUG_VERSION && MEM_DEBUG 461 462source "components/shell/Kconfig" 463 464endmenu 465 466######################## config options os drivers ######################## 467menu "Driver" 468source "drivers/Kconfig" 469endmenu 470 471######################## config options os security ####################### 472menu "Security" 473config SECURE_TRUSTZONE 474 bool "Enable ARM TrustZone" 475 default n 476 depends on ARCH_ARM 477 depends on ARCH_ARM_V8M 478config SECURE_HEAP_SIZE 479 int "TrustZone Heap Size (bytes)" 480 default 2048 481 depends on SECURE_TRUSTZONE 482config SECURE 483 bool "Enable Security" 484 default n 485 select MPU_ENABLE 486config MPU_ENABLE 487 bool "Enable MPU" 488 default n 489endmenu 490 491menu "Test" 492config TEST 493 bool 494 default n 495config KERNEL_TEST 496 bool "Enable Kernel Test" 497 default n 498 select TEST 499config KERNEL_TEST_FULL 500 bool "Full Kernel Test" 501 default n 502 depends on KERNEL_TEST 503endmenu 504 505menu "Stack Smashing Protector (SSP) Compiler Feature" 506 507choice 508 prompt "Enable stack buffer overflow detection" 509 default CC_STACKPROTECTOR_STRONG 510 ---help--- 511 This option turns on the -fstack-protector GCC feature. This 512 feature puts, at the beginning of functions, a canary value on 513 the stack just before the return address, and validates 514 the value just before actually returning. Stack based buffer 515 overflows (that need to overwrite this return address) now also 516 overwrite the canary, which gets detected and the attack is then 517 neutralized via a kernel panic. 518 519 This feature requires gcc version 4.2 or above, or a distribution 520 gcc with the feature backported. Older versions are automatically 521 detected and for those versions, this configuration option is 522 ignored. (and a warning is printed during bootup) 523 524config CC_NO_STACKPROTECTOR 525 bool "-fno-stack-protector" 526 527config CC_STACKPROTECTOR 528 bool "-fstack-protector" 529 530config CC_STACKPROTECTOR_STRONG 531 bool "-fstack-protector-strong" 532 533config CC_STACKPROTECTOR_ALL 534 bool "-fstack-protector-all" 535 536endchoice 537 538endmenu 539