Home | History | Annotate | Download | only in build
      1 
      2 
      3 ##
      4 ##
      5 ## Make Flags
      6 ##
      7 ##
      8 
      9 NO_ARCH_STRCMP ?= y
     10 NO_USERMODE_WORKAROUND ?= n
     11 MEM_ALLOC_TRACE ?= n
     12 STACK_PROFILING_ON ?= n
     13 
     14 ##
     15 ##
     16 ## File lists and locations
     17 ##
     18 ##
     19 
     20 #
     21 # DK_ROOT must be set prior to including common.inc
     22 #
     23 DK_ROOT = ../../../..
     24 
     25 #
     26 # Includes common definitions and source file list
     27 #
     28 ifneq ($(KERNELRELEASE),)
     29     include $(M)/$(DK_ROOT)/stad/build/linux/common.inc
     30     include $(M)/$(DK_ROOT)/platforms/os/linux/build/os_sources.inc
     31 else
     32     include $(DK_ROOT)/stad/build/linux/common.inc
     33     include $(DK_ROOT)/platforms/os/linux/build/os_sources.inc
     34 endif
     35 
     36 
     37 #
     38 # List of linux OS files needed to be compiled
     39 #
     40 OS_SRCS = \
     41     $(DK_ROOT)/platforms/os/linux/src/WlanDrvIf.c \
     42     $(DK_ROOT)/platforms/os/linux/src/osapi.c \
     43     $(DK_ROOT)/platforms/os/linux/src/osmemapi.c \
     44     $(DK_ROOT)/platforms/os/linux/src/osRgstry_parser.c \
     45     $(DK_ROOT)/platforms/os/linux/src/ipc_k.c \
     46     $(DK_ROOT)/platforms/os/linux/src/WlanDrvWext.c \
     47     $(DK_ROOT)/platforms/os/linux/src/CmdInterpretWext.c \
     48     $(DK_ROOT)/platforms/os/linux/src/RxBuf.c \
     49     $(DK_ROOT)/platforms/hw/linux/host_platform.c \
     50     $(DK_ROOT)/external_drivers/sdio/linux/SdioDrv.c
     51 #    $(DK_ROOT)/external_drivers/$(HOST_PLATFORM)/Linux/sdio/SdioDrv.c
     52 #    $(DK_ROOT)/platforms/hw/host_platform_$(HOST_PLATFORM)/linux/host_platform.c
     53 
     54 ifeq ($(STACK_PROFILING_ON),y)    
     55     OS_SRCS += $(DK_ROOT)/platforms/os/linux/src/stack_profile.c
     56     EXTRA_CFLAGS += -D STACK_PROFILE
     57 endif     
     58 
     59 ifeq ($(NO_ARCH_STRCMP),y)
     60     OS_SRCS += $(DK_ROOT)/platforms/os/linux/src/string.c 
     61 endif
     62 
     63 OS_INCS = $(DK_ROOT)/platforms/os/linux/inc $(DK_ROOT)/platforms/os/linux/src $(DK_ROOT)/platforms/os/common/inc
     64 #OS_INCS += $(DK_ROOT)/stad/src/core/EvHandler $(DK_ROOT)/Test $(DK_ROOT)/platforms/hw/host_platform_$(HOST_PLATFORM)/linux
     65 OS_INCS += $(DK_ROOT)/stad/src/core/EvHandler $(DK_ROOT)/Test $(DK_ROOT)/platforms/hw/linux
     66 
     67 ifeq ($(WSPI),y)
     68     OS_SRCS += $(DK_ROOT)/platforms/hw/host_platform_$(HOST_PLATFORM)/linux/WspiAdapter.c 
     69     OS_INCS += $(EXT_DRV)/$(HOST_PLATFORM)/Linux/spi
     70 endif
     71 
     72 ifeq ($(WSPI),n)
     73 #    OS_SRCS += $(DK_ROOT)/platforms/hw/host_platform_$(HOST_PLATFORM)/linux/SdioAdapter.c 
     74 #    OS_INCS += $(EXT_DRV)/$(HOST_PLATFORM)/Linux/sdio
     75     OS_SRCS += $(DK_ROOT)/platforms/hw/linux/SdioAdapter.c 
     76     OS_INCS += $(EXT_DRV)/sdio/linux
     77 endif
     78 
     79 OS_OBJS = $(patsubst %.c, %.o, $(OS_SRCS))
     80 
     81 #
     82 # OS include paths required for compilation.
     83 # 
     84 
     85 
     86 #
     87 # Firmware
     88 #
     89 FW_SRCS = ./firmware.c ./radio.c
     90 FW_OBJS = $(patsubst %.c, %.o, $(FW_SRCS))
     91 ifeq "$(FW)" "1273"
     92 FW_IMAGE = $(DK_ROOT)/fw/Latest/Fw1273.bin
     93 else
     94 FW_IMAGE = $(DK_ROOT)/fw/Latest/Fw1251rc1.bin
     95 endif
     96 RAD_IMAGE = $(DK_ROOT)/fw/Latest/nvs_map.bin
     97 
     98 
     99 #
    100 # Location and filename of the linux OS stub object file created by this makefile.
    101 #
    102 OUTPUT_DIR = $(DK_ROOT)/platforms/os/linux/build
    103 OUTPUT_FILE = $(OUTPUT_DIR)/tiwlan_drv_stub.o
    104 OUTPUT_LIB = $(OUTPUT_DIR)/tiwlan_drv_stub.a
    105 
    106 
    107 
    108 
    109 
    110 ##
    111 ##
    112 ## Compilation Directives
    113 ##
    114 ##
    115 ifeq ($(NO_USERMODE_WORKAROUND),y)
    116     EXTRA_CFLAGS += -D NO_USERMODE_WORKAROUND
    117 endif
    118 
    119 ifeq ($(POLLING_MODE),y)
    120     EXTRA_CFLAGS += -D TIWLAN_OMAP1610_IRQ=0
    121 endif
    122 
    123 ifeq ($(MEM_ALLOC_TRACE),y)
    124     EXTRA_CFLAGS += -D TI_MEM_ALLOC_TRACE
    125 endif
    126 
    127 
    128 
    129 
    130 
    131 ##
    132 ##
    133 ## Build process
    134 ##
    135 ##
    136 
    137 ifneq ($(KERNELRELEASE),)
    138 
    139 
    140 	##
    141 	##
    142 	## This is the kernel build phase - set the appropriate arguments
    143 	##
    144 	##
    145 
    146 	#
    147 	# Adds the current directory as a prefix to all include directories.
    148 	#
    149 	EXTRA_CFLAGS += $(addprefix -I$(M)/, $(OS_DK_INCS) $(OS_INCS))
    150 
    151 	#
    152 	# Intermediate object name - this should be renamed to the desired object name
    153 	# after the kernel makefile finishes its work.
    154 	#
    155 	obj-m = tiwlan_drv.o
    156 	#
    157 	# List of object files the kernel makefile needs to compile.
    158 	#
    159 	tiwlan_drv-y = $(OS_OBJS) $(OS_AUXILIARY_LIBS)
    160 
    161 
    162 else	# ifneq ($(KERNELRELEASE),)
    163 
    164 
    165 ##
    166 ##
    167 ## This is the regular build phase - act according to the make actions
    168 ##
    169 ##
    170 
    171 #
    172 # The location of the kernel makefile
    173 #
    174 KERNEL_DIR ?= $(KERNEL_DIR)
    175 
    176 
    177 #
    178 # Build the linux OS stub object file
    179 #
    180 .PHONY: all
    181 all: .depend $(OUTPUT_DIR) $(OUTPUT_FILE)
    182 
    183 #
    184 # Prints variables
    185 #
    186 .PHONY: help
    187 help:
    188 	@echo Default Compilation:	PLATFORM=$(PLATFORM) DEBUG=$(DEBUG) INTR=$(INTR) WSPI=$(WSPI) XCC=$(XCC) EXTRA CFLAGS: $(EXTRA_CFLAGS)
    189 
    190 
    191 #
    192 # Recursively cleans the linux OS stub object files
    193 #
    194 .PHONY: clean
    195 clean:
    196 	$(MAKE) -C $(KERNEL_DIR) M=`pwd` ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) clean
    197 	@rm -f *.o *.a .*.o.cmd *~ *.~* core .depend dep $(OS_OBJS) $(FW_SRCS) $(FW_OBJS)
    198 
    199 
    200 #
    201 # Causes the linux OS stub object file to get rebuilt
    202 #
    203 .depend:
    204 	rm -f $(OUTPUT_FILE)	
    205 
    206 #
    207 # Make sure the output directory exists
    208 #
    209 $(OUTPUT_DIR):
    210 	mkdir -p $(OUTPUT_DIR)
    211 
    212 #
    213 # Recursively builds the linux OS stub object file
    214 #
    215 $(OUTPUT_FILE):
    216 	$(MAKE) -C $(KERNEL_DIR) M=`pwd` ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) modules
    217 	$(CROSS_COMPILE)$(AR) rcs $(OUTPUT_LIB) $(OS_OBJS)
    218 	mv tiwlan_drv.ko $(OUTPUT_FILE)
    219 
    220 
    221 #
    222 # Handles firmware image and radio module for when firmware is statically linked
    223 #
    224 $(BIN2C): $(BIN2C).c
    225 	gcc $^ -o $@
    226 
    227 firmware.c: $(FW_IMAGE) $(BIN2C)
    228 	$(BIN2C) $< tiwlan_fwimage > $@
    229 
    230 radio.c: $(RAD_IMAGE) $(BIN2C)
    231 	$(BIN2C) $< tiwlan_radimage > $@
    232 
    233 
    234 endif	# ifneq ($(KERNELRELEASE),)
    235       
    236