1 # Assume newlib gcc toolchain
2 ARMCC
=arm-none-eabi-gcc
3 OBJCOPY
=arm-none-eabi-objcopy
5 CPPFLAGS
=-DSTM32F205xx
-DUSE_HAL_DRIVER
-Wall
-Werror
6 CFLAGS
=-mcpu
=cortex-m3
-mthumb
-mslow-flash-data \
12 "-Tsrc/firmware/link.ld" \
17 STM32CubeMX_INCUDE
= \
18 -ISTM32CubeMX
/SCSI2SD-V6
/Inc \
19 -ISTM32CubeMX
/SCSI2SD-V6
/Middlewares
/ST
/STM32_USB_Host_Library
/Class
/MSC
/Inc \
20 -ISTM32CubeMX
/SCSI2SD-V6
/Middlewares
/ST
/STM32_USB_Host_Library
/Core
/Inc \
21 -ISTM32CubeMX
/SCSI2SD-V6
/Drivers
/CMSIS
/Include \
22 -ISTM32CubeMX
/SCSI2SD-V6
/Drivers
/CMSIS
/Device
/ST
/STM32F2xx
/Include \
23 -ISTM32CubeMX
/SCSI2SD-V6
/Drivers
/STM32F2xx_HAL_Driver
/Inc \
24 -ISTM32CubeMX
/SCSI2SD-V6
/Middlewares
/Third_Party
/FatFs
/src
/ \
25 -ISTM32CubeMX
/SCSI2SD-V6
/Middlewares
/Third_Party
/FatFs
/src
/drivers \
26 -ISTM32CubeMX
/SCSI2SD-V6
/Middlewares
/ST
/STM32_USB_Device_Library
/Core
/Inc \
27 -Isrc
/firmware
/usb_device \
29 all: build
/firmware.dfu
31 build
/stm32cubemx
/bsp_driver_sd.o
: STM32CubeMX
/SCSI2SD-V6
/Src
/bsp_driver_sd.c
32 build
/stm32cubemx
/fsmc.o
: STM32CubeMX
/SCSI2SD-V6
/Src
/fsmc.c
33 build
/stm32cubemx
/gpio.o
: STM32CubeMX
/SCSI2SD-V6
/Src
/gpio.c
34 build
/stm32cubemx
/main.o
: STM32CubeMX
/SCSI2SD-V6
/Src
/main.c
35 build
/stm32cubemx
/sdio.o
: STM32CubeMX
/SCSI2SD-V6
/Src
/sdio.c
36 build
/stm32cubemx
/spi.o
: STM32CubeMX
/SCSI2SD-V6
/Src
/spi.c
37 build
/stm32cubemx
/tim.o
: STM32CubeMX
/SCSI2SD-V6
/Src
/tim.c
38 build
/stm32cubemx
/stm32f2xx_hal_msp.o
: STM32CubeMX
/SCSI2SD-V6
/Src
/stm32f2xx_hal_msp.c
39 build
/stm32cubemx
/stm32f2xx_it.o
: STM32CubeMX
/SCSI2SD-V6
/Src
/stm32f2xx_it.c
40 build
/stm32cubemx
/usart.o
: STM32CubeMX
/SCSI2SD-V6
/Src
/usart.c
41 build
/stm32cubemx
/usbd_conf.o
: STM32CubeMX
/SCSI2SD-V6
/Src
/usbd_conf.c
42 build
/stm32cubemx
/usbh_conf.o
: STM32CubeMX
/SCSI2SD-V6
/Src
/usbh_conf.c
43 build
/stm32cubemx
/usb_host.o
: STM32CubeMX
/SCSI2SD-V6
/Src
/usb_host.c
44 build
/stm32cubemx
/stm32f2xx_hal.o
: STM32CubeMX
/SCSI2SD-V6
/Drivers
/STM32F2xx_HAL_Driver
/Src
/stm32f2xx_hal.c
45 build
/stm32cubemx
/stm32f2xx_hal_cortex.o
: STM32CubeMX
/SCSI2SD-V6
/Drivers
/STM32F2xx_HAL_Driver
/Src
/stm32f2xx_hal_cortex.c
46 build
/stm32cubemx
/stm32f2xx_hal_dma.o
: STM32CubeMX
/SCSI2SD-V6
/Drivers
/STM32F2xx_HAL_Driver
/Src
/stm32f2xx_hal_dma.c
47 build
/stm32cubemx
/stm32f2xx_hal_gpio.o
: STM32CubeMX
/SCSI2SD-V6
/Drivers
/STM32F2xx_HAL_Driver
/Src
/stm32f2xx_hal_gpio.c
48 build
/stm32cubemx
/stm32f2xx_hal_hcd.o
: STM32CubeMX
/SCSI2SD-V6
/Drivers
/STM32F2xx_HAL_Driver
/Src
/stm32f2xx_hal_hcd.c
49 build
/stm32cubemx
/stm32f2xx_hal_pcd.o
: STM32CubeMX
/SCSI2SD-V6
/Drivers
/STM32F2xx_HAL_Driver
/Src
/stm32f2xx_hal_pcd.c
50 build
/stm32cubemx
/stm32f2xx_hal_pcd_ex.o
: STM32CubeMX
/SCSI2SD-V6
/Drivers
/STM32F2xx_HAL_Driver
/Src
/stm32f2xx_hal_pcd_ex.c
51 build
/stm32cubemx
/stm32f2xx_hal_rcc.o
: STM32CubeMX
/SCSI2SD-V6
/Drivers
/STM32F2xx_HAL_Driver
/Src
/stm32f2xx_hal_rcc.c
52 build
/stm32cubemx
/stm32f2xx_hal_sd.o
: STM32CubeMX
/SCSI2SD-V6
/Drivers
/STM32F2xx_HAL_Driver
/Src
/stm32f2xx_hal_sd.c
53 build
/stm32cubemx
/stm32f2xx_hal_spi.o
: STM32CubeMX
/SCSI2SD-V6
/Drivers
/STM32F2xx_HAL_Driver
/Src
/stm32f2xx_hal_spi.c
54 build
/stm32cubemx
/stm32f2xx_hal_sram.o
: STM32CubeMX
/SCSI2SD-V6
/Drivers
/STM32F2xx_HAL_Driver
/Src
/stm32f2xx_hal_sram.c
55 build
/stm32cubemx
/stm32f2xx_hal_tim.o
: STM32CubeMX
/SCSI2SD-V6
/Drivers
/STM32F2xx_HAL_Driver
/Src
/stm32f2xx_hal_tim.c
56 build
/stm32cubemx
/stm32f2xx_hal_tim_ex.o
: STM32CubeMX
/SCSI2SD-V6
/Drivers
/STM32F2xx_HAL_Driver
/Src
/stm32f2xx_hal_tim_ex.c
57 build
/stm32cubemx
/stm32f2xx_hal_uart.o
: STM32CubeMX
/SCSI2SD-V6
/Drivers
/STM32F2xx_HAL_Driver
/Src
/stm32f2xx_hal_uart.c
58 build
/stm32cubemx
/stm32f2xx_ll_fsmc.o
: STM32CubeMX
/SCSI2SD-V6
/Drivers
/STM32F2xx_HAL_Driver
/Src
/stm32f2xx_ll_fsmc.c
59 build
/stm32cubemx
/stm32f2xx_ll_sdmmc.o
: STM32CubeMX
/SCSI2SD-V6
/Drivers
/STM32F2xx_HAL_Driver
/Src
/stm32f2xx_ll_sdmmc.c
60 build
/stm32cubemx
/stm32f2xx_ll_usb.o
: STM32CubeMX
/SCSI2SD-V6
/Drivers
/STM32F2xx_HAL_Driver
/Src
/stm32f2xx_ll_usb.c
61 build
/stm32cubemx
/usbd_core.o
: STM32CubeMX
/SCSI2SD-V6
/Middlewares
/ST
/STM32_USB_Device_Library
/Core
/Src
/usbd_core.c
62 build
/stm32cubemx
/usbd_ctlreq.o
: STM32CubeMX
/SCSI2SD-V6
/Middlewares
/ST
/STM32_USB_Device_Library
/Core
/Src
/usbd_ctlreq.c
63 build
/stm32cubemx
/usbd_ioreq.o
: STM32CubeMX
/SCSI2SD-V6
/Middlewares
/ST
/STM32_USB_Device_Library
/Core
/Src
/usbd_ioreq.c
64 build
/stm32cubemx
/usbh_core.o
: STM32CubeMX
/SCSI2SD-V6
/Middlewares
/ST
/STM32_USB_Host_Library
/Core
/Src
/usbh_core.c
65 build
/stm32cubemx
/usbh_ctlreq.o
: STM32CubeMX
/SCSI2SD-V6
/Middlewares
/ST
/STM32_USB_Host_Library
/Core
/Src
/usbh_ctlreq.c
66 build
/stm32cubemx
/usbh_ioreq.o
: STM32CubeMX
/SCSI2SD-V6
/Middlewares
/ST
/STM32_USB_Host_Library
/Core
/Src
/usbh_ioreq.c
67 build
/stm32cubemx
/usbh_pipes.o
: STM32CubeMX
/SCSI2SD-V6
/Middlewares
/ST
/STM32_USB_Host_Library
/Core
/Src
/usbh_pipes.c
68 build
/stm32cubemx
/usbh_msc.o
: STM32CubeMX
/SCSI2SD-V6
/Middlewares
/ST
/STM32_USB_Host_Library
/Class
/MSC
/Src
/usbh_msc.c
69 build
/stm32cubemx
/usbh_msc_bot.o
: STM32CubeMX
/SCSI2SD-V6
/Middlewares
/ST
/STM32_USB_Host_Library
/Class
/MSC
/Src
/usbh_msc_bot.c
70 build
/stm32cubemx
/usbh_msc_scsi.o
: STM32CubeMX
/SCSI2SD-V6
/Middlewares
/ST
/STM32_USB_Host_Library
/Class
/MSC
/Src
/usbh_msc_scsi.c
71 build
/stm32cubemx
/system_stm32f2xx.o
: STM32CubeMX
/SCSI2SD-V6
/Drivers
/CMSIS
/Device
/ST
/STM32F2xx
/Source
/Templates
/system_stm32f2xx.c
72 build
/stm32cubemx
/startup_stm32f205xx.o
: STM32CubeMX
/SCSI2SD-V6
/Drivers
/CMSIS
/Device
/ST
/STM32F2xx
/Source
/Templates
/gcc
/startup_stm32f205xx.s
75 build
/stm32cubemx
/bsp_driver_sd.o \
76 build
/stm32cubemx
/fsmc.o \
77 build
/stm32cubemx
/gpio.o \
78 build
/stm32cubemx
/main.o \
79 build
/stm32cubemx
/sdio.o \
80 build
/stm32cubemx
/spi.o \
81 build
/stm32cubemx
/tim.o \
82 build
/stm32cubemx
/stm32f2xx_hal_msp.o \
83 build
/stm32cubemx
/stm32f2xx_it.o \
84 build
/stm32cubemx
/usart.o \
85 build
/stm32cubemx
/usbd_conf.o \
86 build
/stm32cubemx
/usbh_conf.o \
87 build
/stm32cubemx
/usb_host.o \
88 build
/stm32cubemx
/stm32f2xx_hal.o \
89 build
/stm32cubemx
/stm32f2xx_hal_cortex.o \
90 build
/stm32cubemx
/stm32f2xx_hal_dma.o \
91 build
/stm32cubemx
/stm32f2xx_hal_gpio.o \
92 build
/stm32cubemx
/stm32f2xx_hal_hcd.o \
93 build
/stm32cubemx
/stm32f2xx_hal_pcd.o \
94 build
/stm32cubemx
/stm32f2xx_hal_pcd_ex.o \
95 build
/stm32cubemx
/stm32f2xx_hal_rcc.o \
96 build
/stm32cubemx
/stm32f2xx_hal_sd.o \
97 build
/stm32cubemx
/stm32f2xx_hal_spi.o \
98 build
/stm32cubemx
/stm32f2xx_hal_sram.o \
99 build
/stm32cubemx
/stm32f2xx_hal_tim.o \
100 build
/stm32cubemx
/stm32f2xx_hal_tim_ex.o \
101 build
/stm32cubemx
/stm32f2xx_hal_uart.o \
102 build
/stm32cubemx
/stm32f2xx_ll_fsmc.o \
103 build
/stm32cubemx
/stm32f2xx_ll_sdmmc.o \
104 build
/stm32cubemx
/stm32f2xx_ll_usb.o \
105 build
/stm32cubemx
/usbd_core.o \
106 build
/stm32cubemx
/usbd_ctlreq.o \
107 build
/stm32cubemx
/usbd_ioreq.o \
108 build
/stm32cubemx
/usbh_core.o \
109 build
/stm32cubemx
/usbh_ctlreq.o \
110 build
/stm32cubemx
/usbh_ioreq.o \
111 build
/stm32cubemx
/usbh_pipes.o \
112 build
/stm32cubemx
/usbh_msc.o \
113 build
/stm32cubemx
/usbh_msc_bot.o \
114 build
/stm32cubemx
/usbh_msc_scsi.o \
115 build
/stm32cubemx
/system_stm32f2xx.o \
116 build
/stm32cubemx
/startup_stm32f205xx.o \
118 # Modified versin from stm32cubemx for a composite class with both
119 # mass-storage and HID interfaces
121 src
/firmware
/usb_device
/usb_device.c \
122 src
/firmware
/usb_device
/usbd_composite.c \
123 src
/firmware
/usb_device
/usbd_desc.c \
124 src
/firmware
/usb_device
/usbd_hid.c \
125 src
/firmware
/usb_device
/usbd_msc_bot.c \
126 src
/firmware
/usb_device
/usbd_msc.c \
127 src
/firmware
/usb_device
/usbd_msc_data.c \
128 src
/firmware
/usb_device
/usbd_msc_scsi.c \
129 src
/firmware
/usb_device
/usbd_msc_storage_sd.c \
132 src
/firmware
/bootloader.c \
133 src
/firmware
/cdrom.c \
134 src
/firmware
/config.c \
135 src
/firmware
/disk.c \
136 src
/firmware
/diagnostic.c \
137 src
/firmware
/fpga.c \
138 src
/firmware
/geometry.c \
139 src
/firmware
/hidpacket.c \
140 src
/firmware
/inquiry.c \
142 src
/firmware
/main.c \
144 src
/firmware
/mode.c \
145 src
/firmware
/scsiPhy.c \
146 src
/firmware
/scsi.c \
148 src
/firmware
/tape.c \
149 src
/firmware
/time.c \
150 src
/firmware
/trace.c \
153 build
/firmware.elf
: $(SRC
) rtl
/fpga_bitmap.o
$(STM32OBJS
)
154 $(ARMCC
) $(CPPFLAGS
) $(CFLAGS
) -o
$@
$(STM32CubeMX_INCUDE
) $(INCLUDE
) $^
$(LDFLAGS
)
155 @EBSS
=`arm-none-eabi-nm build/firmware.elf | grep _ebss | cut -f1 "-d "`; \
156 echo HEAPSIZE
= $$((0x2001C000 - 0x
$${EBSS})) bytes
157 @echo STACKSIZE
= 16384 bytes
160 build
/firmware.bin
: build
/firmware.elf
161 $(OBJCOPY
) -O binary
$< $@
163 build
/stm32cubemx
/%.o
:
164 mkdir
-p build
/stm32cubemx
165 $(ARMCC
) $(CPPFLAGS
) $(CFLAGS
) -c
-o
$@
$(STM32CubeMX_INCUDE
) $(INCLUDE
) $^
168 build
/stm32cubemx
/stm32f2xx_it.o
:
169 mkdir
-p build
/stm32cubemx
170 $(ARMCC
) $(CPPFLAGS
) $(CFLAGS
) -c
-o
$@
$(STM32CubeMX_INCUDE
) $(INCLUDE
) $^
171 $(OBJCOPY
) -N EXTI4_IRQHandler
$@
173 build
/stm32cubemx
/system_stm32f2xx.o
:
174 mkdir
-p build
/stm32cubemx
175 $(ARMCC
) $(CPPFLAGS
) $(CFLAGS
) -c
-o
$@
$(STM32CubeMX_INCUDE
) $(INCLUDE
) $^
176 $(OBJCOPY
) --redefine-sym SystemInit
=OrigSystemInit
$@
178 build
/scsiPhy.s
: src
/firmware
/scsiPhy.c
179 $(ARMCC
) $(CPPFLAGS
) $(CFLAGS
) -S
-o
$@
$(STM32CubeMX_INCUDE
) $(INCLUDE
) $^
182 build
/firmware.dfu
: build
/firmware.bin
183 python tools
/dfu-convert.py
-b
0x08000000:$< $@
186 rm -f build
/firmware.elf build
/firmware.bin
189 dfu-util
--download build
/firmware.dfu
--alt
0