conf_common.py 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318
  1. # -*- coding: utf-8 -*-
  2. #
  3. # Common (non-language-specific) configuration for Sphinx
  4. #
  5. # This file is imported from a language-specific conf.py (ie en/conf.py or
  6. # zh_CN/conf.py)
  7. # type: ignore
  8. # pylint: disable=wildcard-import
  9. # pylint: disable=undefined-variable
  10. from __future__ import print_function, unicode_literals
  11. import os.path
  12. import re
  13. from pathlib import Path
  14. from esp_docs.conf_docs import * # noqa: F403,F401
  15. if os.environ.get('IDF_PATH') is None:
  16. raise RuntimeError('IDF_PATH should be set, run export.sh before building docs')
  17. BT_DOCS = ['api-guides/bluetooth.rst',
  18. 'api-reference/bluetooth/bt_le.rst',
  19. 'api-reference/bluetooth/esp_bt_defs.rst',
  20. 'api-reference/bluetooth/esp_bt_device.rst',
  21. 'api-reference/bluetooth/esp_bt_main.rst',
  22. 'api-reference/bluetooth/bt_common.rst',
  23. 'api-reference/bluetooth/controller_vhci.rst',
  24. 'api-reference/bluetooth/esp_gap_ble.rst',
  25. 'api-reference/bluetooth/esp_gatt_defs.rst',
  26. 'api-reference/bluetooth/esp_gatts.rst',
  27. 'api-reference/bluetooth/esp_gattc.rst',
  28. 'api-reference/bluetooth/index.rst',
  29. 'api-reference/bluetooth/nimble/index.rst']
  30. BLE_DOCS = ['migration-guides/release-5.x/5.0/bluetooth-low-energy.rst']
  31. BLE_MESH_DOCS = ['api-guides/esp-ble-mesh/ble-mesh-index.rst',
  32. 'api-guides/esp-ble-mesh/ble-mesh-feature-list.rst',
  33. 'api-guides/esp-ble-mesh/ble-mesh-terminology.rst',
  34. 'api-guides/esp-ble-mesh/ble-mesh-architecture.rst',
  35. 'api-guides/esp-ble-mesh/ble-mesh-faq.rst',
  36. 'api-reference/bluetooth/esp-ble-mesh.rst']
  37. CLASSIC_BT_DOCS = ['api-reference/bluetooth/classic_bt.rst',
  38. 'api-reference/bluetooth/esp_a2dp.rst',
  39. 'api-reference/bluetooth/esp_avrc.rst',
  40. 'api-reference/bluetooth/esp_hidd.rst',
  41. 'api-reference/bluetooth/esp_hidh.rst',
  42. 'api-reference/bluetooth/esp_l2cap_bt.rst',
  43. 'api-reference/bluetooth/esp_sdp.rst',
  44. 'api-reference/bluetooth/esp_hf_defs.rst',
  45. 'api-reference/bluetooth/esp_hf_client.rst',
  46. 'api-reference/bluetooth/esp_hf_ag.rst',
  47. 'api-reference/bluetooth/esp_spp.rst',
  48. 'api-reference/bluetooth/esp_gap_bt.rst',
  49. 'migration-guides/release-5.x/5.0/bluetooth-classic.rst']
  50. BLUFI_DOCS = ['api-guides/blufi.rst',
  51. 'api-reference/bluetooth/esp_blufi.rst']
  52. WIFI_DOCS = ['api-guides/wifi.rst',
  53. 'api-guides/wifi-security.rst',
  54. 'api-guides/wireshark-user-guide.rst',
  55. 'api-reference/network/esp_now.rst',
  56. 'api-reference/network/esp_smartconfig.rst',
  57. 'api-reference/network/esp_wifi.rst',
  58. 'api-reference/network/esp_dpp.rst']
  59. NAN_DOCS = ['api-reference/network/esp_nan.rst']
  60. WIFI_MESH_DOCS = ['api-guides/esp-wifi-mesh.rst',
  61. 'api-reference/network/esp-wifi-mesh.rst']
  62. COEXISTENCE_DOCS = ['api-guides/coexist.rst']
  63. MM_SYNC_DOCS = ['api-reference/system/mm_sync.rst']
  64. SDMMC_DOCS = ['api-reference/peripherals/sdmmc_host.rst']
  65. SDIO_SLAVE_DOCS = ['api-reference/peripherals/sdio_slave.rst',
  66. 'api-reference/protocols/esp_sdio_slave_protocol.rst']
  67. MCPWM_DOCS = ['api-reference/peripherals/mcpwm.rst']
  68. DEDIC_GPIO_DOCS = ['api-reference/peripherals/dedic_gpio.rst']
  69. PARLIO_DOCS = ['api-reference/peripherals/parlio.rst']
  70. PCNT_DOCS = ['api-reference/peripherals/pcnt.rst']
  71. RMT_DOCS = ['api-reference/peripherals/rmt.rst']
  72. DAC_DOCS = ['api-reference/peripherals/dac.rst']
  73. ETM_DOCS = ['api-reference/peripherals/etm.rst']
  74. TEMP_SENSOR_DOCS = ['api-reference/peripherals/temp_sensor.rst']
  75. TOUCH_SENSOR_DOCS = ['api-reference/peripherals/touch_pad.rst']
  76. SPIRAM_DOCS = ['api-guides/external-ram.rst']
  77. USB_DOCS = ['api-reference/peripherals/usb_device.rst',
  78. 'api-reference/peripherals/usb_host.rst',
  79. 'api-reference/peripherals/usb_host/usb_host_notes_arch.rst',
  80. 'api-reference/peripherals/usb_host/usb_host_notes_design.rst',
  81. 'api-reference/peripherals/usb_host/usb_host_notes_dwc_otg.rst',
  82. 'api-reference/peripherals/usb_host/usb_host_notes_index.rst',
  83. 'api-guides/usb-otg-console.rst',
  84. 'api-guides/dfu.rst']
  85. FTDI_JTAG_DOCS = ['api-guides/jtag-debugging/configure-ft2232h-jtag.rst']
  86. USB_SERIAL_JTAG_DOCS = ['api-guides/jtag-debugging/configure-builtin-jtag.rst',
  87. 'api-guides/usb-serial-jtag-console.rst']
  88. ULP_FSM_DOCS = ['api-reference/system/ulp.rst',
  89. 'api-reference/system/ulp_macros.rst',
  90. 'api-reference/system/ulp_instruction_set.rst']
  91. RISCV_COPROC_DOCS = ['api-reference/system/ulp-risc-v.rst',]
  92. LP_CORE_DOCS = ['api-reference/system/ulp-lp-core.rst']
  93. XTENSA_DOCS = ['api-guides/hlinterrupts.rst',
  94. 'api-reference/system/perfmon.rst']
  95. RISCV_DOCS = [] # type: list[str]
  96. TWAI_DOCS = ['api-reference/peripherals/twai.rst']
  97. SDM_DOCS = ['api-reference/peripherals/sdm.rst']
  98. I2S_DOCS = ['api-reference/peripherals/i2s.rst']
  99. RTC_MEM_DOCS = ['api-guides/deep-sleep-stub.rst']
  100. ADC_DOCS = ['api-reference/peripherals/adc_oneshot.rst',
  101. 'api-reference/peripherals/adc_calibration.rst']
  102. ADC_DMA_DOCS = ['api-reference/peripherals/adc_continuous.rst']
  103. ANA_CMPR_DOCS = ['api-reference/peripherals/ana_cmpr.rst']
  104. SPI_SLAVE_HD_DOCS = ['api-reference/peripherals/spi_slave_hd.rst']
  105. ESP32_DOCS = ['api-reference/system/himem.rst',
  106. 'api-guides/romconsole.rst',
  107. 'api-reference/system/ipc.rst',
  108. 'security/secure-boot-v1.rst',
  109. 'api-reference/peripherals/secure_element.rst',
  110. 'api-reference/peripherals/dac.rst',
  111. 'api-reference/peripherals/sd_pullup_requirements.rst',
  112. 'hw-reference/esp32/**',
  113. 'api-guides/RF_calibration.rst'] + FTDI_JTAG_DOCS
  114. ESP32S2_DOCS = ['hw-reference/esp32s2/**',
  115. 'api-guides/usb-console.rst',
  116. 'api-reference/peripherals/ds.rst',
  117. 'api-reference/peripherals/temp_sensor.rst',
  118. 'api-reference/system/async_memcpy.rst',
  119. 'api-reference/peripherals/touch_element.rst',
  120. 'api-guides/RF_calibration.rst'] + FTDI_JTAG_DOCS
  121. ESP32S3_DOCS = ['hw-reference/esp32s3/**',
  122. 'api-reference/system/ipc.rst',
  123. 'api-guides/flash_psram_config.rst',
  124. 'api-reference/peripherals/sd_pullup_requirements.rst',
  125. 'api-guides/RF_calibration.rst']
  126. # No JTAG docs for this one as it gets gated on SOC_USB_SERIAL_JTAG_SUPPORTED down below.
  127. ESP32C3_DOCS = ['hw-reference/esp32c3/**',
  128. 'api-guides/RF_calibration.rst']
  129. ESP32C2_DOCS = ['api-guides/RF_calibration.rst']
  130. ESP32C6_DOCS = ['api-guides/RF_calibration.rst',
  131. 'api-reference/peripherals/sd_pullup_requirements.rst']
  132. ESP32H2_DOCS = ['api-guides/RF_calibration.rst']
  133. ESP32P4_DOCS = ['api-reference/system/ipc.rst',
  134. 'api-reference/peripherals/sd_pullup_requirements.rst']
  135. # format: {tag needed to include: documents to included}, tags are parsed from sdkconfig and peripheral_caps.h headers
  136. conditional_include_dict = {'SOC_BT_SUPPORTED':BT_DOCS,
  137. 'SOC_BLE_SUPPORTED':BLE_DOCS,
  138. 'SOC_BLE_MESH_SUPPORTED':BLE_MESH_DOCS,
  139. 'SOC_BLUFI_SUPPORTED':BLUFI_DOCS,
  140. 'SOC_WIFI_SUPPORTED':WIFI_DOCS,
  141. 'SOC_BT_CLASSIC_SUPPORTED':CLASSIC_BT_DOCS,
  142. 'SOC_SUPPORT_COEXISTENCE':COEXISTENCE_DOCS,
  143. 'SOC_PSRAM_DMA_CAPABLE':MM_SYNC_DOCS,
  144. 'SOC_CACHE_INTERNAL_MEM_VIA_L1CACHE':MM_SYNC_DOCS,
  145. 'SOC_SDMMC_HOST_SUPPORTED':SDMMC_DOCS,
  146. 'SOC_SDIO_SLAVE_SUPPORTED':SDIO_SLAVE_DOCS,
  147. 'SOC_MCPWM_SUPPORTED':MCPWM_DOCS,
  148. 'SOC_USB_OTG_SUPPORTED':USB_DOCS,
  149. 'SOC_USB_SERIAL_JTAG_SUPPORTED':USB_SERIAL_JTAG_DOCS,
  150. 'SOC_DEDICATED_GPIO_SUPPORTED':DEDIC_GPIO_DOCS,
  151. 'SOC_SPIRAM_SUPPORTED':SPIRAM_DOCS,
  152. 'SOC_PARLIO_SUPPORTED':PARLIO_DOCS,
  153. 'SOC_PCNT_SUPPORTED':PCNT_DOCS,
  154. 'SOC_RMT_SUPPORTED':RMT_DOCS,
  155. 'SOC_DAC_SUPPORTED':DAC_DOCS,
  156. 'SOC_ETM_SUPPORTED':ETM_DOCS,
  157. 'SOC_TOUCH_SENSOR_SUPPORTED':TOUCH_SENSOR_DOCS,
  158. 'SOC_ULP_FSM_SUPPORTED':ULP_FSM_DOCS,
  159. 'SOC_RISCV_COPROC_SUPPORTED':RISCV_COPROC_DOCS,
  160. 'SOC_LP_CORE_SUPPORTED':LP_CORE_DOCS,
  161. 'SOC_DIG_SIGN_SUPPORTED':['api-reference/peripherals/ds.rst'],
  162. 'SOC_HMAC_SUPPORTED':['api-reference/peripherals/hmac.rst'],
  163. 'SOC_ASYNC_MEMCPY_SUPPORTED':['api-reference/system/async_memcpy.rst'],
  164. 'CONFIG_IDF_TARGET_ARCH_XTENSA':XTENSA_DOCS,
  165. 'CONFIG_IDF_TARGET_ARCH_RISCV':RISCV_DOCS,
  166. 'SOC_TEMP_SENSOR_SUPPORTED':TEMP_SENSOR_DOCS,
  167. 'SOC_TWAI_SUPPORTED':TWAI_DOCS,
  168. 'SOC_I2S_SUPPORTED':I2S_DOCS,
  169. 'SOC_RTC_MEM_SUPPORTED': RTC_MEM_DOCS,
  170. 'SOC_ADC_SUPPORTED':ADC_DOCS,
  171. 'SOC_ADC_DMA_SUPPORTED':ADC_DMA_DOCS,
  172. 'SOC_ANA_CMPR_SUPPORTED': ANA_CMPR_DOCS,
  173. 'SOC_SDM_SUPPORTED':SDM_DOCS,
  174. 'SOC_WIFI_MESH_SUPPORT':WIFI_MESH_DOCS,
  175. 'SOC_SPI_SUPPORT_SLAVE_HD_VER2':SPI_SLAVE_HD_DOCS,
  176. 'SOC_WIFI_NAN_SUPPORT':NAN_DOCS,
  177. 'esp32':ESP32_DOCS,
  178. 'esp32s2':ESP32S2_DOCS,
  179. 'esp32s3':ESP32S3_DOCS,
  180. 'esp32c2':ESP32C2_DOCS,
  181. 'esp32c3':ESP32C3_DOCS,
  182. 'esp32c6':ESP32C6_DOCS,
  183. 'esp32h2':ESP32H2_DOCS,
  184. 'esp32p4':ESP32P4_DOCS}
  185. extensions += ['sphinx_copybutton',
  186. 'sphinxcontrib.wavedrom',
  187. # Note: order is important here, events must
  188. # be registered by one extension before they can be
  189. # connected to another extension
  190. 'esp_docs.idf_extensions.build_system',
  191. 'esp_docs.idf_extensions.esp_err_definitions',
  192. 'esp_docs.idf_extensions.gen_defines',
  193. 'esp_docs.idf_extensions.gen_version_specific_includes',
  194. 'esp_docs.idf_extensions.kconfig_reference',
  195. 'esp_docs.idf_extensions.gen_idf_tools_links',
  196. 'esp_docs.esp_extensions.run_doxygen',
  197. ]
  198. # Use wavedrompy as backend, insted of wavedrom-cli
  199. render_using_wavedrompy = True
  200. # link roles config
  201. github_repo = 'espressif/esp-idf'
  202. # context used by sphinx_idf_theme
  203. html_context['github_user'] = 'espressif'
  204. html_context['github_repo'] = 'esp-idf'
  205. # Extra options required by sphinx_idf_theme
  206. project_slug = 'esp-idf'
  207. versions_url = 'https://dl.espressif.com/dl/esp-idf/idf_versions.js'
  208. idf_targets = ['esp32', 'esp32s2', 'esp32s3', 'esp32c3', 'esp32c2', 'esp32c6', 'esp32p4']
  209. languages = ['en', 'zh_CN']
  210. google_analytics_id = os.environ.get('CI_GOOGLE_ANALYTICS_ID', None)
  211. project_homepage = 'https://github.com/espressif/esp-idf'
  212. linkcheck_anchors = False
  213. linkcheck_exclude_documents = ['index', # several false positives due to the way we link to different sections
  214. 'api-reference/protocols/esp_local_ctrl', # Fails due to `https://<mdns-hostname>.local`
  215. 'api-reference/provisioning/wifi_provisioning', # Fails due to `https://<mdns-hostname>.local`
  216. ]
  217. linkcheck_ignore = ['https://webhome.phy.duke.edu/~rgb/General/dieharder.php', # Certificate error
  218. 'https://docs.espressif.com/projects/esptool/en/latest/esp32c2/espefuse/index.html', # Not published
  219. 'https://docs.espressif.com/projects/esptool/en/latest/esp32c2/espsecure/index.html#remote-signing-using-an-external-hs', # Not published
  220. 'https://docs.espressif.com/projects/esptool/en/latest/esp32c6/espefuse/index.html', # Not published
  221. 'https://docs.espressif.com/projects/esptool/en/latest/esp32c6/espsecure/index.html#remote-signing-using-an-external-hs', # Not published
  222. 'https://docs.espressif.com/projects/esptool/en/latest/esp32h2/espefuse/index.html', # Not published
  223. 'https://docs.espressif.com/projects/esptool/en/latest/esp32h2/espsecure/index.html#remote-signing-using-an-external-hs', # Not published
  224. 'https://www.cadence.com/content/dam/cadence-www/global/en_US/documents/tools/ip/tensilica-ip/isa-summary.pdf', # Rejects user-agent
  225. ]
  226. # Custom added feature to allow redirecting old URLs
  227. with open('../page_redirects.txt') as f:
  228. lines = [re.sub(' +', ' ', line.strip()) for line in f.readlines() if line.strip() != '' and not line.startswith('#')]
  229. for line in lines: # check for well-formed entries
  230. if len(line.split(' ')) != 2:
  231. raise RuntimeError('Invalid line in page_redirects.txt: %s' % line)
  232. html_redirect_pages = [tuple(line.split(' ')) for line in lines]
  233. html_static_path = ['../_static']
  234. idf_build_system = {'doxygen_component_info': True, 'component_info_ignore_file': Path(os.environ['IDF_PATH']) / 'docs' / 'component_info_ignore_file.txt'}
  235. # Callback function for user setup that needs be done after `config-init`-event
  236. # config.idf_target is not available at the initial config stage
  237. def conf_setup(app, config):
  238. config.add_warnings_content = 'This document is not updated for {} yet, so some of the content may not be correct.'.format(config.idf_target.upper())
  239. add_warnings_file = '{}/../docs_not_updated/{}.txt'.format(app.confdir, config.idf_target)
  240. try:
  241. with open(add_warnings_file) as warning_file:
  242. config.add_warnings_pages = warning_file.read().splitlines()
  243. except FileNotFoundError:
  244. # Not for all target
  245. pass
  246. user_setup_callback = conf_setup