-
Notifications
You must be signed in to change notification settings - Fork 18
/
Makefile_gcc
98 lines (83 loc) · 3.06 KB
/
Makefile_gcc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
###############################################################################
#SECU-3 - An open source, free engine control unit
#Copyright (C) 2007 Alexey A. Shabelnikov. Ukraine, Kiev
#
# Maklefile for build firmware of SECU-3 project using GCC
# Created by Alexey A. Shabelnikov, Kiev 17 July 2011.
# Note: It requires AVR-GCC toolchain (WinAVR)
#include platform-specific options from another file
include platform_cfg
TARGET = secu-3_app
OBJDIR = output
CC = avr-gcc
OBJCOPY = avr-objcopy
FORMAT = ihex
# Compile options common for all C compilation units.
CFLAGS = -mmcu=$(MCU)
CFLAGS += -DREALTIME_TABLES -DTHERMISTOR_CS -DCOOLINGFAN_PWM -DDIAGNOSTICS -DHALL_OUTPUT -DFUEL_PUMP -DREV9_BOARD
CFLAGS += -DSM_CONTROL -DSTROBOSCOPE -DDWELL_CONTROL -DVREF_5V -DGD_CONTROL -DSECU3T
CFLAGS += -DBL_BAUD_RATE=115200 -DFW_BAUD_RATE=115200 -DSPEED_SENSOR -DINTK_HEATING -DBLUETOOTH_SUPP -DIMMOBILIZER -DUNI_OUTPUT -DAIRTEMP_SENS
CFLAGS += -DLITTLE_ENDIAN_DATA_FORMAT -DEGOS_HEATING
#CFLAGS += -DIOCFG_FUNC_INIT
CFLAGS += -I.
CFLAGS += -Os -mcall-prologues
CFLAGS += -funsigned-char
CFLAGS += -funsigned-bitfields
CFLAGS += -fpack-struct
CFLAGS += -fshort-enums
CFLAGS += -ffreestanding
CFLAGS += -ffunction-sections
CFLAGS += -fno-inline-small-functions
CFLAGS += -Wl,--relax
#CFLAGS += -Wl,--gc-sections
CFLAGS += -Wall
CFLAGS += -Wstrict-prototypes
CFLAGS += -Wa,-adhlns=$(<:sources/%.c=$(OBJDIR)/%.lst)
CFLAGS += -std=gnu99
#CFLAGS += -gdwarf-2
# Linker flags
LDFLAGS = -Wl,-Map=$(OBJDIR)/$(TARGET).map,--cref
LDFLAGS += -Wl,-section-start=.firmware_data=0x$(FWD_START)
LDFLAGS += -Wl,-section-start=.boot_loader=0x$(BL_START)
LDFLAGS += -lm
# Include Directories
INCLUDES =
# Define all source files.
SRC = adc.c bootldr.c ce_errors.c ckps.c crc16.c \
eeprom.c pwrvalve.c funconv.c fuelcut.c eculogic.c \
jumper.c knklogic.c knock.c measure.c params.c \
procuart.c secu3.c starter.c suspendop.c tables.c \
uart.c ventilator.c vstimer.c camsens.c fuelpump.c \
diagnost.c wdt.c ioconfig.c pwrrelay.c bc_input.c \
smcontrol.c choke.c hall.c bluetooth.c onewire.c \
immobiliz.c ckps2ch.c intkheat.c injector.c uni_out.c \
lambda.c ecudata.c gasdose.c gdcontrol.c carb_afr.c \
ckpsn+1.c mathemat.c obd.c dbgvar.c evap.c aircond.c \
egosheat.c ckps-cs.c pwm2.c grheat.c grvalve.c \
ckps-odd.c ltft.c ltft-kosh.c ringbuff.c
# Define all object files and dependencies
OBJECTS = $(SRC:%.c=$(OBJDIR)/%.o)
DEPS = $(OBJECTS:$(OBJDIR)/%.o=$(OBJDIR)/%.d)
# Define all listing files.
LST = $(SRC:%.c=$(OBJDIR)/%.lst)
# Build
all: OBJ_DIRS $(TARGET).elf $(TARGET).hex
#Include make files containing dependencies
-include $(DEPS)
#Create directory for object files
OBJ_DIRS:
@mkdir -p $(OBJDIR)
#Create HEX file
%.hex: %.elf
$(OBJCOPY) -O $(FORMAT) -R .eeprom -R .fuse -R .lock $< $@
# Compile
$(OBJDIR)/%.o : sources/%.c
$(CC) -c $(INCLUDES) $(CFLAGS) -MD $< -o $@
#Link to obtain elf file
.SECONDARY : $(TARGET).elf
.PRECIOUS : $(OBJECTS)
%.elf: $(OBJECTS)
$(CC) $(CFLAGS) $^ --output $@ $(LDFLAGS)
# Clean target
clean:
@rm -f $(OBJECTS) $(LST) $(TARGET).hex $(TARGET).elf $(OBJDIR)/$(TARGET).map $(DEPS)