CMakeLists.txt 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. ##
  2. # Copyright (c) 2013 Qualcomm Atheros, Inc.
  3. #
  4. # All rights reserved.
  5. #
  6. # Redistribution and use in source and binary forms, with or without
  7. # modification, are permitted (subject to the limitations in the
  8. # disclaimer below) provided that the following conditions are met:
  9. #
  10. # * Redistributions of source code must retain the above copyright
  11. # notice, this list of conditions and the following disclaimer.
  12. #
  13. # * Redistributions in binary form must reproduce the above copyright
  14. # notice, this list of conditions and the following disclaimer in the
  15. # documentation and/or other materials provided with the
  16. # distribution.
  17. #
  18. # * Neither the name of Qualcomm Atheros nor the names of its
  19. # contributors may be used to endorse or promote products derived
  20. # from this software without specific prior written permission.
  21. #
  22. # NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
  23. # GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
  24. # HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
  25. # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  26. # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  27. # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  28. # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  29. # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  30. # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
  31. # BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  32. # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
  33. # OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
  34. # IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  35. ##
  36. SET(CMAKE_C_COMPILER_WORKS 1)
  37. CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
  38. PROJECT(ath9k_firmware NONE)
  39. ENABLE_LANGUAGE(C)
  40. ADD_DEFINITIONS(
  41. -g -Os
  42. -Wunused-label
  43. -Wunused-variable
  44. -Wunused-value
  45. -Wpointer-arith
  46. -nostdlib
  47. -Wundef
  48. -Wunused-but-set-variable
  49. -Wmaybe-uninitialized
  50. )
  51. ADD_DEFINITIONS(
  52. -D_RAM_
  53. -DBIG_ENDIAN -D_BYTE_ORDER=_BIG_ENDIAN
  54. -D__XTENSA__
  55. -DFUSION_USB_FW -DRX_SCATTER
  56. -DFUSION_USB_ENABLE_TX_STREAM -DFUSION_USB_ENABLE_RX_STREAM
  57. -DATH_ENABLE_CABQ
  58. )
  59. SET(SOURCES
  60. magpie_fw_dev/target/init/app_start.c
  61. magpie_fw_dev/target/init/init.c
  62. magpie_fw_dev/target/init/magpie.c
  63. magpie_fw_dev/target/adf/adf_nbuf.c
  64. magpie_fw_dev/target/adf/adf_net.c
  65. magpie_fw_dev/target/adf/adf_os_defer_pvt.c
  66. magpie_fw_dev/target/adf/adf_os_dma.c
  67. magpie_fw_dev/target/adf/adf_os_irq_pvt.c
  68. magpie_fw_dev/target/adf/adf_os_timer.c
  69. magpie_fw_dev/target/buf_pool/buf_pool_static.c
  70. magpie_fw_dev/target/cmnos/dbg_api.c
  71. magpie_fw_dev/target/cmnos/cmnos_sflash.c
  72. magpie_fw_dev/target/hif/usb_api_main_patch.c
  73. wlan/ah.c
  74. wlan/ah_osdep.c
  75. wlan/ar5416Phy.c
  76. wlan/ar5416_hw.c
  77. wlan/ar5416_phy.c
  78. wlan/ratectrl_11n_ln.c
  79. wlan/if_owl.c
  80. wlan/if_ath.c
  81. wlan/if_ath_pci.c
  82. magpie_fw_dev/target/wlan/wlan_pci.c
  83. wlan/ieee80211_output.c
  84. magpie_fw_dev/target/htc/htc.c
  85. magpie_fw_dev/target/wmi/wmi_svc.c
  86. )
  87. IF(TARGET_K2)
  88. SET(SOURCES ${SOURCES}
  89. magpie_fw_dev/target/hif/k2_HIF_usb_patch.c
  90. magpie_fw_dev/target/hif/usb_api_k2_patch.c
  91. )
  92. SET(LIBS ${LIBS} hif)
  93. ADD_DEFINITIONS(-DPROJECT_K2)
  94. SET(PLATFORM_NAME k2)
  95. SET(SOURCES ${SOURCES}
  96. magpie_fw_dev/target/cmnos/k2_cmnos_clock_patch.c
  97. magpie_fw_dev/target/cmnos/k2_fw_cmnos_printf.c
  98. )
  99. SET(FIRMWARE_NAME htc_9271.fw)
  100. ELSEIF(TARGET_MAGPIE)
  101. ADD_DEFINITIONS(
  102. -DROM_VER_1_1 -D_ROM_1_1_
  103. -DPROJECT_MAGPIE
  104. -DMAGPIE_MERLIN
  105. )
  106. SET(SOURCES ${SOURCES}
  107. magpie_fw_dev/target/hif/usb_api_magpie_patch.c
  108. magpie_fw_dev/target/rompatch/cmnos_clock_patch.c
  109. magpie_fw_dev/target/rompatch/HIF_usb_patch.c
  110. )
  111. INCLUDE_DIRECTORIES(
  112. ${CMAKE_SOURCE_DIR}/magpie_fw_dev/target/adf
  113. )
  114. SET(PLATFORM_NAME magpie)
  115. SET(FIRMWARE_NAME htc_7010.fw)
  116. ELSE()
  117. MESSAGE(FATAL_ERROR "Unknown target name")
  118. ENDIF()
  119. INCLUDE_DIRECTORIES(
  120. ${CMAKE_SOURCE_DIR}/include
  121. ${CMAKE_SOURCE_DIR}/magpie_fw_dev/target/
  122. ${CMAKE_SOURCE_DIR}/magpie_fw_dev/target/inc
  123. ${CMAKE_SOURCE_DIR}/magpie_fw_dev/target/inc/xtensa-elf
  124. ${CMAKE_SOURCE_DIR}/magpie_fw_dev/target/inc/${PLATFORM_NAME}
  125. ${CMAKE_SOURCE_DIR}/magpie_fw_dev/target/inc/${PLATFORM_NAME}/${PLATFORM_NAME}
  126. ${CMAKE_SOURCE_DIR}/wlan
  127. ${CMAKE_SOURCE_DIR}/wlan/include
  128. ${CMAKE_SOURCE_DIR}/wlan/include/${PLATFORM_NAME}
  129. ${CMAKE_SOURCE_DIR}/magpie_fw_dev/target/wlan
  130. ${CMAKE_SOURCE_DIR}/magpie_fw_dev/target/cmnos
  131. ${CMAKE_SOURCE_DIR}/magpie_fw_dev/target/wmi
  132. ${CMAKE_SOURCE_DIR}/magpie_fw_dev/target/adf
  133. ${CMAKE_SOURCE_DIR}/magpie_fw_dev/target/buf_pool
  134. ${CMAKE_SOURCE_DIR}/magpie_fw_dev/target/htc
  135. )
  136. ADD_LIBRARY(firmware ${SOURCES})
  137. ADD_CUSTOM_COMMAND(
  138. OUTPUT fw.elf
  139. DEPENDS firmware
  140. COMMAND ${CMAKE_C_COMPILER}
  141. -nostdlib
  142. -fno-lto
  143. -Wl,--start-group
  144. ${CMAKE_BINARY_DIR}/libfirmware.a
  145. -Wl,--end-group
  146. -Wl,-T,${CMAKE_SOURCE_DIR}/ram-${PLATFORM_NAME}.ld
  147. -Wl,-T,${CMAKE_SOURCE_DIR}/rom-addrs-${PLATFORM_NAME}.ld
  148. -o fw.elf
  149. )
  150. ADD_CUSTOM_COMMAND(
  151. OUTPUT fw.bin
  152. DEPENDS fw.elf
  153. COMMAND ${CMAKE_OBJCOPY}
  154. --change-section-lma .boot-0x400000
  155. --change-section-vma .boot-0x400000
  156. --change-section-lma .text-0x400000
  157. --change-section-vma .text-0x400000
  158. -O binary fw.elf fw.bin
  159. )
  160. ADD_CUSTOM_COMMAND(
  161. OUTPUT ${FIRMWARE_NAME}
  162. DEPENDS fw.bin
  163. COMMAND ${CMAKE_SOURCE_DIR}/firmware-crc.pl < fw.bin > ${FIRMWARE_NAME}
  164. )
  165. ADD_CUSTOM_TARGET(gen-firmware ALL DEPENDS ${FIRMWARE_NAME})