1# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. 2# Copyright (c) 2020-2021 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 CROSS_COMPILE 43 string "GCC cross-compile toolchain prefix" 44 depends on COMPILER_GCC 45 default "arm-none-eabi-" if ARCH_ARM_AARCH32 46 47config COMPILER_CLANG_LLVM 48 bool "Clang" 49 50config LLVM_TARGET 51 string "Clang LLVM target" 52 depends on COMPILER_CLANG_LLVM 53 default "arm-liteos-ohos" if ARCH_ARM_AARCH32 54 55endchoice 56 57config COMPILE_DEBUG 58 bool "Enable debug options" 59 default n 60 help 61 Answer Y to add -g option in compile command. 62 63config COMPILE_OPTIMIZE 64 bool "Enable code optimization options" 65 default y 66 help 67 Answer Y to add optimization options for efficient code. 68 The final binary size will be smaller and execute faster. 69 But the debugging experience may be worst somehow. 70 71config COMPILE_OPTIMIZE_SIZE 72 bool "Enable code size optimization options" if COMPILE_OPTIMIZE 73 default y 74 help 75 Answer Y to add optimization options for small code size. 76 The final binary size will be smaller. 77 But the compile time may be a bit longer. 78 79config COMPILE_LTO 80 bool "Enable link time optimization (LTO)" if COMPILE_OPTIMIZE_SIZE 81 default y 82 help 83 Answer Y to add lto options for more smaller code size. 84 The final binary size will be smaller. 85 But the compile time may be much longer. 86 87endmenu 88 89menu "Platform" 90 91######################### config options of bsp ##################### 92config PLATFORM 93 string 94 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 95 96config PRODUCT_NAME 97 string 98 default "arm_virt" if PRODUCT_QEMU_ARM 99 default "arm_mps2_an386" if PRODUCT_QEMU_ARM_MPS2_AN386 100 default "arm_mps3_an547" if PRODUCT_QEMU_ARM_MPS3_AN547 101 default "riscv32_virt" if PRODUCT_QEMU_RISCV32_VIRT 102 default "csky_smartl_e802" if PRODUCT_QEMU_CSKY_SMARTL_E802 103 default "xtensa_esp32" if PRODUCT_QEMU_XTENSA_ESP32 104 105config DEVICE_COMPANY 106 string 107 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 108 109choice 110 prompt "Chip" 111 default PLATFORM_QEMU_ARM_VIRT_CM7 112 help 113 Qemu ARM Virt variants (based on different CPU types): 114 - qemu_arm_virt_cm7 115 - qemu_arm_virt_cm4 116 - qemu_riscv32_virt 117 - qemu_csky_smartl 118 - qemu_xtensa_esp32 119 120config PLATFORM_QEMU_ARM_VIRT_CM7 121 bool "qemu_arm_virt_cm7" 122 select ARCH_CORTEX_M7 123 help 124 QEMU ARM Virtual Platform using Cortex-M7 CPU. 125 126config PLATFORM_QEMU_ARM_VIRT_CM4 127 bool "qemu_arm_virt_cm4" 128 select ARCH_CORTEX_M4 129 help 130 QEMU ARM Virtual Platform using Cortex-M4 CPU. 131 132config PLATFORM_QEMU_ARM_VIRT_CM55 133 bool "qemu_arm_virt_cm55" 134 select ARCH_CORTEX_M55 135 help 136 QEMU ARM Virtual Platform using Cortex-M55 CPU. 137 138config PLATFORM_QEMU_RISCV32_VIRT 139 bool "qemu_riscv32_virt" 140 select ARCH_RISCV32 141 help 142 QEMU RISCV Virtual Platform using riscv32 CPU. 143 144config PLATFORM_QEMU_CSKY_SMARTL 145 bool "qemu_csky_smartl" 146 select ARCH_CSKY 147 help 148 QEMU SmartL Virtual Platform using csky CPU. 149 150config PLATFORM_QEMU_XTENSA_ESP32 151 bool "qemu_xtensa_esp32" 152 select ARCH_XTENSA 153 help 154 QEMU ESP32 Virtual Platform using xtensa CPU. 155 156endchoice 157 158choice 159 prompt "Product" 160 help 161 Select your target board. 162 163config PRODUCT_QEMU_ARM 164 bool "arm_virt" if PLATFORM_QEMU_ARM_VIRT_CM7 165 166config PRODUCT_QEMU_ARM_MPS2_AN386 167 bool "arm_mps2_an386" if PLATFORM_QEMU_ARM_VIRT_CM4 168 169config PRODUCT_QEMU_ARM_MPS3_AN547 170 bool "arm_mps3_an547" if PLATFORM_QEMU_ARM_VIRT_CM55 171 172config PRODUCT_QEMU_RISCV32_VIRT 173 bool "riscv32_virt" if PLATFORM_QEMU_RISCV32_VIRT 174 175config PRODUCT_QEMU_CSKY_SMARTL_E802 176 bool "csky_smartl_e802" if PLATFORM_QEMU_CSKY_SMARTL 177 178config PRODUCT_QEMU_XTENSA_ESP32 179 bool "xtensa_esp32" if PLATFORM_QEMU_XTENSA_ESP32 180 181endchoice 182 183 184######################### config options of cpu arch ################ 185source "arch/Kconfig" 186 187# Device Kconfig import 188osource "$(DEVICE_PATH)/Kconfig" 189 190config SOC_COMPANY 191 string "SoC company name to locate soc build path" 192 help 193 This option specifies the SoC company name, used to locate the build path for soc. This option is set by the 194 SoC's Kconfig file, and should be exactly the same with SoC company path, and the user should generally avoid 195 modifying it via the menu configuration. 196 197orsource "../../device/board/*/Kconfig.liteos_m.shields" 198 199orsource "../../device/board/$(BOARD_COMPANY)/Kconfig.liteos_m.defconfig.boards" 200 201choice 202 prompt "Board Selection" 203 204orsource "../../device/board/$(BOARD_COMPANY)/Kconfig.liteos_m.boards" 205 206endchoice 207 208orsource "../../device/soc/*/Kconfig.liteos_m.defconfig" 209 210choice 211 prompt "SoC Series Selection" 212 213orsource "../../device/soc/*/Kconfig.liteos_m.series" 214 215endchoice 216 217orsource "../../device/soc/*/Kconfig.liteos_m.soc" 218 219config QUICK_START 220 bool "Enable QUICK_START" 221 default n 222 depends on DRIVERS && FS_VFS 223 help 224 Answer Y to enable LiteOS support quick start. 225endmenu 226 227######################### config options of kernel ##################### 228menu "Kernel" 229 230######################### config options of extended ##################### 231 232config KERNEL_EXTKERNEL 233 bool "Enable Extend Kernel" 234 default y 235 help 236 This option will enable extend Kernel of LiteOS. Extend kernel include 237 cppsupport, cpup, etc. You can select one or some 238 of them. 239 240config KERNEL_BACKTRACE 241 bool "Enable Backtrace" 242 default n 243 depends on KERNEL_EXTKERNEL 244 help 245 If you wish to build LiteOS with support for backtrace. 246 247choice 248 prompt "Select Backtrace Type" 249 depends on KERNEL_BACKTRACE 250 251config BACKTRACE_TYPE_1 252 bool "1: Call stack analysis for cortex-m series by scanning the stack" 253 depends on ARCH_ARM && !ARCH_ARM9 254 255config BACKTRACE_TYPE_2 256 bool "2: Call stack analysis for risc-v by using frame pointer" 257 depends on ARCH_RISCV 258 259config BACKTRACE_TYPE_3 260 bool "3: Call stack analysis for risc-v by scanning the stack" 261 depends on ARCH_RISCV 262 263config BACKTRACE_TYPE_4 264 bool "4: Call stack analysis for xtensa by scanning the stack" 265 depends on ARCH_XTENSA 266 267config BACKTRACE_TYPE_5 268 bool "5: Call stack analysis for c-sky by scanning the stack" 269 depends on ARCH_CSKY 270 271config BACKTRACE_TYPE_6 272 bool "6: Call stack analysis for arm9 by scanning the stack" 273 depends on ARCH_ARM9 274 275endchoice 276 277config BACKTRACE_TYPE 278 int 279 default 0 if ! KERNEL_BACKTRACE 280 default 1 if BACKTRACE_TYPE_1 281 default 2 if BACKTRACE_TYPE_2 282 default 3 if BACKTRACE_TYPE_3 283 default 4 if BACKTRACE_TYPE_4 284 default 5 if BACKTRACE_TYPE_5 285 default 6 if BACKTRACE_TYPE_6 286 287config BACKTRACE_DEPTH 288 int "Backtrace depth" 289 default 15 290 depends on KERNEL_BACKTRACE 291 292config KERNEL_CPPSUPPORT 293 bool "Enable C++ Support" 294 default n 295 depends on KERNEL_EXTKERNEL 296 help 297 If you wish to build LiteOS with support for C++. 298 299rsource "components/signal/Kconfig" 300 301config BASE_CORE_CPUP 302 bool 303 default n 304 305config KERNEL_CPUP 306 bool "Enable Cpup" 307 default n 308 depends on KERNEL_EXTKERNEL 309 select BASE_CORE_CPUP 310 help 311 If you wish to build LiteOS with support for cpup. 312 313config CPUP_INCLUDE_IRQ 314 bool "Enable Cpup include irq" 315 default y 316 depends on KERNEL_CPUP 317 help 318 If you wish to include irq usage for cpup. 319 320config DYNLINK 321 bool "Enable Dynamic Link Feature" 322 default n 323 depends on KERNEL_EXTKERNEL && ARCH_ARM 324 help 325 If you wish to build LiteOS with support for dynamic link. 326 327config KERNEL_PM 328 bool "Enable Power Management" 329 default n 330 depends on KERNEL_EXTKERNEL 331 help 332 Configuration item for low power frame tailoring. 333 If you wish to build LiteOS with support for power management. 334 335config KERNEL_PM_TASK_PTIORITY 336 int "Power Management Task Priority" 337 default 1 338 range 1 31 339 depends on KERNEL_PM 340 help 341 Configuration item for priority of low-power task. 342 343config KERNEL_PM_TASK_STACKSIZE 344 int "Power Management Task Stack Size" 345 default 1024 346 depends on KERNEL_PM 347 help 348 Configuration item for stack size of low-power task. 349 350config KERNEL_PM_DEBUG 351 bool "Power Management Debug" 352 default n 353 depends on KERNEL_PM 354 help 355 Configuration item for low power frame debug tailoring. 356 357config DEBUG_HOOK 358 bool 359 default n 360 361config PLATFORM_EXC 362 bool "Enable Hook Feature" 363 default n 364 depends on KERNEL_EXTKERNEL 365 select DEBUG_HOOK 366 367config KERNEL_LMK 368 bool "Enable Low Memory Killer" 369 default n 370 depends on KERNEL_EXTKERNEL 371 help 372 Configuration item for low memory killer tailoring. 373 If you wish to build LiteOS with support for low memory killer. 374 375config KERNEL_LMK_DEBUG 376 bool "Low Memory Killer Debug" 377 default n 378 depends on KERNEL_LMK 379 help 380 Configuration item forlow memory killer debug tailoring. 381 382######################### config options of trace ######################### 383source "components/trace/Kconfig" 384 385######################### config options of lms ######################### 386source "components/lms/Kconfig" 387 388endmenu 389 390######################### config options of lib ######################## 391menu "Lib" 392config LIB_LIBC 393 bool "Enable Libc" 394 default y 395 help 396 Answer Y to enable libc for full code. 397 398endmenu 399 400 401######################### config options of compatibility ############## 402menu "Compat" 403 404rsource "kal/Kconfig" 405 406endmenu 407 408######################## config options of filesystem ################## 409menu "FileSystem" 410 411rsource "components/fs/Kconfig" 412 413endmenu 414 415######################## config options of net ############################ 416menu "Net" 417config NET_LWIP 418 bool "Enable Lwip" 419 default n 420 select NET_LWIP_SACK 421 422 help 423 Answer Y to enable LiteOS support lwip. 424 425config NET_LWIP_SACK 426 bool 427 default n 428 429endmenu 430 431######################## config options of debug ######################## 432menu "Debug" 433config GDB 434 bool "Enable gdb functions" 435 default n 436 help 437 Answer Y to enable gdb functions. 438 439config PLATFORM_ADAPT 440 bool "Enable Os_adapt" 441 default y 442 help 443 Answer Y to add os_adapt.c to LiteOS. 444 445config ENABLE_OOM_LOOP_TASK 446 bool "Enable Oom loop task" 447 default n 448 depends on KERNEL_VM 449 help 450 Answer Y to enable oom loop kthread to check system out of memory. 451 452config DO_ALIGN 453 bool "Enable do align for hi3518e" 454 default y 455 depends on PLATFORM_HI3518EV200 456 help 457 Answer Y to enable do align for hi3518e. 458 459 460config ENABLE_MAGICKEY 461 bool "Enable MAGIC KEY" 462 default y 463 help 464 Answer Y to enable LiteOS Magic key. 465 ctrl + r : Magic key check switch; 466 ctrl + z : Show all magic op key; 467 ctrl + t : Show task information; 468 ctrl + p : System panic; 469 ctrl + e : Check system memory pool. 470 471config THUMB 472 bool "Enable Thumb" 473 default n 474 depends on ARCH_ARM 475 help 476 Answer Y to build thumb version. This will make LiteOS smaller. 477 478config PLATFORM_DVFS 479 bool "Enable Dvfs" 480 default n 481 depends on COMPAT_LINUXKPI 482 help 483 Answer Y to enable LiteOS support dynamic voltage and frequency scaling feature for 484 low power consumption. 485 486config SAVE_EXCINFO 487 bool "Enable Saving Exception Information" 488 default n 489 help 490 Answer Y to enable LiteOS support saving exception information to storage medium. 491 492config DEBUG_VERSION 493 bool "Enable a Debug Version" 494 default y 495 help 496 If you do not select this option that means you enable a release version for LiteOS. 497 It also means you do not want to use debug modules, like shell,telnet,tftp,nfs and 498 memory check, etc. 499 If you select this option that means you enable a debug version for LiteOS. 500 That means you want a opposite behaviour compared to release version. 501 502config DEBUG_KERNEL 503 bool "Enable Debug LiteOS Kernel Resource" 504 default n 505 depends on DEBUG_VERSION 506 help 507 If you select this option that means you enable debugging kernel resource. 508 It also means you want to get queue, mutex, semaphore, memory debug information. 509 That means you want a opposite behaviour compared to release version. 510 511config DEBUG_QUEUE 512 bool "Enable Queue Debugging" 513 default n 514 depends on DEBUG_KERNEL 515 help 516 Answer Y to enable debug queue. 517 518config DEBUG_DEADLOCK 519 bool "Enable Mutex Deadlock Debugging" 520 default n 521 depends on DEBUG_KERNEL 522 help 523 Answer Y to enable debug mutex deadlock. 524 525config DEBUG_SEMAPHORE 526 bool "Enable Semaphore Debugging" 527 default n 528 depends on DEBUG_KERNEL 529 help 530 Answer Y to enable debug semaphore. 531 532source "components/shell/Kconfig" 533config NET_LWIP_SACK_TFTP 534 bool "Enable Tftp" 535 default y 536 depends on SHELL && NET_LWIP_SACK && DEBUG_VERSION 537 help 538 Answer Y to enable LiteOS support tftp cmd and tftp tool. 539osource "net/telnet/Kconfig" 540config SCHED_DEBUG 541 bool "Enable sched debug Feature" 542 default n 543 depends on DEBUG_VERSION 544 help 545 If you wish to build LiteOS with support for sched debug. 546 547config USER_INIT_DEBUG 548 bool "Enable user init Debug" 549 default n 550 depends on DEBUG_VERSION 551 552config SHELL_CMD_DEBUG 553 bool "Enable shell cmd Debug" 554 default n 555 depends on DEBUG_VERSION && SHELL 556 557config USB_DEBUG 558 bool "Enable USB Debug" 559 default n 560 depends on SHELL && DRIVERS_USB && DEBUG_VERSION 561 help 562 Answer Y to enable LiteOS support usb debug. 563 use shell command to open the specified debug level print. 564config MEM_DEBUG 565 bool "Enable MEM Debug" 566 default n 567 depends on DEBUG_VERSION 568 help 569 Answer Y to enable LiteOS support mem debug. 570 571config MEM_LEAKCHECK 572 bool "Enable Function call stack of Mem operation recorded" 573 default n 574 depends on DEBUG_VERSION && MEM_DEBUG 575 select KERNEL_BACKTRACE 576 help 577 Answer Y to enable record the LR of Function call stack of Mem operation, it can check the mem leak through the informations of mem node. 578config BASE_MEM_NODE_INTEGRITY_CHECK 579 bool "Enable integrity check or not" 580 default n 581 depends on DEBUG_VERSION && MEM_DEBUG 582config MEM_WATERLINE 583 bool "Enable memory pool waterline or not" 584 default n 585 depends on DEBUG_VERSION && MEM_DEBUG 586 587config VM_OVERLAP_CHECK 588 bool "Enable VM overlap check or not" 589 default n 590 depends on DEBUG_VERSION && MEM_DEBUG 591 help 592 Answer Y to enable vm overlap check. 593 594endmenu 595 596######################## config options os drivers ######################## 597menu "Driver" 598source "drivers/Kconfig" 599endmenu 600 601######################## config options os security ####################### 602menu "Security" 603osource "security/Kconfig" 604config SECURE_TRUSTZONE 605 bool "Enable ARM TrustZone" 606 default n 607 depends on ARCH_ARM 608config SECURE_HEAP_SIZE 609 int "TrustZone Heap Size (bytes)" 610 default 2048 611 depends on SECURE_TRUSTZONE 612config SECURE_STACK_DEFAULT_SIZE 613 int "TrustZone Stack Size (bytes)" 614 default 512 615 depends on SECURE_TRUSTZONE 616 help 617 The secure stack must be allocated before the task calls non-secure functions. 618endmenu 619 620menu "Test" 621config TEST 622 bool 623 default n 624config KERNEL_TEST 625 bool "Enable Kernel Test" 626 default n 627 select TEST 628config KERNEL_TEST_FULL 629 bool "Full Kernel Test" 630 default n 631 depends on KERNEL_TEST 632endmenu 633 634menu "Stack Smashing Protector (SSP) Compiler Feature" 635 636choice 637 prompt "Enable stack buffer overflow detection" 638 default CC_STACKPROTECTOR_STRONG 639 ---help--- 640 This option turns on the -fstack-protector GCC feature. This 641 feature puts, at the beginning of functions, a canary value on 642 the stack just before the return address, and validates 643 the value just before actually returning. Stack based buffer 644 overflows (that need to overwrite this return address) now also 645 overwrite the canary, which gets detected and the attack is then 646 neutralized via a kernel panic. 647 648 This feature requires gcc version 4.2 or above, or a distribution 649 gcc with the feature backported. Older versions are automatically 650 detected and for those versions, this configuration option is 651 ignored. (and a warning is printed during bootup) 652 653config CC_NO_STACKPROTECTOR 654 bool "-fno-stack-protector" 655 656config CC_STACKPROTECTOR 657 bool "-fstack-protector" 658 659config CC_STACKPROTECTOR_STRONG 660 bool "-fstack-protector-strong" 661 662config CC_STACKPROTECTOR_ALL 663 bool "-fstack-protector-all" 664 665endchoice 666 667endmenu 668