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