|
| 1 | +############################################################################## |
| 2 | +# Build global options |
| 3 | +# NOTE: Can be overridden externally. |
| 4 | +# |
| 5 | + |
| 6 | +#USE_VERBOSE_COMPILE = yes |
| 7 | + |
| 8 | +# Compiler options here. |
| 9 | +ifeq ($(USE_OPT),) |
| 10 | + USE_OPT = -EL -O2 -ggdb -ffreestanding |
| 11 | + USE_OPT += -mtune=4kc |
| 12 | + # usually gives very good i-cache hit rate |
| 13 | + USE_OPT += -falign-functions=16 |
| 14 | + USE_OPT += -D__32MX795F512L__ |
| 15 | + USE_OPT += -DCHPRINTF_CR_INSERT=TRUE |
| 16 | + USE_OPT += -DCHPRINTF_USE_FLOAT=TRUE |
| 17 | +endif |
| 18 | + |
| 19 | +# C specific options here (added to USE_OPT). |
| 20 | +ifeq ($(USE_COPT),) |
| 21 | + USE_COPT = |
| 22 | +endif |
| 23 | + |
| 24 | +# LD specific options here (added to USE_OPT). |
| 25 | +ifeq ($(USE_LDOPT),) |
| 26 | + USE_LDOPT = -EL -lc |
| 27 | +endif |
| 28 | + |
| 29 | +# C++ specific options here (added to USE_OPT). |
| 30 | +ifeq ($(USE_CPPOPT),) |
| 31 | + USE_CPPOPT = -fno-rtti -fno-exceptions |
| 32 | +endif |
| 33 | + |
| 34 | +# Enable this if you want to compile in mips16 ISA |
| 35 | +ifeq ($(USE_MIPS16),) |
| 36 | + USE_MIPS16 = no |
| 37 | +endif |
| 38 | + |
| 39 | +# Enable this if you want the linker to remove unused code and data |
| 40 | +ifeq ($(USE_LINK_GC),) |
| 41 | + USE_LINK_GC = yes |
| 42 | +endif |
| 43 | + |
| 44 | +# Enable this if you want to see the full log while compiling. |
| 45 | +ifeq ($(USE_VERBOSE_COMPILE),) |
| 46 | + USE_VERBOSE_COMPILE = no |
| 47 | +endif |
| 48 | + |
| 49 | +# |
| 50 | +# Build global options |
| 51 | +############################################################################## |
| 52 | + |
| 53 | +############################################################################## |
| 54 | +# Project, sources and paths |
| 55 | +# |
| 56 | + |
| 57 | +# Define project name here |
| 58 | +PROJECT = ch |
| 59 | + |
| 60 | +# Imported source files and paths |
| 61 | +CHIBIOS = ../.. |
| 62 | +include $(CHIBIOS)/boards/MIPS-PIC32MX795F512L-PIC32-ESK/board.mk |
| 63 | +include $(CHIBIOS)/os/hal/platforms/MIPS-PIC32MX/platform.mk |
| 64 | +include $(CHIBIOS)/os/hal/hal.mk |
| 65 | +include $(CHIBIOS)/os/ports/GCC/MIPS/MIPS32r2/port.mk |
| 66 | +include $(CHIBIOS)/os/kernel/kernel.mk |
| 67 | +include $(CHIBIOS)/os/various/lwip_bindings/lwip.mk |
| 68 | +include $(CHIBIOS)/test/test.mk |
| 69 | + |
| 70 | +# Define linker script file here |
| 71 | +LDSCRIPT= ld/mips_pic32mx795f512l.lds |
| 72 | + |
| 73 | +# List C source files here |
| 74 | +CSRC = $(PORTSRC) \ |
| 75 | + $(KERNSRC) \ |
| 76 | + $(TESTSRC) \ |
| 77 | + $(HALSRC) \ |
| 78 | + $(PLATFORMSRC) \ |
| 79 | + $(BOARDSRC) \ |
| 80 | + $(LWSRC) \ |
| 81 | + $(CHIBIOS)/os/various/shell.c \ |
| 82 | + $(CHIBIOS)/os/various/chprintf.c \ |
| 83 | + $(CHIBIOS)/os/various/evtimer.c \ |
| 84 | + $(CHIBIOS)/os/various/memstreams.c \ |
| 85 | + usbcfg.c \ |
| 86 | + stubs.c \ |
| 87 | + ./web/web.c \ |
| 88 | + main.c |
| 89 | + |
| 90 | +# List C++ source files here |
| 91 | +CPPSRC = |
| 92 | +# List ASM source files here |
| 93 | +ASMSRC = $(PORTASM) $(PLATFORMASM) |
| 94 | + |
| 95 | +INCDIR = $(PORTINC) $(KERNINC) $(TESTINC) $(TESTDMAINC) \ |
| 96 | + $(HALINC) $(PLATFORMINC) $(BOARDINC) $(LWINC) \ |
| 97 | + $(CHIBIOS)/os/various |
| 98 | + |
| 99 | +# |
| 100 | +# Project, sources and paths |
| 101 | +############################################################################## |
| 102 | + |
| 103 | +############################################################################## |
| 104 | +# Compiler settings |
| 105 | +# |
| 106 | + |
| 107 | +MCU = |
| 108 | + |
| 109 | +#TRGT ?= mips-sde-elf- |
| 110 | +#TRGT ?= /usr/local/mips-2012.03/bin/mips-sde-elf- |
| 111 | +TRGT ?= /usr/local/mips-gcc-4.7.2/bin/mips-elf- |
| 112 | + |
| 113 | +CC = $(TRGT)gcc |
| 114 | +CPPC = $(TRGT)g++ |
| 115 | +# Enable loading with g++ only if you need C++ runtime support. |
| 116 | +# NOTE: You can use C++ even without C++ support if you are careful. C++ |
| 117 | +# runtime support makes code size explode. |
| 118 | +LD = $(TRGT)gcc |
| 119 | +#LD = $(TRGT)g++ |
| 120 | +CP = $(TRGT)objcopy |
| 121 | +AS = $(TRGT)gcc -x assembler-with-cpp |
| 122 | +OD = $(TRGT)objdump |
| 123 | +STRIP= $(TRGT)strip --strip-all |
| 124 | +SREC = $(CP) -O srec |
| 125 | +HEX = $(CP) -O ihex --change-addresses=0x80000000 --change-section-address .boot=0x1FC00000 --change-section-address .devcfg=0x1FC02FF0 |
| 126 | + |
| 127 | +# Define C warning options here |
| 128 | +CWARN = -Wall -Wextra -Wstrict-prototypes |
| 129 | + |
| 130 | +# Define C++ warning options here |
| 131 | +CPPWARN = -Wall -Wextra |
| 132 | + |
| 133 | +# |
| 134 | +# Compiler settings |
| 135 | +############################################################################## |
| 136 | + |
| 137 | +############################################################################## |
| 138 | +# Start of default section |
| 139 | +# |
| 140 | + |
| 141 | +# List all default C defines here, like -D_DEBUG=1 |
| 142 | +DDEFS = |
| 143 | + |
| 144 | +# List all default ASM defines here, like -D_DEBUG=1 |
| 145 | +DADEFS = |
| 146 | + |
| 147 | +# List all default directories to look for include files here |
| 148 | +DINCDIR = |
| 149 | + |
| 150 | +# List the default directory to look for the libraries here |
| 151 | +DLIBDIR = |
| 152 | + |
| 153 | +# List all default libraries here |
| 154 | +DLIBS = |
| 155 | + |
| 156 | +# |
| 157 | +# End of default section |
| 158 | +############################################################################## |
| 159 | + |
| 160 | +############################################################################## |
| 161 | +# Start of user section |
| 162 | +# |
| 163 | + |
| 164 | +# List all user C define here, like -D_DEBUG=1 |
| 165 | +UDEFS = |
| 166 | + |
| 167 | +# Define ASM defines here |
| 168 | +UADEFS = |
| 169 | + |
| 170 | +# List all user directories here |
| 171 | +UINCDIR = |
| 172 | + |
| 173 | +# List the user directory to look for the libraries here |
| 174 | +ULIBDIR = |
| 175 | + |
| 176 | +# List all user libraries here |
| 177 | +ULIBS = |
| 178 | + |
| 179 | +# |
| 180 | +# End of user defines |
| 181 | +############################################################################## |
| 182 | + |
| 183 | +OUTFILES = $(BUILDDIR)/$(PROJECT).srec \ |
| 184 | + $(BUILDDIR)/$(PROJECT).hex |
| 185 | + |
| 186 | +include $(CHIBIOS)/os/ports/GCC/MIPS/rules.mk |
| 187 | + |
| 188 | +$(BUILDDIR)/%.srec: $(BUILDDIR)/%.elf $(LDSCRIPT) |
| 189 | +ifeq ($(USE_VERBOSE_COMPILE),yes) |
| 190 | + $(SREC) $< $@ |
| 191 | +else |
| 192 | + @echo Creating $@ |
| 193 | + @$(SREC) $< $@ |
| 194 | +endif |
| 195 | + |
| 196 | +$(BUILDDIR)/%.hex: $(BUILDDIR)/%.elf $(LDSCRIPT) |
| 197 | +ifeq ($(USE_VERBOSE_COMPILE),yes) |
| 198 | + $(HEX) $< $@ |
| 199 | +else |
| 200 | + @echo Creating $@ |
| 201 | + @$(HEX) $< $@ |
| 202 | +endif |
0 commit comments