]> git.donarmstrong.com Git - kiibohd-controller.git/commitdiff
Fixing Mac OSX arm build options.
authorJacob Alexander <haata@kiibohd.com>
Mon, 15 Sep 2014 03:07:40 +0000 (20:07 -0700)
committerJacob Alexander <haata@kiibohd.com>
Mon, 15 Sep 2014 03:09:12 +0000 (20:09 -0700)
- Bootloader doesn't build correctly on gcc 4.7.3 (LTO issues)
- Even disabling isn't good enough
- 4.9.1 is known to work on Arch Linux

Bootloader/CMakeLists.txt
Lib/CMake/arm.cmake
Lib/CMake/build.cmake

index b8cb8a013195821a6887c986480c755d68544c11..00a9c168e9310a465dbe1c8d4ed2026d8ee61157 100644 (file)
@@ -112,6 +112,19 @@ endif()
 
 
 
+###
+# Disable -Wl,-search_paths_first for OSX (not supported by arm-none-eabi-gcc)
+#
+
+if ( APPLE )
+       string ( REPLACE "-Wl,-search_paths_first" "" CMAKE_C_LINK_FLAGS ${CMAKE_C_LINK_FLAGS} )
+       string ( REPLACE "-Wl,-search_paths_first" "" CMAKE_CXX_LINK_FLAGS ${CMAKE_CXX_LINK_FLAGS} )
+
+       message ( AUTHOR_WARNING "Bootloader binary may not fit on device (must be less than 4096 bytes). Macports arm-none-eabi-gcc 4.7.3 doesn't seem to work properly with -flto. However, even disabling it doesn't shrink the binary enough... 4.9.1 is known to work on Arch Linux." )
+endif ()
+
+
+
 ###
 # Build Targets
 #
index be2c8b3f5474b1e9a4e07423b6209f8585cff9d5..4b3d32084784298a45640d6817c8026c8b12f3f5 100644 (file)
@@ -122,7 +122,7 @@ set( WARN "-Wall -ggdb3" )
 #|  -f...:        tuning, see GCC manual
 #| NOTE: -fshort-wchar is specified to allow USB strings be passed conveniently
 if( BOOTLOADER )
-       set( TUNING "-D_bootloader_ -Wno-main -msoft-float -mthumb -fplan9-extensions -ffunction-sections -fdata-sections -fno-builtin -fstrict-volatile-bitfields -flto -fno-use-linker-plugin" )
+       set( TUNING "-D_bootloader_ -Wno-main -msoft-float -mthumb -fplan9-extensions -ffunction-sections -fdata-sections -fno-builtin -fstrict-volatile-bitfields -flto -fno-use-linker-plugin -nostdlib" )
        #set( TUNING "-mthumb -fdata-sections -ffunction-sections -fno-builtin -msoft-float -fstrict-volatile-bitfields -flto -fno-use-linker-plugin -fwhole-program -Wno-main -nostartfiles -fplan9-extensions -D_bootloader_" )
 else()
        set( TUNING "-mthumb -nostdlib -fdata-sections -ffunction-sections -fshort-wchar -fno-builtin -nostartfiles" )
@@ -156,10 +156,9 @@ add_definitions( "-mcpu=${CPU} -DF_CPU=${F_CPU} -D_${CHIP}_=1 -O${OPT} ${TUNING}
 if( BOOTLOADER )
        # Bootloader linker flags
        set( LINKER_FLAGS "${TUNING} -Wl,--gc-sections -fwhole-program -T${CMAKE_CURRENT_SOURCE_DIR}/../Lib/${CHIP}.bootloader.ld -nostartfiles -Wl,-Map=link.map" )
-       #set( LINKER_FLAGS "-Wl,-Map=link.map,--cref -Wl,--gc-sections -Wl,--no-wchar-size-warning -T${CMAKE_CURRENT_SOURCE_DIR}/../Lib/${CHIP}.bootloader.ld" )
 else()
        # Normal linker flags
-       set( LINKER_FLAGS "-Wl,-Map=link.map,--cref -Wl,--gc-sections -Wl,--no-wchar-size-warning -T${CMAKE_CURRENT_SOURCE_DIR}/Lib/${CHIP}.ld" )
+       set( LINKER_FLAGS "${TUNING} -Wl,-Map=link.map,--cref -Wl,--gc-sections -Wl,--no-wchar-size-warning -T${CMAKE_CURRENT_SOURCE_DIR}/Lib/${CHIP}.ld" )
 endif()
 
 
index 54f2fd2ea5822ed84c5321ec315f19069abc635f..ece5ee209fe7e074d1a95daf9b17cca7965d4ba6 100644 (file)
@@ -8,10 +8,10 @@
 
 
 ###
-# Disable -Wl,-search_paths_first for AVR on OSX (not supported by avr-gcc)
+# Disable -Wl,-search_paths_first for OSX (not supported by avr-gcc or arm-none-eabi-gcc)
 #
 
-if ( "${CPU}" STREQUAL "megaAVR" AND APPLE )
+if ( APPLE )
        string ( REPLACE "-Wl,-search_paths_first" "" CMAKE_C_LINK_FLAGS ${CMAKE_C_LINK_FLAGS} )
        string ( REPLACE "-Wl,-search_paths_first" "" CMAKE_CXX_LINK_FLAGS ${CMAKE_CXX_LINK_FLAGS} )
 endif ()