CMakeLists.txt 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. SET(CMAKE_C_COMPILER_WORKS 1)
  2. CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
  3. PROJECT(ath9k_firmware NONE)
  4. ENABLE_LANGUAGE(C)
  5. ADD_DEFINITIONS(-g -Os -Wunused-label -Wunused-variable -Wunused-value -Wpointer-arith -Wundef -nostdlib -Wundef)
  6. ADD_DEFINITIONS(
  7. -D_RAM_
  8. -DBIG_ENDIAN -D_BYTE_ORDER=_BIG_ENDIAN
  9. -D__XTENSA__
  10. -DFUSION_USB_FW -DRX_SCATTER
  11. -DFUSION_USB_ENABLE_TX_STREAM -DFUSION_USB_ENABLE_RX_STREAM
  12. -DATH_ENABLE_CABQ
  13. )
  14. SET(SOURCES
  15. magpie_fw_dev/target/init/app_start.c
  16. magpie_fw_dev/target/init/init.c
  17. magpie_fw_dev/target/init/magpie.c
  18. magpie_fw_dev/target/adf/adf_nbuf.c
  19. magpie_fw_dev/target/adf/adf_net.c
  20. magpie_fw_dev/target/adf/adf_os_defer_pvt.c
  21. magpie_fw_dev/target/adf/adf_os_dma.c
  22. magpie_fw_dev/target/adf/adf_os_irq_pvt.c
  23. magpie_fw_dev/target/adf/adf_os_timer.c
  24. magpie_fw_dev/target/buf_pool/buf_pool_static.c
  25. magpie_fw_dev/target/cmnos/dbg_api.c
  26. magpie_fw_dev/target/cmnos/cmnos_sflash.c
  27. wlan/ah.c
  28. wlan/ah_osdep.c
  29. wlan/ar5416Phy.c
  30. wlan/ar5416_hw.c
  31. wlan/ar5416_phy.c
  32. wlan/ratectrl_11n_ln.c
  33. wlan/if_owl.c
  34. wlan/if_ath.c
  35. wlan/if_ath_pci.c
  36. magpie_fw_dev/target/wlan/wlan_pci.c
  37. wlan/ieee80211_output.c
  38. magpie_fw_dev/target/htc/htc.c
  39. magpie_fw_dev/target/wmi/wmi_svc.c
  40. )
  41. IF(TARGET_K2)
  42. SET(SOURCES ${SOURCES}
  43. magpie_fw_dev/target/hif/k2_HIF_usb_patch.c
  44. magpie_fw_dev/target/hif/k2_fw_usb_api.c
  45. )
  46. SET(LIBS ${LIBS} hif)
  47. ADD_DEFINITIONS(-DPROJECT_K2)
  48. SET(PLATFORM_NAME k2)
  49. SET(SOURCES ${SOURCES}
  50. magpie_fw_dev/target/cmnos/k2_cmnos_clock_patch.c
  51. magpie_fw_dev/target/cmnos/k2_fw_cmnos_printf.c
  52. )
  53. SET(FIRMWARE_NAME htc_9271.fw)
  54. ELSEIF(TARGET_MAGPIE)
  55. ADD_DEFINITIONS(
  56. -DROM_VER_1_1 -D_ROM_1_1_
  57. -DPROJECT_MAGPIE
  58. -DMAGPIE_MERLIN
  59. )
  60. SET(SOURCES ${SOURCES}
  61. magpie_fw_dev/target/rompatch/cmnos_clock_patch.c
  62. magpie_fw_dev/target/rompatch/usb_api_patch.c
  63. magpie_fw_dev/target/rompatch/HIF_usb_patch.c
  64. )
  65. INCLUDE_DIRECTORIES(
  66. ${CMAKE_SOURCE_DIR}/magpie_fw_dev/target/adf
  67. magpie_fw_dev/build/magpie_1_1/inc
  68. magpie_fw_dev/build/magpie_1_1/inc/magpie
  69. )
  70. SET(PLATFORM_NAME magpie)
  71. SET(FIRMWARE_NAME htc_7010.fw)
  72. ELSE()
  73. MESSAGE(FATAL_ERROR "Unknown target name")
  74. ENDIF()
  75. INCLUDE_DIRECTORIES(
  76. ${CMAKE_SOURCE_DIR}/magpie_fw_dev/build/include
  77. ${CMAKE_SOURCE_DIR}/magpie_fw_dev/build/include/xtensa-elf
  78. ${CMAKE_SOURCE_DIR}/magpie_fw_dev/target/inc
  79. ${CMAKE_SOURCE_DIR}/magpie_fw_dev/target/inc/${PLATFORM_NAME}
  80. ${CMAKE_SOURCE_DIR}/magpie_fw_dev/target/inc/${PLATFORM_NAME}/${PLATFORM_NAME}
  81. ${CMAKE_SOURCE_DIR}/wlan
  82. ${CMAKE_SOURCE_DIR}/wlan/include
  83. ${CMAKE_SOURCE_DIR}/wlan/include/${PLATFORM_NAME}
  84. ${CMAKE_SOURCE_DIR}/magpie_fw_dev/target/wlan
  85. ${CMAKE_SOURCE_DIR}/magpie_fw_dev/target/cmnos
  86. ${CMAKE_SOURCE_DIR}/magpie_fw_dev/target/wmi
  87. ${CMAKE_SOURCE_DIR}/magpie_fw_dev/target/adf
  88. ${CMAKE_SOURCE_DIR}/magpie_fw_dev/target/buf_pool
  89. ${CMAKE_SOURCE_DIR}/magpie_fw_dev/target/htc
  90. )
  91. ADD_LIBRARY(firmware ${SOURCES})
  92. ADD_CUSTOM_COMMAND(
  93. OUTPUT fw.elf
  94. DEPENDS firmware
  95. COMMAND ${CMAKE_C_COMPILER}
  96. -nostdlib
  97. -Wl,--start-group
  98. ${CMAKE_BINARY_DIR}/libfirmware.a
  99. -Wl,--end-group
  100. -Wl,-T,${CMAKE_SOURCE_DIR}/ram-${PLATFORM_NAME}.ld
  101. -Wl,-T,${CMAKE_SOURCE_DIR}/rom-addrs-${PLATFORM_NAME}.ld
  102. -o fw.elf
  103. )
  104. ADD_CUSTOM_COMMAND(
  105. OUTPUT fw.bin
  106. DEPENDS fw.elf
  107. COMMAND ${CMAKE_OBJCOPY}
  108. --change-section-lma .text-0x400000
  109. --change-section-vma .text-0x400000
  110. -O binary fw.elf fw.bin
  111. )
  112. ADD_CUSTOM_COMMAND(
  113. OUTPUT ${FIRMWARE_NAME}
  114. DEPENDS fw.bin
  115. COMMAND ${CMAKE_SOURCE_DIR}/firmware-crc.pl < fw.bin > ${FIRMWARE_NAME}
  116. )
  117. ADD_CUSTOM_TARGET(gen-firmware ALL DEPENDS ${FIRMWARE_NAME})