include("../extra/sh-elf-linux.cmake")
include("../config.cmake")
+set(CARL9170_FW_ELF carl9170.elf)
set(CARLFW_CFLAGS_WARNING "-W -Wall -Wextra -Wunreachable-code -Winline -Wlogical-op -Wno-packed-bitfield-compat -Winit-self -Wshadow -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wformat=2 -Wcast-align -Wmissing-format-attribute -Wmissing-prototypes -Wtype-limits -Wmissing-declarations -Wmissing-noreturn -Wredundant-decls -Wnested-externs -Wdisabled-optimization -Wpointer-arith -Wvolatile-register-var -Waddress -Wbad-function-cast -Wunsafe-loop-optimizations")
set(CARLFW_CFLAGS_EXTRA "-mbitops -std=gnu99 -ffunction-sections -Wframe-larger-than=128 -Werror")
set(CARLFW_CFLAGS_DEF "-D__CARL9170FW__")
if (CONFIG_CARL9170FW_AGGRESSIVE_CFLAGS)
- set(CARLFW_CFLAGS_AGGRESSIVE "-fomit-frame-pointer -fsee -frename-registers -ftree-vectorize -flto -fstrict-volatile-bitfields -fmodulo-sched")
+ set(CARLFW_CFLAGS_AGGRESSIVE "-fomit-frame-pointer -fsee -frename-registers -ftree-vectorize -flto -fstrict-volatile-bitfields -fmodulo-sched -fwhole-program")
endif (CONFIG_CARL9170FW_AGGRESSIVE_CFLAGS)
+set(CARLFW_CFLAGS "${CARLFW_CFLAGS_DEF} ${CARLFW_CFLAGS_EXTRA} ${CARLFW_CFLAGS_AGGRESSIVE} ${CARLFW_CFLAGS_WARNING}")
include_directories (../include/linux ../include/shared ../include include)
set_target_properties(carl9170.elf PROPERTIES LINKER_LANGUAGE C)
-set_target_properties(carl9170.elf PROPERTIES COMPILE_FLAGS
- " ${CARLFW_CFLAGS_DEF} ${CARLFW_CFLAGS_EXTRA} ${CARLFW_CFLAGS_AGGRESSIVE} ${CARLFW_CFLAGS_WARNING}")
-set_target_properties(carl9170.elf PROPERTIES LINK_FLAGS "-Tcarl9170.lds")
-
-
+set_target_properties(carl9170.elf PROPERTIES COMPILE_FLAGS "${CARLFW_CFLAGS}")
+set_target_properties(carl9170.elf PROPERTIES LINK_FLAGS "${CARLFW_CFLAGS} -Wl,-Tcarl9170.lds")
add_custom_target(firmware ALL)
more \
}
-const struct carl9170_firmware_descriptor __section(fwdsc) carl9170fw_desc = {
+const struct carl9170_firmware_descriptor __section(fwdsc) __visible carl9170fw_desc = {
FILL(otus, OTUS,
.feature_set = cpu_to_le32(BIT(CARL9170FW_DUMMY_FEATURE) |
BIT(CARL9170FW_USB_RESP_EP2) |
* we put _start() there with the linker script carl9170.lds.
*/
-void __section(boot) start(void)
+void __section(boot) __noreturn __visible start(void)
{
clock_set(AHB_40MHZ_OSC, true);
.global ___udivsi3_i4i
.global ___udivsi3_i4
.set ___udivsi3_i4, ___udivsi3_i4i
- .type ___udivsi3_i4i, @function
- .type ___sdivsi3_i4i, @function
___udivsi3_i4i:
sts pr,r1
mov.l r4,@-r15
set(CMAKE_FIND_ROOT_PATH ${CMAKE_SOURCE_DIR}/toolchain/inst/)
set(CMAKE_C_FLAGS "-m2 -ml -Os -ffreestanding -nostartfiles")
-set(CMAKE_C_LINK_FLAGS "-static -EL -x --gc-sections")
+set(CMAKE_C_LINK_FLAGS "-Wl,-static,-EL,-x,--gc-sections")
set(OBJCOPY ${CMAKE_SOURCE_DIR}/toolchain/inst/bin/sh-elf-objcopy)
set(CMAKE_C_COMPILER "${CMAKE_SOURCE_DIR}/toolchain/inst/bin/sh-elf-gcc")
set(CMAKE_ASM_COMPILER ${CMAKE_SOURCE_DIR}/toolchain/inst/bin/sh-elf-as)
set(CMAKE_ASM-ATT_COMPILER ${CMAKE_SOURCE_DIR}/toolchain/inst/bin/sh-elf-as)
set(CMAKE_LINKER ${CMAKE_SOURCE_DIR}/toolchain/inst/bin/sh-elf-ld)
-set(CMAKE_C_LINK_EXECUTABLE "${CMAKE_SOURCE_DIR}/toolchain/inst/bin/sh-elf-ld <OBJECTS> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> -o <TARGET>")
+set(CMAKE_C_LINK_EXECUTABLE "${CMAKE_SOURCE_DIR}/toolchain/inst/bin/sh-elf-gcc <OBJECTS> ${CMAKE_C_FLAGS} <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> -o <TARGET>")
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
#define __section(s) __attribute__((section("." # s)))
#define __aligned(a) __attribute__((aligned(a)))
#define __packed __attribute__((packed))
+#define __visible __attribute__((externally_visible))
#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
#define BUILD_BUG_ON_ZERO(e) (sizeof(char[1 - 2 * !!(e)]) - 1)