toolchain.cmake 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. set(CMAKE_SYSTEM_NAME Generic)
  2. set(CMAKE_SYSTEM_PROCESSOR MICROBLAZE)
  3. if(MINGW OR CYGWIN OR WIN32)
  4. set(UTIL_SEARCH_CMD where)
  5. elseif(UNIX OR APPLE)
  6. set(UTIL_SEARCH_CMD which)
  7. endif()
  8. set(TOOLCHAIN_PREFIX mb-)
  9. execute_process(
  10. COMMAND ${UTIL_SEARCH_CMD} ${TOOLCHAIN_PREFIX}gcc
  11. OUTPUT_VARIABLE BINUTILS_PATH
  12. OUTPUT_STRIP_TRAILING_WHITESPACE
  13. )
  14. get_filename_component(XIL_TOOLCHAIN_DIR ${BINUTILS_PATH} DIRECTORY)
  15. set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
  16. set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}gcc)
  17. set(CMAKE_ASM_COMPILER ${CMAKE_C_COMPILER})
  18. set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}g++)
  19. set(CMAKE_OBJCOPY ${XIL_TOOLCHAIN_DIR}/${TOOLCHAIN_PREFIX}objcopy CACHE INTERNAL "objcopy tool")
  20. set(CMAKE_SIZE_UTIL ${XIL_TOOLCHAIN_DIR}/${TOOLCHAIN_PREFIX}size CACHE INTERNAL "size tool")
  21. set(CMAKE_FIND_ROOT_PATH ${BINUTILS_PATH})
  22. set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
  23. set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
  24. set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
  25. add_compile_options(
  26. "-Wall"
  27. "-I${XIL_STANDALONE_BSP_INCLUDE}"
  28. "-fmessage-length=0"
  29. "-mno-xl-reorder"
  30. "-mlittle-endian"
  31. "-mxl-barrel-shift"
  32. "-mxl-pattern-compare"
  33. "-mcpu=v11.0"
  34. "-mno-xl-soft-mul"
  35. "-mhard-float"
  36. "-mno-xl-soft-div"
  37. "-Wl,--no-relax"
  38. "-ffunction-sections"
  39. "-fdata-sections"
  40. "-MMD"
  41. "-MP"
  42. )
  43. add_link_options(
  44. "-L${XIL_STANDALONE_BSP_LIB}"
  45. "-Wl,-T"
  46. "-Wl,${CMAKE_CURRENT_LIST_DIR}/lscript.ld"
  47. "-mlittle-endian"
  48. "-mxl-barrel-shift"
  49. "-mxl-pattern-compare"
  50. "-mcpu=v11.0"
  51. "-mno-xl-soft-mul"
  52. "-mhard-float"
  53. "-mno-xl-soft-div"
  54. "-Wl,-no-relax"
  55. "-Wl,--gc-sections"
  56. "-Wl,--start-group,-lxil,-lgcc,-lc,-lstdc++,--end-group"
  57. )