summaryrefslogtreecommitdiffstats
path: root/make.mk
blob: f6a37c7e809a9d772a34422f98a34dfa264cd051 (plain)
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
##############################################################################
BUILD = ./build
BIN = watch

ifndef BOARD
override BOARD = OSO-SWAT-A1-04
endif

##############################################################################
.PHONY: all directory clean size

CC = arm-none-eabi-gcc
OBJCOPY = arm-none-eabi-objcopy
SIZE = arm-none-eabi-size
UF2 = python $(TOP)/utils/uf2conv.py

ifeq ($(OS), Windows_NT)
  MKDIR = gmkdir
else
  MKDIR = mkdir
endif

CFLAGS += -W -Wall --std=gnu99 -Os
CFLAGS += -fno-diagnostics-show-caret
CFLAGS += -fdata-sections -ffunction-sections
CFLAGS += -funsigned-char -funsigned-bitfields
CFLAGS += -mcpu=cortex-m0plus -mthumb
CFLAGS += -MD -MP -MT $(BUILD)/$(*F).o -MF $(BUILD)/$(@F).d

LDFLAGS += -mcpu=cortex-m0plus -mthumb
LDFLAGS += -Wl,--gc-sections
LDFLAGS += -Wl,--script=$(TOP)//watch-library/linker/saml22j18.ld

LIBS += -lm

INCLUDES += \
  -I$(TOP)/tinyusb/src \
  -I$(TOP)/boards/$(BOARD) \
  -I$(TOP)/watch-library/include \
  -I$(TOP)/watch-library/hal/ \
  -I$(TOP)/watch-library/hal/documentation/ \
  -I$(TOP)/watch-library/hal/include/ \
  -I$(TOP)/watch-library/hal/src/ \
  -I$(TOP)/watch-library/hal/utils/ \
  -I$(TOP)/watch-library/hal/utils/include/ \
  -I$(TOP)/watch-library/hal/utils/src/ \
  -I$(TOP)/watch-library/hpl/ \
  -I$(TOP)/watch-library/hpl/core/ \
  -I$(TOP)/watch-library/hpl/dmac/ \
  -I$(TOP)/watch-library/hpl/eic/ \
  -I$(TOP)/watch-library/hpl/gclk/ \
  -I$(TOP)/watch-library/hpl/mclk/ \
  -I$(TOP)/watch-library/hpl/osc32kctrl/ \
  -I$(TOP)/watch-library/hpl/oscctrl/ \
  -I$(TOP)/watch-library/hpl/pm/ \
  -I$(TOP)/watch-library/hpl/port/ \
  -I$(TOP)/watch-library/hpl/sercom/ \
  -I$(TOP)/watch-library/hpl/slcd/ \
  -I$(TOP)/watch-library/hpl/systick/ \
  -I$(TOP)/watch-library/hri/ \
  -I$(TOP)/watch-library/config/ \
  -I$(TOP)/watch-library/hw/ \
  -I$(TOP)/watch-library/watch/ \
  -I$(TOP)/watch-library/driver/ \
  -I$(TOP)/watch-library

SRCS += \
  $(TOP)/tinyusb/src/tusb.c \
  $(TOP)/tinyusb/src/common/tusb_fifo.c \
  $(TOP)/tinyusb/src/class/cdc/cdc_device.c \
  $(TOP)/tinyusb/src/device/usbd.c \
  $(TOP)/tinyusb/src/device/usbd_control.c \
  $(TOP)/tinyusb/src/portable/microchip/samd/dcd_samd.c \
  $(TOP)/watch-library/main.c \
  $(TOP)/watch-library/startup_saml22.c \
  $(TOP)/watch-library/hw/driver_init.c \
  $(TOP)/watch-library/watch/watch_rtc.c \
  $(TOP)/watch-library/watch/watch_slcd.c \
  $(TOP)/watch-library/watch/watch_extint.c \
  $(TOP)/watch-library/watch/watch_led.c \
  $(TOP)/watch-library/watch/watch_buzzer.c \
  $(TOP)/watch-library/watch/watch_adc.c \
  $(TOP)/watch-library/watch/watch_gpio.c \
  $(TOP)/watch-library/watch/watch_i2c.c \
  $(TOP)/watch-library/watch/watch_uart.c \
  $(TOP)/watch-library/watch/watch_deepsleep.c \
  $(TOP)/watch-library/watch/watch_utility.c \
  $(TOP)/watch-library/watch/watch_private.c \
  $(TOP)/watch-library/watch/watch.c \
  $(TOP)/watch-library/hal/src/hal_atomic.c \
  $(TOP)/watch-library/hal/src/hal_delay.c \
  $(TOP)/watch-library/hal/src/hal_ext_irq.c \
  $(TOP)/watch-library/hal/src/hal_gpio.c \
  $(TOP)/watch-library/hal/src/hal_i2c_m_sync.c \
  $(TOP)/watch-library/hal/src/hal_spi_m_sync.c \
  $(TOP)/watch-library/hal/src/hal_init.c \
  $(TOP)/watch-library/hal/src/hal_io.c \
  $(TOP)/watch-library/hal/src/hal_slcd_sync.c \
  $(TOP)/watch-library/hal/src/hal_sleep.c \
  $(TOP)/watch-library/hal/utils/src/utils_assert.c \
  $(TOP)/watch-library/hal/utils/src/utils_event.c \
  $(TOP)/watch-library/hal/utils/src/utils_list.c \
  $(TOP)/watch-library/hal/utils/src/utils_syscalls.c \
  $(TOP)/watch-library/hpl/core/hpl_core_m0plus_base.c \
  $(TOP)/watch-library/hpl/core/hpl_init.c \
  $(TOP)/watch-library/hpl/dmac/hpl_dmac.c \
  $(TOP)/watch-library/hpl/eic/hpl_eic.c \
  $(TOP)/watch-library/hpl/gclk/hpl_gclk.c \
  $(TOP)/watch-library/hpl/mclk/hpl_mclk.c \
  $(TOP)/watch-library/hpl/osc32kctrl/hpl_osc32kctrl.c \
  $(TOP)/watch-library/hpl/oscctrl/hpl_oscctrl.c \
  $(TOP)/watch-library/hpl/pm/hpl_pm.c \
  $(TOP)/watch-library/hpl/sercom/hpl_sercom.c \
  $(TOP)/watch-library/hpl/slcd/hpl_slcd.c \
  $(TOP)/watch-library/hpl/systick/hpl_systick.c \
  $(TOP)/watch-library/driver/lis2dh.c \

DEFINES += \
  -D__SAML22J18A__ \
  -DDONT_USE_CMSIS_INIT

ifeq ($(LED), BLUE)
CFLAGS += -DWATCH_SWAP_LED_PINS
endif

ifeq ($(BOARD), OSO-FEAL-A1-00)
CFLAGS += -DCRYSTALLESS
endif