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