1LOCAL_DIR := $(GET_LOCAL_DIR)
2
3MODULE := $(LOCAL_DIR)
4
5# ROMBASE, MEMBASE, and MEMSIZE are required for the linker script
6ROMBASE := 0x10000000
7MEMBASE := 0x20000000
8MEMSIZE := 0x00042000
9# can be overridden by target
10
11ARCH := arm
12ARM_CPU := cortex-m0plus
13
14GLOBAL_DEFINES += \
15	MEMSIZE=$(MEMSIZE) \
16	ARM_CM_SET_VTOR=1 \
17	PICO_ON_DEVICE=1 \
18	PICO_NO_BINARY_INFO=1
19
20MODULE_SRCS += \
21	$(LOCAL_DIR)/debug.c \
22	$(LOCAL_DIR)/gpio.c \
23	$(LOCAL_DIR)/init.c \
24	$(LOCAL_DIR)/uart.c \
25	$(LOCAL_DIR)/vectab.c
26
27MODULE_SRCS += \
28	external/platform/pico/rp2_common/hardware_clocks/clocks.c \
29	external/platform/pico/rp2_common/hardware_gpio/gpio.c \
30	external/platform/pico/rp2_common/hardware_pll/pll.c \
31	external/platform/pico/rp2_common/hardware_uart/uart.c \
32	external/platform/pico/rp2_common/hardware_watchdog/watchdog.c \
33	external/platform/pico/rp2_common/hardware_xosc/xosc.c
34
35GLOBAL_INCLUDES += \
36	external/platform/pico/common/pico_base/include \
37	external/platform/pico/common/pico_binary_info/include \
38	external/platform/pico/rp2040/hardware_regs/include \
39	external/platform/pico/rp2040/hardware_structs/include \
40	external/platform/pico/rp2_common/pico_platform/include \
41	external/platform/pico/rp2_common/hardware_base/include \
42	external/platform/pico/rp2_common/hardware_clocks/include \
43	external/platform/pico/rp2_common/hardware_gpio/include \
44	external/platform/pico/rp2_common/hardware_irq/include \
45	external/platform/pico/rp2_common/hardware_pll/include \
46	external/platform/pico/rp2_common/hardware_sync/include \
47	external/platform/pico/rp2_common/hardware_resets/include \
48	external/platform/pico/rp2_common/hardware_timer/include \
49	external/platform/pico/rp2_common/hardware_uart/include \
50	external/platform/pico/rp2_common/hardware_watchdog/include \
51	external/platform/pico/rp2_common/hardware_xosc/include
52
53# use a two segment memory layout, where all of the read-only sections
54# of the binary reside in rom, and the read/write are in memory. The
55# ROMBASE, MEMBASE, and MEMSIZE make variables are required to be set
56# for the linker script to be generated properly.
57#
58LINKER_SCRIPT += \
59	$(BUILDDIR)/system-twosegment.ld
60
61MODULE_DEPS += \
62	arch/arm/arm-m/systick \
63	lib/cbuf
64
65# take the result of the build and generate a uf2 file
66UF2BIN := $(basename $(OUTBIN)).uf2
67UF2CONV_TOOL := $(LOCAL_DIR)/tools/uf2conv.py
68FAMILY_ID := 0xe48bff56 # UF2 family id
69$(UF2BIN): $(OUTBIN) $(UF2CONV_TOOL)
70	@$(MKDIR)
71	$(NOECHO)echo generating $@; \
72	$(UF2CONV_TOOL) -b $(ROMBASE) -f $(FAMILY_ID) -c -o $@ $<
73
74EXTRA_BUILDDEPS += $(UF2BIN)
75GENERATED += $(UF2BIN)
76
77include make/module.mk
78