config.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. /*
  2. * Copyright (C) 2019 Intel Corporation. All rights reserved.
  3. * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. */
  5. #ifndef _CONFIG_H_
  6. #if !defined(BUILD_TARGET_X86_64) \
  7. && !defined(BUILD_TARGET_AMD_64) \
  8. && !defined(BUILD_TARGET_X86_32) \
  9. && !defined(BUILD_TARGET_ARM_32) \
  10. && !defined(BUILD_TARGET_MIPS_32) \
  11. && !defined(BUILD_TARGET_XTENSA_32)
  12. #if defined(__x86_64__) || defined(__x86_64)
  13. #define BUILD_TARGET_X86_64
  14. #elif defined(__amd64__) || defined(__amd64)
  15. #define BUILD_TARGET_AMD_64
  16. #elif defined(__i386__) || defined(__i386) || defined(i386)
  17. #define BUILD_TARGET_X86_32
  18. #elif defined(__arm__)
  19. #define BUILD_TARGET_ARM_32
  20. #elif defined(__mips__) || defined(__mips) || defined(mips)
  21. #define BUILD_TARGET_MIPS_32
  22. #elif defined(__XTENSA__)
  23. #define BUILD_TARGET_XTENSA
  24. #else
  25. #error "Build target isn't set"
  26. #endif
  27. #endif
  28. /* Memory allocator ems */
  29. #define MEM_ALLOCATOR_EMS 0
  30. /* Memory allocator tlsf */
  31. #define MEM_ALLOCATOR_TLSF 1
  32. /* Default memory allocator */
  33. #define DEFAULT_MEM_ALLOCATOR MEM_ALLOCATOR_EMS
  34. /* Beihai log system */
  35. #define BEIHAI_ENABLE_LOG 1
  36. /* Beihai debugger support */
  37. #define BEIHAI_ENABLE_TOOL_AGENT 1
  38. /* Beihai debug monitoring server, must define
  39. BEIHAI_ENABLE_TOOL_AGENT firstly */
  40. #define BEIHAI_ENABLE_TOOL_AGENT_BDMS 1
  41. /* enable no signature on sdv since verify doesn't work as lacking public key */
  42. #ifdef CONFIG_SDV
  43. #define BEIHAI_ENABLE_NO_SIGNATURE 1
  44. #else
  45. #define BEIHAI_ENABLE_NO_SIGNATURE 0
  46. #endif
  47. /* WASM VM log system */
  48. #ifndef WASM_ENABLE_LOG
  49. #define WASM_ENABLE_LOG 1
  50. #endif
  51. /* WASM Interpreter labels-as-values feature */
  52. #define WASM_ENABLE_LABELS_AS_VALUES 1
  53. /* WASM Branch Block address hashmap */
  54. #define WASM_ENABLE_HASH_BLOCK_ADDR 0
  55. /* Heap and stack profiling */
  56. #define BEIHAI_ENABLE_MEMORY_PROFILING 0
  57. /* Max app number of all modules */
  58. #define MAX_APP_INSTALLATIONS 3
  59. /* Default timer number in one app */
  60. #define DEFAULT_TIMERS_PER_APP 20
  61. /* Max timer number in one app */
  62. #define MAX_TIMERS_PER_APP 30
  63. /* Max connection number in one app */
  64. #define MAX_CONNECTION_PER_APP 20
  65. /* Max resource registration number in one app */
  66. #define RESOURCE_REGISTRATION_NUM_MAX 16
  67. /* Max length of resource/event url */
  68. #define RESOUCE_EVENT_URL_LEN_MAX 256
  69. /* Default length of queue */
  70. #define DEFAULT_QUEUE_LENGTH 50
  71. /* Default watchdog interval in ms */
  72. #define DEFAULT_WATCHDOG_INTERVAL (3 * 60 * 1000)
  73. /* Workflow heap size */
  74. /*
  75. #define WORKING_FLOW_HEAP_SIZE 0
  76. */
  77. /* Support memory.grow opcode and enlargeMemory function */
  78. #define WASM_ENABLE_MEMORY_GROW 1
  79. /* The max percentage of global heap that app memory space can grow */
  80. #define APP_MEMORY_MAX_GLOBAL_HEAP_PERCENT 1 / 3
  81. /* Default base offset of app heap space */
  82. #define DEFAULT_APP_HEAP_BASE_OFFSET (1 * BH_GB)
  83. /* Default min/max heap size of each app */
  84. #define APP_HEAP_SIZE_DEFAULT (8 * 1024)
  85. #define APP_HEAP_SIZE_MIN (2 * 1024)
  86. #define APP_HEAP_SIZE_MAX (1024 * 1024)
  87. /* Default wasm stack size of each app */
  88. #if defined(BUILD_TARGET_X86_64) || defined(BUILD_TARGET_AMD_64)
  89. #define DEFAULT_WASM_STACK_SIZE (12 * 1024)
  90. #else
  91. #define DEFAULT_WASM_STACK_SIZE (8 * 1024)
  92. #endif
  93. /* Default/min/max stack size of each app thread */
  94. #ifndef __ZEPHYR__
  95. #define APP_THREAD_STACK_SIZE_DEFAULT (20 * 1024)
  96. #define APP_THREAD_STACK_SIZE_MIN (16 * 1024)
  97. #define APP_THREAD_STACK_SIZE_MAX (256 * 1024)
  98. #else
  99. #define APP_THREAD_STACK_SIZE_DEFAULT (4 * 1024)
  100. #define APP_THREAD_STACK_SIZE_MIN (2 * 1024)
  101. #define APP_THREAD_STACK_SIZE_MAX (256 * 1024)
  102. #endif
  103. /* External memory space provided by user,
  104. but not wasm memory space and app heap space */
  105. #ifndef WASM_ENABLE_EXT_MEMORY_SPACE
  106. #define WASM_ENABLE_EXT_MEMORY_SPACE 0
  107. #endif
  108. /* Default base offset of external memory space */
  109. #define DEFAULT_EXT_MEM_BASE_OFFSET (-2 * BH_GB)
  110. #ifndef bh_printf
  111. #define bh_printf printf
  112. #endif
  113. #ifndef WASM_ENABLE_GUI
  114. #define WASM_ENABLE_GUI 0
  115. #endif
  116. #endif /* end of _CONFIG_H_ */