conf_common.py 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  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. from esp_docs.conf_docs import * # noqa: F403,F401
  13. if os.environ.get('IDF_PATH') is None:
  14. raise RuntimeError('IDF_PATH should be set, run export.sh before building docs')
  15. BT_DOCS = ['api-guides/blufi.rst',
  16. 'api-guides/esp-ble-mesh/**',
  17. 'api-reference/bluetooth/bt_le.rst',
  18. 'api-reference/bluetooth/esp_bt_defs.rst',
  19. 'api-reference/bluetooth/esp_bt_device.rst',
  20. 'api-reference/bluetooth/esp_bt_main.rst',
  21. 'api-reference/bluetooth/bt_common.rst',
  22. 'api-reference/bluetooth/controller_vhci.rst',
  23. 'api-reference/bluetooth/esp_gap_ble.rst',
  24. 'api-reference/bluetooth/esp_gatt_defs.rst',
  25. 'api-reference/bluetooth/esp_gatts.rst',
  26. 'api-reference/bluetooth/esp_gattc.rst',
  27. 'api-reference/bluetooth/esp_blufi.rst',
  28. 'api-reference/bluetooth/esp-ble-mesh.rst',
  29. 'api-reference/bluetooth/index.rst',
  30. 'api-reference/bluetooth/nimble/index.rst']
  31. CLASSIC_BT_DOCS = ['api-reference/bluetooth/classic_bt.rst',
  32. 'api-reference/bluetooth/esp_a2dp.rst',
  33. 'api-reference/bluetooth/esp_avrc.rst',
  34. 'api-reference/bluetooth/esp_hf_defs.rst',
  35. 'api-reference/bluetooth/esp_hf_client.rst',
  36. 'api-reference/bluetooth/esp_hf_ag.rst',
  37. 'api-reference/bluetooth/esp_spp.rst',
  38. 'api-reference/bluetooth/esp_gap_bt.rst']
  39. SDMMC_DOCS = ['api-reference/peripherals/sdmmc_host.rst',
  40. 'api-reference/peripherals/sd_pullup_requirements.rst']
  41. SDIO_SLAVE_DOCS = ['api-reference/peripherals/sdio_slave.rst',
  42. 'api-reference/protocols/esp_sdio_slave_protocol.rst']
  43. MCPWM_DOCS = ['api-reference/peripherals/mcpwm.rst']
  44. DEDIC_GPIO_DOCS = ['api-reference/peripherals/dedic_gpio.rst']
  45. PCNT_DOCS = ['api-reference/peripherals/pcnt.rst']
  46. DAC_DOCS = ['api-reference/peripherals/dac.rst']
  47. TEMP_SENSOR_DOCS = ['api-reference/peripherals/temp_sensor.rst']
  48. TOUCH_SENSOR_DOCS = ['api-reference/peripherals/touch_pad.rst']
  49. SPIRAM_DOCS = ['api-guides/external-ram.rst']
  50. LEGACY_DOCS = ['api-guides/build-system-legacy.rst',
  51. 'gnu-make-legacy.rst',
  52. 'api-guides/ulp-legacy.rst',
  53. 'api-guides/unit-tests-legacy.rst',
  54. 'get-started-legacy/**']
  55. USB_DOCS = ['api-reference/peripherals/usb_device.rst',
  56. 'api-reference/peripherals/usb_host.rst',
  57. 'api-guides/usb-otg-console.rst',
  58. 'api-guides/dfu.rst']
  59. FTDI_JTAG_DOCS = ['api-guides/jtag-debugging/configure-ft2232h-jtag.rst']
  60. USB_SERIAL_JTAG_DOCS = ['api-guides/jtag-debugging/configure-builtin-jtag.rst',
  61. 'api-guides/usb-serial-jtag-console.rst']
  62. ULP_DOCS = ['api-guides/ulp.rst', 'api-guides/ulp_macros.rst']
  63. RISCV_COPROC_DOCS = ['api-guides/ulp-risc-v.rst',]
  64. XTENSA_DOCS = ['api-guides/hlinterrupts.rst',
  65. 'api-reference/system/perfmon.rst']
  66. RISCV_DOCS = [] # type: list[str]
  67. ESP32_DOCS = ['api-guides/ulp_instruction_set.rst',
  68. 'api-reference/system/himem.rst',
  69. 'api-guides/romconsole.rst',
  70. 'api-reference/system/ipc.rst',
  71. 'security/secure-boot-v1.rst',
  72. 'api-reference/peripherals/secure_element.rst',
  73. 'api-reference/peripherals/dac.rst',
  74. 'hw-reference/esp32/**'] + LEGACY_DOCS + FTDI_JTAG_DOCS
  75. ESP32S2_DOCS = ['hw-reference/esp32s2/**',
  76. 'api-guides/ulps2_instruction_set.rst',
  77. 'api-guides/usb-console.rst',
  78. 'api-reference/peripherals/ds.rst',
  79. 'api-reference/peripherals/spi_slave_hd.rst',
  80. 'api-reference/peripherals/temp_sensor.rst',
  81. 'api-reference/system/async_memcpy.rst',
  82. 'api-reference/peripherals/touch_element.rst'] + FTDI_JTAG_DOCS
  83. ESP32S3_DOCS = ['hw-reference/esp32s3/**',
  84. 'api-reference/system/ipc.rst',
  85. 'api-guides/flash_psram_config.rst']
  86. # No JTAG docs for this one as it gets gated on SOC_USB_SERIAL_JTAG_SUPPORTED down below.
  87. ESP32C3_DOCS = ['hw-reference/esp32c3/**']
  88. # format: {tag needed to include: documents to included}, tags are parsed from sdkconfig and peripheral_caps.h headers
  89. conditional_include_dict = {'SOC_BT_SUPPORTED':BT_DOCS,
  90. 'SOC_CLASSIC_BT_SUPPORTED':CLASSIC_BT_DOCS,
  91. 'SOC_SDMMC_HOST_SUPPORTED':SDMMC_DOCS,
  92. 'SOC_SDIO_SLAVE_SUPPORTED':SDIO_SLAVE_DOCS,
  93. 'SOC_MCPWM_SUPPORTED':MCPWM_DOCS,
  94. 'SOC_USB_OTG_SUPPORTED':USB_DOCS,
  95. 'SOC_USB_SERIAL_JTAG_SUPPORTED':USB_SERIAL_JTAG_DOCS,
  96. 'SOC_DEDICATED_GPIO_SUPPORTED':DEDIC_GPIO_DOCS,
  97. 'SOC_SPIRAM_SUPPORTED':SPIRAM_DOCS,
  98. 'SOC_PCNT_SUPPORTED':PCNT_DOCS,
  99. 'SOC_DAC_SUPPORTED':DAC_DOCS,
  100. 'SOC_TOUCH_SENSOR_NUM':TOUCH_SENSOR_DOCS,
  101. 'SOC_ULP_SUPPORTED':ULP_DOCS,
  102. 'SOC_RISCV_COPROC_SUPPORTED':RISCV_COPROC_DOCS,
  103. 'SOC_DIG_SIGN_SUPPORTED':['api-reference/peripherals/ds.rst'],
  104. 'SOC_HMAC_SUPPORTED':['api-reference/peripherals/hmac.rst'],
  105. 'SOC_ASYNC_MEMCPY_SUPPORTED':['api-reference/system/async_memcpy.rst'],
  106. 'CONFIG_IDF_TARGET_ARCH_XTENSA':XTENSA_DOCS,
  107. 'CONFIG_IDF_TARGET_ARCH_RISCV':RISCV_DOCS,
  108. 'SOC_TEMP_SENSOR_SUPPORTED':TEMP_SENSOR_DOCS,
  109. 'esp32':ESP32_DOCS,
  110. 'esp32s2':ESP32S2_DOCS,
  111. 'esp32s3':ESP32S3_DOCS,
  112. 'esp32c3':ESP32C3_DOCS}
  113. extensions += ['sphinx_copybutton',
  114. # Note: order is important here, events must
  115. # be registered by one extension before they can be
  116. # connected to another extension
  117. 'esp_docs.idf_extensions.build_system',
  118. 'esp_docs.idf_extensions.esp_err_definitions',
  119. 'esp_docs.idf_extensions.gen_toolchain_links',
  120. 'esp_docs.idf_extensions.gen_defines',
  121. 'esp_docs.idf_extensions.gen_version_specific_includes',
  122. 'esp_docs.idf_extensions.kconfig_reference',
  123. 'esp_docs.idf_extensions.gen_idf_tools_links',
  124. 'esp_docs.esp_extensions.run_doxygen',
  125. ]
  126. # link roles config
  127. github_repo = 'espressif/esp-idf'
  128. # context used by sphinx_idf_theme
  129. html_context['github_user'] = 'espressif'
  130. html_context['github_repo'] = 'esp-idf'
  131. # Extra options required by sphinx_idf_theme
  132. project_slug = 'esp-idf'
  133. versions_url = 'https://dl.espressif.com/dl/esp-idf/idf_versions.js'
  134. idf_targets = ['esp32', 'esp32s2', 'esp32s3', 'esp32c3']
  135. languages = ['en', 'zh_CN']
  136. google_analytics_id = os.environ.get('CI_GOOGLE_ANALYTICS_ID', None)
  137. project_homepage = 'https://github.com/espressif/esp-idf'
  138. # Custom added feature to allow redirecting old URLs
  139. with open('../page_redirects.txt') as f:
  140. lines = [re.sub(' +', ' ', line.strip()) for line in f.readlines() if line.strip() != '' and not line.startswith('#')]
  141. for line in lines: # check for well-formed entries
  142. if len(line.split(' ')) != 2:
  143. raise RuntimeError('Invalid line in page_redirects.txt: %s' % line)
  144. html_redirect_pages = [tuple(line.split(' ')) for line in lines]