-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
setup.makefile
106 lines (86 loc) · 4.2 KB
/
setup.makefile
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
#
# setup.makefile
#
#
CFG_SHARED=$(PAPARAZZI_SRC)/conf/firmwares/subsystems/shared
#CFG_SETUP=$(PAPARAZZI_SRC)/conf/firmwares/subsystems/setup
SRC_ARCH=arch/$(ARCH)
SRC_FIRMWARE=firmwares/setup
SRC_LISA=lisa
SETUP_INC = -I$(SRC_FIRMWARE)
$(TARGET).CFLAGS += -DBOARD_CONFIG=$(BOARD_CFG)
# a test program to tunnel between both uart
tunnel.CFLAGS += -DUSE_LED
tunnel.srcs += $(SRC_ARCH)/uart_tunnel.c
tunnel.srcs += mcu.c $(SRC_ARCH)/mcu_arch.c
ifeq ($(ARCH), stm32)
tunnel.ARCHDIR = $(ARCH)
tunnel.CFLAGS += -I$(ARCH) -DPERIPHERALS_AUTO_INIT
tunnel.srcs += $(SRC_ARCH)/mcu_periph/gpio_arch.c $(SRC_ARCH)/led_hw.c
ifneq ($(SYS_TIME_LED),none)
tunnel.CFLAGS += -DSYS_TIME_LED=$(SYS_TIME_LED)
endif
tunnel.CFLAGS += -DPERIODIC_FREQUENCY='512.'
tunnel.srcs += mcu_periph/sys_time.c $(SRC_ARCH)/mcu_periph/sys_time_arch.c
endif
# for the usb_tunnel we need to set PCLK higher with the flag USE_USB_HIGH_PCLK
# a configuration program to access both uart through usb
ifeq ($(ARCH), lpc21)
usb_tunnel_0.CFLAGS += -DUSE_UART0 -DUART0_BAUD=B115200 -DPERIPHERALS_AUTO_INIT
usb_tunnel_0.CFLAGS += -DUSE_USB_LINE_CODING -DUSE_USB_SERIAL -DUSE_LED -DUSE_USB_HIGH_PCLK
usb_tunnel_0.srcs += $(SRC_ARCH)/usb_tunnel.c $(SRC_ARCH)/usb_ser_hw.c mcu_periph/uart.c $(SRC_ARCH)/mcu_periph/uart_arch.c
usb_tunnel_0.srcs += $(SRC_ARCH)/lpcusb/usbhw_lpc.c $(SRC_ARCH)/lpcusb/usbinit.c
usb_tunnel_0.srcs += $(SRC_ARCH)/lpcusb/usbcontrol.c $(SRC_ARCH)/lpcusb/usbstdreq.c
usb_tunnel_0.srcs += mcu_periph/sys_time.c $(SRC_ARCH)/mcu_periph/sys_time_arch.c $(SRC_ARCH)/armVIC.c
usb_tunnel_0.srcs += mcu.c $(SRC_ARCH)/mcu_arch.c
usb_tunnel_1.CFLAGS += -DUSE_UART1 -DUART1_BAUD=B115200 -DPERIPHERALS_AUTO_INIT
usb_tunnel_1.CFLAGS += -DUSE_USB_LINE_CODING -DUSE_USB_SERIAL -DUSE_LED -DUSE_USB_HIGH_PCLK
usb_tunnel_1.srcs += $(SRC_ARCH)/usb_tunnel.c $(SRC_ARCH)/usb_ser_hw.c mcu_periph/uart.c $(SRC_ARCH)/mcu_periph/uart_arch.c
usb_tunnel_1.srcs += $(SRC_ARCH)/lpcusb/usbhw_lpc.c $(SRC_ARCH)/lpcusb/usbinit.c
usb_tunnel_1.srcs += $(SRC_ARCH)/lpcusb/usbcontrol.c $(SRC_ARCH)/lpcusb/usbstdreq.c
usb_tunnel_1.srcs += mcu_periph/sys_time.c $(SRC_ARCH)/mcu_periph/sys_time_arch.c $(SRC_ARCH)/armVIC.c
usb_tunnel_1.srcs += mcu.c $(SRC_ARCH)/mcu_arch.c
else
ifeq ($(TARGET),usb_tunnel_0)
$(error usb_tunnel_0 currently only implemented for the lpc21)
else ifeq ($(TARGET),usb_tunnel_1)
$(error usb_tunnel_1 currently only implemented for the lpc21)
endif
endif
PERIODIC_FREQUENCY ?= 512
ifeq ($(TARGET), setup_actuators)
ifeq ($(ACTUATORS),)
$(error ACTUATORS not configured, if your board file has no default, configure in your airframe file)
else
include $(CFG_SHARED)/$(ACTUATORS).makefile
endif
endif
# a test program to setup actuators
setup_actuators.CFLAGS += -DUSE_LED -DPERIPHERALS_AUTO_INIT
setup_actuators.srcs += mcu.c $(SRC_ARCH)/mcu_arch.c
ifneq ($(SYS_TIME_LED),none)
setup_actuators.CFLAGS += -DSYS_TIME_LED=$(SYS_TIME_LED)
endif
setup_actuators.srcs += mcu_periph/sys_time.c $(SRC_ARCH)/mcu_periph/sys_time_arch.c
setup_actuators.CFLAGS += -DUSE_$(MODEM_PORT)
setup_actuators.CFLAGS += -D$(MODEM_PORT)_BAUD=$(MODEM_BAUD)
setup_actuators.srcs += mcu_periph/uart.c $(SRC_ARCH)/mcu_periph/uart_arch.c
SETUP_ACTUATORS_MODEM_PORT_LOWER=$(shell echo $(MODEM_PORT) | tr A-Z a-z)
setup_actuators.CFLAGS += -DDOWNLINK -DDOWNLINK_DEVICE=$(SETUP_ACTUATORS_MODEM_PORT_LOWER) -DPPRZ_UART=$(MODEM_PORT)
setup_actuators.CFLAGS += -DDOWNLINK_TRANSPORT=pprz_tp -DDATALINK=PPRZ
setup_actuators.srcs += subsystems/datalink/downlink.c subsystems/datalink/pprz_transport.c
# we actually don't really use the generated periodic telemetry in this firmware,
# but still needed to register e.g. the UART_ERRORS message #if DOWNLINK
setup_actuators.CFLAGS += -DDefaultPeriodic='&telemetry_Main'
setup_actuators.srcs += subsystems/datalink/telemetry.c
setup_actuators.CFLAGS += -DPERIODIC_FREQUENCY=$(PERIODIC_FREQUENCY)
setup_actuators.srcs += subsystems/actuators.c
setup_actuators.srcs += $(SRC_FIRMWARE)/setup_actuators.c
ifeq ($(ARCH), lpc21)
setup_actuators.srcs += $(SRC_ARCH)/armVIC.c
else ifeq ($(ARCH), stm32)
setup_actuators.ARCHDIR = $(ARCH)
setup_actuators.CFLAGS += -I$(ARCH)
setup_actuators.srcs += $(SRC_ARCH)/led_hw.c
setup_actuators.srcs += $(SRC_ARCH)/mcu_periph/gpio_arch.c
endif