config.h 4.1 KB

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