2020-03-11 18:13:06 -04:00
|
|
|
# This file is part of the MicroPython project, http://micropython.org/
|
|
|
|
#
|
|
|
|
# The MIT License (MIT)
|
|
|
|
#
|
2020-06-03 18:40:05 -04:00
|
|
|
# SPDX-FileCopyrightText: Copyright (c) 2019 Dan Halbert for Adafruit Industries
|
|
|
|
# SPDX-FileCopyrightText: Copyright (c) 2019 Lucian Copeland for Adafruit Industries
|
2020-03-11 18:13:06 -04:00
|
|
|
#
|
|
|
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
# of this software and associated documentation files (the "Software"), to deal
|
|
|
|
# in the Software without restriction, including without limitation the rights
|
|
|
|
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
# copies of the Software, and to permit persons to whom the Software is
|
|
|
|
# furnished to do so, subject to the following conditions:
|
|
|
|
#
|
|
|
|
# The above copyright notice and this permission notice shall be included in
|
|
|
|
# all copies or substantial portions of the Software.
|
|
|
|
#
|
|
|
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
# THE SOFTWARE.
|
|
|
|
|
2022-11-18 12:30:28 -05:00
|
|
|
include ../../py/circuitpy_mkenv.mk
|
2020-03-11 18:13:06 -04:00
|
|
|
|
|
|
|
CROSS_COMPILE = arm-none-eabi-
|
|
|
|
|
2020-03-17 18:26:13 -04:00
|
|
|
MCU_SERIES_LOWER = $(shell echo $(MCU_SERIES) | tr '[:upper:]' '[:lower:]')
|
|
|
|
MCU_VARIANT_LOWER = $(shell echo $(MCU_VARIANT) | tr '[:upper:]' '[:lower:]')
|
|
|
|
|
2022-02-02 21:30:23 -05:00
|
|
|
HAL_DIR=st_driver/stm32$(MCU_SERIES_LOWER)xx_hal_driver
|
2020-03-11 18:13:06 -04:00
|
|
|
|
|
|
|
INC += -I.
|
|
|
|
INC += -I../..
|
|
|
|
INC += -I$(BUILD)
|
|
|
|
INC += -I$(BUILD)/genhdr
|
2020-03-17 18:26:13 -04:00
|
|
|
INC += -I./$(HAL_DIR)/Inc
|
|
|
|
INC += -I./$(HAL_DIR)/Inc/Legacy
|
2022-02-02 21:30:23 -05:00
|
|
|
INC += -I./st_driver/cmsis_device_$(MCU_SERIES_LOWER)/Include
|
|
|
|
INC += -I./st_driver/CMSIS_5/CMSIS/Core/Include
|
2020-03-11 18:13:06 -04:00
|
|
|
INC += -I./boards
|
|
|
|
INC += -I./boards/$(BOARD)
|
2020-04-20 21:25:13 -04:00
|
|
|
INC += -I./hal_conf
|
2020-03-11 18:13:06 -04:00
|
|
|
INC += -I./peripherals
|
2020-03-17 18:26:13 -04:00
|
|
|
INC += -I./packages
|
2020-03-11 18:13:06 -04:00
|
|
|
INC += -I../../lib/mp-readline
|
|
|
|
INC += -I../../lib/tinyusb/src
|
|
|
|
INC += -I../../supervisor/shared/usb
|
|
|
|
|
|
|
|
#Debugging/Optimization
|
|
|
|
ifeq ($(DEBUG), 1)
|
2020-07-01 17:48:10 -04:00
|
|
|
CFLAGS += -ggdb3
|
2023-06-05 17:16:25 -04:00
|
|
|
# You may want to enable these flags to make setting breakpoints easier.
|
2020-03-11 18:13:06 -04:00
|
|
|
CFLAGS += -fno-inline -fno-ipa-sra
|
|
|
|
else
|
2020-07-23 20:27:02 -04:00
|
|
|
CFLAGS += -DNDEBUG
|
2020-12-15 12:23:56 -05:00
|
|
|
OPTIMIZATION_FLAGS ?= -O2 -fno-inline-functions
|
2020-07-01 17:48:10 -04:00
|
|
|
CFLAGS += -ggdb3
|
2020-03-11 18:13:06 -04:00
|
|
|
endif
|
|
|
|
|
2020-07-23 20:27:02 -04:00
|
|
|
# to override compiler optimization level, set in boards/$(BOARD)/mpconfigboard.mk
|
|
|
|
CFLAGS += $(OPTIMIZATION_FLAGS)
|
2020-07-21 11:11:08 -04:00
|
|
|
|
2020-12-15 12:23:56 -05:00
|
|
|
# Add -ftree-vrp optimization and checking to all builds. It's not enabled for -Os by default.
|
|
|
|
CFLAGS += -ftree-vrp
|
|
|
|
|
2020-03-17 18:26:13 -04:00
|
|
|
# MCU Series is defined by the HAL package and doesn't need to be specified here
|
|
|
|
C_DEFS = -D$(MCU_PACKAGE) -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -D$(MCU_VARIANT)
|
2020-03-11 18:13:06 -04:00
|
|
|
|
2020-05-28 18:43:55 -04:00
|
|
|
CFLAGS += $(INC) -Werror -Wall -std=gnu11 -fshort-enums $(BASE_CFLAGS) $(C_DEFS) $(CFLAGS_MOD) $(COPT) -nostdlib -nostartfiles
|
2020-03-11 18:13:06 -04:00
|
|
|
|
|
|
|
# Undo some warnings.
|
2020-04-02 11:47:16 -04:00
|
|
|
# STM32 HAL uses undefined preprocessor variables, shadowed variables, casts that change alignment reqs
|
2020-09-16 14:05:15 -04:00
|
|
|
# You can add your own temporary suppression by setting ADD_CFLAGS in the make command
|
|
|
|
CFLAGS += -Wno-undef -Wno-shadow -Wno-cast-align $(ADD_CFLAGS)
|
2020-03-11 18:13:06 -04:00
|
|
|
|
2020-03-17 18:26:13 -04:00
|
|
|
CFLAGS += -mthumb -mabi=aapcs-linux
|
2020-03-11 18:13:06 -04:00
|
|
|
|
2020-03-17 18:26:13 -04:00
|
|
|
# Arm core selection
|
feat: add Blues Swan R5 support
complete pin mapping for Feather pins
stubbed out files needed for complilation. still to be modified
0 out all CPY modules in mpconfigboard.mk until we get the build running
add csv for pin generation for STM32L4R5
add F4R5 references in peripherals files
refactored out board files BECAUSE I AM AN IDIOT; add L4 series system clocks file from CubeMX
took a guess at the number of USB endpoint pairs to get the build done
guess was close, but wrong. It is 8
clean up peripheral DEFs
Fixes build error:
```
In file included from ../../py/mpstate.h:33,
from ../../py/mpstate.c:27:
../../py/misc.h: In function 'vstr_str':
../../py/misc.h:196:1: sorry, unimplemented: Thumb-1 hard-float VFP ABI
static inline char *vstr_str(vstr_t *vstr) {
^~~~~~
```
Sleuthing steps:
* verify that the feather_stm32f4_express board builds correctly
* put a `#error` at the bottom of the `mpstate.c` file.
* build for the feather and swan boards, with V=2 to capture the build command for that file.
* use a differencing tool to inspect the differences between the two invocations
* inspecting the differences, I saw a missing `-mcpu=cortex-m4` I tested by adding that to the Swan build command. The file built fine (stopping at the hard error, but no other warnings.)
A grep through the sources revealed where this flag was being set for the stm ports.
With this commit, the build gets further, but does not complete. The next exciting episode in this unfolding coding saga is just a commit away!
working build with minimal set of modules for the Blues Swan r5
chore:change header copyright name to Blues Wireless Contributors
USB operational. Fixed up clocks to be hardwired for LSE no HSE case. (Trying to combine HSE in there made the code much more complex, and I don't have a board to test it out on.)
USART working
adds support for `ENABLE_3V3` and `DISCHARGE_3V3` pins. I am surprised that pin definitions are quite low-level and don't include default direction and state, so the code currently has to initialize `ENABLE_3V3` pin as output. The LED takes over a second to discharge, so I wonder if the board startup code is not having the desired affect.
short circuit implementation of backup memory for the STM32L4
all the ports
remove company name from board name to be consistent with the Arduino board definition.
add default pins for I2C, SPI and UART, so that `board.I2C` et al. works as expected. Confirmed I2C timing.
fix board name
fix incorrect pin definition. add test to allow manual check of each output pin
analog IO
code changes for WebUSB. Doesn't appear to work, will revisit later.
ensure that `sys.platform` is available
checkin missing file
feat: make room for a larger filesystem so the sensor tutorial will fit on the device.
fix:(stm32l4r5zi.csv): merged AF0-7 and AF8-15 into single lines and removed extraneous headers mixed in with the data.
fix(parse_af_csv.py): pin index in the csv is 0 not 1, and AF index made 1 larger
chore(Swan R5): update peripherals pins from `parse_af_csv.py` output
optimize flash sector access
2021-07-29 18:06:31 -04:00
|
|
|
MCU_FLAGS_L4 = -mcpu=cortex-m4
|
2020-04-01 13:02:05 -04:00
|
|
|
MCU_FLAGS_F4 = -mcpu=cortex-m4
|
|
|
|
MCU_FLAGS_F7 = -mcpu=cortex-m7
|
|
|
|
MCU_FLAGS_H7 = -mcpu=cortex-m7
|
2020-03-17 18:26:13 -04:00
|
|
|
CFLAGS += $(MCU_FLAGS_$(MCU_SERIES))
|
2020-03-11 18:13:06 -04:00
|
|
|
|
2020-04-02 16:15:12 -04:00
|
|
|
# Select HAL file for distribution via mpconfigport
|
2021-04-22 20:55:39 -04:00
|
|
|
CFLAGS += -DSTM32_HAL_H="<stm32$(MCU_SERIES_LOWER)xx_hal.h>"
|
2020-03-11 18:13:06 -04:00
|
|
|
|
2020-04-24 11:15:55 -04:00
|
|
|
CFLAGS += -DSTM32_SERIES_LOWER='"stm32$(MCU_SERIES_LOWER)"'
|
|
|
|
|
2020-03-17 18:26:13 -04:00
|
|
|
# Floating point settings
|
|
|
|
ifeq ($(MCU_VARIANT),$(filter $(MCU_VARIANT),STM32F765xx STM32F767xx STM32F769xx STM32H743xx))
|
|
|
|
CFLAGS += -mfpu=fpv5-d16 -mfloat-abi=hard
|
|
|
|
else
|
|
|
|
CFLAGS += -mfpu=fpv4-sp-d16 -mfloat-abi=hard
|
|
|
|
endif
|
2020-03-11 18:13:06 -04:00
|
|
|
|
2020-03-17 18:26:13 -04:00
|
|
|
# Need both command and valid file to use uf2 bootloader
|
2020-03-11 18:13:06 -04:00
|
|
|
ifndef LD_FILE
|
|
|
|
ifneq ($(and $(UF2_BOOTLOADER),$(LD_BOOT)),)
|
|
|
|
LD_FILE = $(LD_BOOT)
|
|
|
|
BOOTLOADER_OFFSET = $(UF2_OFFSET)
|
|
|
|
CFLAGS += -DUF2_BOOTLOADER_ENABLED
|
|
|
|
else
|
|
|
|
LD_FILE = $(LD_DEFAULT)
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
# Add bootloader specific items
|
|
|
|
ifndef BOOTLOADER_OFFSET
|
|
|
|
BOOTLOADER_OFFSET := 0x8000000
|
|
|
|
endif
|
|
|
|
|
2020-05-28 18:43:55 -04:00
|
|
|
LDFLAGS = $(CFLAGS) -Wl,-nostdlib -Wl,-T,$(LD_FILE) -Wl,-T,$(LD_COMMON) -Wl,-Map=$@.map -Wl,-cref -Wl,-gc-sections -specs=nano.specs
|
2020-03-11 18:13:06 -04:00
|
|
|
LIBS := -lgcc -lc
|
|
|
|
|
|
|
|
# Use toolchain libm if we're not using our own.
|
|
|
|
ifndef INTERNAL_LIBM
|
|
|
|
LIBS += -lm
|
|
|
|
endif
|
|
|
|
|
|
|
|
# TinyUSB defines
|
2020-04-02 16:15:12 -04:00
|
|
|
CFLAGS += \
|
|
|
|
-DCFG_TUSB_MCU=OPT_MCU_STM32$(MCU_SERIES) \
|
|
|
|
-DCFG_TUD_CDC_RX_BUFSIZE=1024 \
|
|
|
|
-DCFG_TUD_CDC_TX_BUFSIZE=1024 \
|
|
|
|
-DCFG_TUD_MSC_BUFSIZE=4096 \
|
|
|
|
-DCFG_TUD_MIDI_RX_BUFSIZE=128 \
|
|
|
|
-DCFG_TUD_MIDI_TX_BUFSIZE=128
|
2020-03-17 18:26:13 -04:00
|
|
|
|
feat: add Blues Swan R5 support
complete pin mapping for Feather pins
stubbed out files needed for complilation. still to be modified
0 out all CPY modules in mpconfigboard.mk until we get the build running
add csv for pin generation for STM32L4R5
add F4R5 references in peripherals files
refactored out board files BECAUSE I AM AN IDIOT; add L4 series system clocks file from CubeMX
took a guess at the number of USB endpoint pairs to get the build done
guess was close, but wrong. It is 8
clean up peripheral DEFs
Fixes build error:
```
In file included from ../../py/mpstate.h:33,
from ../../py/mpstate.c:27:
../../py/misc.h: In function 'vstr_str':
../../py/misc.h:196:1: sorry, unimplemented: Thumb-1 hard-float VFP ABI
static inline char *vstr_str(vstr_t *vstr) {
^~~~~~
```
Sleuthing steps:
* verify that the feather_stm32f4_express board builds correctly
* put a `#error` at the bottom of the `mpstate.c` file.
* build for the feather and swan boards, with V=2 to capture the build command for that file.
* use a differencing tool to inspect the differences between the two invocations
* inspecting the differences, I saw a missing `-mcpu=cortex-m4` I tested by adding that to the Swan build command. The file built fine (stopping at the hard error, but no other warnings.)
A grep through the sources revealed where this flag was being set for the stm ports.
With this commit, the build gets further, but does not complete. The next exciting episode in this unfolding coding saga is just a commit away!
working build with minimal set of modules for the Blues Swan r5
chore:change header copyright name to Blues Wireless Contributors
USB operational. Fixed up clocks to be hardwired for LSE no HSE case. (Trying to combine HSE in there made the code much more complex, and I don't have a board to test it out on.)
USART working
adds support for `ENABLE_3V3` and `DISCHARGE_3V3` pins. I am surprised that pin definitions are quite low-level and don't include default direction and state, so the code currently has to initialize `ENABLE_3V3` pin as output. The LED takes over a second to discharge, so I wonder if the board startup code is not having the desired affect.
short circuit implementation of backup memory for the STM32L4
all the ports
remove company name from board name to be consistent with the Arduino board definition.
add default pins for I2C, SPI and UART, so that `board.I2C` et al. works as expected. Confirmed I2C timing.
fix board name
fix incorrect pin definition. add test to allow manual check of each output pin
analog IO
code changes for WebUSB. Doesn't appear to work, will revisit later.
ensure that `sys.platform` is available
checkin missing file
feat: make room for a larger filesystem so the sensor tutorial will fit on the device.
fix:(stm32l4r5zi.csv): merged AF0-7 and AF8-15 into single lines and removed extraneous headers mixed in with the data.
fix(parse_af_csv.py): pin index in the csv is 0 not 1, and AF index made 1 larger
chore(Swan R5): update peripherals pins from `parse_af_csv.py` output
optimize flash sector access
2021-07-29 18:06:31 -04:00
|
|
|
ifdef CIRCUITPY_USB_VENDOR
|
|
|
|
CFLAGS += \
|
|
|
|
-DCFG_TUD_VENDOR_RX_BUFSIZE=1024 \
|
|
|
|
-DCFG_TUD_VENDOR_TX_BUFSIZE=1024
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
2020-03-17 18:26:13 -04:00
|
|
|
SRC_STM32 = $(addprefix $(HAL_DIR)/Src/stm32$(MCU_SERIES_LOWER)xx_,\
|
2020-05-21 12:02:54 -04:00
|
|
|
hal.c \
|
2020-03-17 18:26:13 -04:00
|
|
|
hal_adc.c \
|
|
|
|
hal_adc_ex.c \
|
2020-05-21 12:02:54 -04:00
|
|
|
hal_cortex.c \
|
2020-03-17 18:26:13 -04:00
|
|
|
hal_dac.c \
|
|
|
|
hal_dac_ex.c \
|
2020-05-21 12:02:54 -04:00
|
|
|
hal_dma.c \
|
|
|
|
hal_dma_ex.c \
|
|
|
|
hal_exti.c \
|
|
|
|
hal_flash.c \
|
|
|
|
hal_flash_ex.c \
|
|
|
|
hal_gpio.c \
|
2020-03-17 18:26:13 -04:00
|
|
|
hal_i2c.c \
|
|
|
|
hal_i2c_ex.c \
|
2020-05-21 12:02:54 -04:00
|
|
|
hal_pwr.c \
|
|
|
|
hal_pwr_ex.c \
|
2020-03-17 18:26:13 -04:00
|
|
|
hal_qspi.c \
|
2020-05-21 12:02:54 -04:00
|
|
|
hal_rcc.c \
|
|
|
|
hal_rcc_ex.c \
|
2020-03-17 18:26:13 -04:00
|
|
|
hal_rng.c \
|
|
|
|
hal_rtc.c \
|
|
|
|
hal_rtc_ex.c \
|
2020-05-21 12:02:54 -04:00
|
|
|
hal_sd.c \
|
2020-03-17 18:26:13 -04:00
|
|
|
hal_spi.c \
|
|
|
|
hal_tim.c \
|
|
|
|
hal_tim_ex.c \
|
|
|
|
hal_uart.c \
|
|
|
|
hal_usart.c \
|
|
|
|
ll_adc.c \
|
|
|
|
ll_dma.c \
|
2020-05-21 12:02:54 -04:00
|
|
|
ll_exti.c \
|
|
|
|
ll_gpio.c \
|
|
|
|
ll_i2c.c \
|
|
|
|
ll_rcc.c \
|
2020-03-17 18:26:13 -04:00
|
|
|
ll_sdmmc.c \
|
|
|
|
ll_usart.c \
|
|
|
|
ll_utils.c \
|
2020-03-28 18:30:46 -04:00
|
|
|
)
|
2020-03-17 18:26:13 -04:00
|
|
|
|
2020-09-24 12:19:46 -04:00
|
|
|
ifeq ($(CIRCUITPY_CANIO),1)
|
|
|
|
SRC_STM32 += $(HAL_DIR)/Src/stm32$(MCU_SERIES_LOWER)xx_hal_can.c
|
|
|
|
endif
|
|
|
|
|
2020-04-06 19:13:55 -04:00
|
|
|
# Need this to avoid UART linker problems. TODO: rewrite to use registered callbacks.
|
|
|
|
# Does not exist for F4 and lower
|
feat: add Blues Swan R5 support
complete pin mapping for Feather pins
stubbed out files needed for complilation. still to be modified
0 out all CPY modules in mpconfigboard.mk until we get the build running
add csv for pin generation for STM32L4R5
add F4R5 references in peripherals files
refactored out board files BECAUSE I AM AN IDIOT; add L4 series system clocks file from CubeMX
took a guess at the number of USB endpoint pairs to get the build done
guess was close, but wrong. It is 8
clean up peripheral DEFs
Fixes build error:
```
In file included from ../../py/mpstate.h:33,
from ../../py/mpstate.c:27:
../../py/misc.h: In function 'vstr_str':
../../py/misc.h:196:1: sorry, unimplemented: Thumb-1 hard-float VFP ABI
static inline char *vstr_str(vstr_t *vstr) {
^~~~~~
```
Sleuthing steps:
* verify that the feather_stm32f4_express board builds correctly
* put a `#error` at the bottom of the `mpstate.c` file.
* build for the feather and swan boards, with V=2 to capture the build command for that file.
* use a differencing tool to inspect the differences between the two invocations
* inspecting the differences, I saw a missing `-mcpu=cortex-m4` I tested by adding that to the Swan build command. The file built fine (stopping at the hard error, but no other warnings.)
A grep through the sources revealed where this flag was being set for the stm ports.
With this commit, the build gets further, but does not complete. The next exciting episode in this unfolding coding saga is just a commit away!
working build with minimal set of modules for the Blues Swan r5
chore:change header copyright name to Blues Wireless Contributors
USB operational. Fixed up clocks to be hardwired for LSE no HSE case. (Trying to combine HSE in there made the code much more complex, and I don't have a board to test it out on.)
USART working
adds support for `ENABLE_3V3` and `DISCHARGE_3V3` pins. I am surprised that pin definitions are quite low-level and don't include default direction and state, so the code currently has to initialize `ENABLE_3V3` pin as output. The LED takes over a second to discharge, so I wonder if the board startup code is not having the desired affect.
short circuit implementation of backup memory for the STM32L4
all the ports
remove company name from board name to be consistent with the Arduino board definition.
add default pins for I2C, SPI and UART, so that `board.I2C` et al. works as expected. Confirmed I2C timing.
fix board name
fix incorrect pin definition. add test to allow manual check of each output pin
analog IO
code changes for WebUSB. Doesn't appear to work, will revisit later.
ensure that `sys.platform` is available
checkin missing file
feat: make room for a larger filesystem so the sensor tutorial will fit on the device.
fix:(stm32l4r5zi.csv): merged AF0-7 and AF8-15 into single lines and removed extraneous headers mixed in with the data.
fix(parse_af_csv.py): pin index in the csv is 0 not 1, and AF index made 1 larger
chore(Swan R5): update peripherals pins from `parse_af_csv.py` output
optimize flash sector access
2021-07-29 18:06:31 -04:00
|
|
|
ifeq ($(MCU_VARIANT),$(filter $(MCU_VARIANT),STM32F765xx STM32F767xx STM32F769xx STM32H743xx STM32L4R5xx))
|
2020-04-06 19:13:55 -04:00
|
|
|
SRC_STM32 += $(HAL_DIR)/Src/stm32$(MCU_SERIES_LOWER)xx_hal_uart_ex.c
|
|
|
|
endif
|
2020-03-11 18:13:06 -04:00
|
|
|
|
2020-04-06 19:13:55 -04:00
|
|
|
SRC_STM32 += boards/system_stm32$(MCU_SERIES_LOWER)xx.c
|
2020-03-11 18:13:06 -04:00
|
|
|
|
|
|
|
SRC_C += \
|
|
|
|
background.c \
|
|
|
|
mphalport.c \
|
|
|
|
boards/$(BOARD)/board.c \
|
|
|
|
boards/$(BOARD)/pins.c \
|
2020-07-01 10:07:45 -04:00
|
|
|
peripherals/timers.c \
|
2021-03-02 11:41:53 -05:00
|
|
|
peripherals/exti.c \
|
|
|
|
peripherals/rtc.c \
|
2020-06-02 17:51:51 -04:00
|
|
|
peripherals/stm32$(MCU_SERIES_LOWER)/clocks.c \
|
2020-03-17 18:26:13 -04:00
|
|
|
peripherals/stm32$(MCU_SERIES_LOWER)/$(MCU_VARIANT_LOWER)/pins.c \
|
|
|
|
peripherals/stm32$(MCU_SERIES_LOWER)/$(MCU_VARIANT_LOWER)/gpio.c \
|
|
|
|
peripherals/stm32$(MCU_SERIES_LOWER)/$(MCU_VARIANT_LOWER)/periph.c \
|
2021-04-22 20:55:39 -04:00
|
|
|
packages/$(MCU_PACKAGE).c
|
2020-03-11 18:13:06 -04:00
|
|
|
|
2022-11-04 16:15:15 -04:00
|
|
|
ifneq ($(CIRCUITPY_AUDIOBUSIO_PDMIN),0)
|
|
|
|
SRC_C += \
|
|
|
|
common-hal/audiobusio/MEMS_Audio.c \
|
|
|
|
common-hal/audiobusio/MEMS_Audio_ll_stm32l4.c \
|
|
|
|
common-hal/audiobusio/OpenPDMFilter.c
|
|
|
|
|
|
|
|
SRC_STM32 += \
|
|
|
|
$(HAL_DIR)/Src/stm32$(MCU_SERIES_LOWER)xx_hal_sai.c
|
|
|
|
|
|
|
|
endif
|
|
|
|
|
2021-04-16 10:59:11 -04:00
|
|
|
ifneq ($(CIRCUITPY_USB),0)
|
2023-03-12 14:02:38 -04:00
|
|
|
SRC_C += lib/tinyusb/src/portable/synopsys/dwc2/dcd_dwc2.c
|
2020-03-11 18:13:06 -04:00
|
|
|
endif
|
|
|
|
|
|
|
|
SRC_S = \
|
|
|
|
supervisor/cpu.s \
|
2022-02-02 21:30:23 -05:00
|
|
|
st_driver/cmsis_device_$(MCU_SERIES_LOWER)/Source/Templates/gcc/startup_$(MCU_VARIANT_LOWER).s
|
2020-03-11 18:13:06 -04:00
|
|
|
|
|
|
|
SRC_COMMON_HAL_EXPANDED = $(addprefix shared-bindings/, $(SRC_COMMON_HAL)) \
|
|
|
|
$(addprefix shared-bindings/, $(SRC_BINDINGS_ENUMS)) \
|
|
|
|
$(addprefix common-hal/, $(SRC_COMMON_HAL))
|
|
|
|
|
|
|
|
SRC_SHARED_MODULE_EXPANDED = $(addprefix shared-bindings/, $(SRC_SHARED_MODULE)) \
|
|
|
|
$(addprefix shared-module/, $(SRC_SHARED_MODULE)) \
|
|
|
|
$(addprefix shared-module/, $(SRC_SHARED_MODULE_INTERNAL))
|
|
|
|
|
|
|
|
|
|
|
|
ifneq ($(FROZEN_MPY_DIR),)
|
|
|
|
FROZEN_MPY_PY_FILES := $(shell find -L $(FROZEN_MPY_DIR) -type f -name '*.py')
|
|
|
|
FROZEN_MPY_MPY_FILES := $(addprefix $(BUILD)/,$(FROZEN_MPY_PY_FILES:.py=.mpy))
|
|
|
|
endif
|
|
|
|
|
|
|
|
OBJ += $(PY_O) $(SUPERVISOR_O) $(addprefix $(BUILD)/, $(SRC_C:.c=.o))
|
|
|
|
OBJ += $(addprefix $(BUILD)/, $(SRC_STM32:.c=.o))
|
|
|
|
OBJ += $(addprefix $(BUILD)/, $(SRC_COMMON_HAL_EXPANDED:.c=.o))
|
|
|
|
OBJ += $(addprefix $(BUILD)/, $(SRC_SHARED_MODULE_EXPANDED:.c=.o))
|
|
|
|
ifeq ($(INTERNAL_LIBM),1)
|
|
|
|
OBJ += $(addprefix $(BUILD)/, $(SRC_LIBM:.c=.o))
|
|
|
|
endif
|
2021-04-22 20:55:39 -04:00
|
|
|
OBJ += $(addprefix $(BUILD)/, $(SRC_CIRCUITPY_COMMON:.c=.o))
|
2020-03-11 18:13:06 -04:00
|
|
|
OBJ += $(addprefix $(BUILD)/, $(SRC_S:.s=.o))
|
|
|
|
OBJ += $(addprefix $(BUILD)/, $(SRC_MOD:.c=.o))
|
|
|
|
|
|
|
|
$(BUILD)/$(FATFS_DIR)/ff.o: COPT += -Os
|
|
|
|
$(filter $(PY_BUILD)/../extmod/vfs_fat_%.o, $(PY_O)): COPT += -Os
|
|
|
|
|
|
|
|
# List of sources for qstr extraction
|
|
|
|
SRC_QSTR += $(SRC_C) $(SRC_SUPERVISOR) $(SRC_MOD) $(SRC_COMMON_HAL_EXPANDED) $(SRC_SHARED_MODULE_EXPANDED)
|
|
|
|
# Sources that only hold QSTRs after pre-processing.
|
|
|
|
SRC_QSTR_PREPROCESSOR +=
|
|
|
|
|
2020-04-16 14:53:52 -04:00
|
|
|
# Bin section settings specific to the STM32H7
|
|
|
|
ifeq ($(MCU_VARIANT),$(filter $(MCU_VARIANT),STM32H743xx))
|
|
|
|
MCU_SECTIONS = -j .isr_vector -j .text -j .data -j .itcm -j .dtcm_data $^ $@
|
|
|
|
else
|
|
|
|
MCU_SECTIONS = $^ $@
|
|
|
|
endif
|
2020-03-11 18:13:06 -04:00
|
|
|
|
|
|
|
all: $(BUILD)/firmware.bin $(BUILD)/firmware.uf2
|
|
|
|
|
2023-06-05 17:16:25 -04:00
|
|
|
ifeq ($(VALID_BOARD),)
|
|
|
|
$(BUILD)/firmware.elf: invalid-board
|
|
|
|
else
|
2020-03-11 18:13:06 -04:00
|
|
|
$(BUILD)/firmware.elf: $(OBJ)
|
|
|
|
$(STEPECHO) "LINK $@"
|
2021-05-27 16:25:29 -04:00
|
|
|
$(Q)echo $^ > $(BUILD)/firmware.objs
|
|
|
|
$(Q)$(CC) -o $@ $(LDFLAGS) @$(BUILD)/firmware.objs -Wl,--start-group $(LIBS) -Wl,--end-group
|
2023-03-04 03:37:38 -05:00
|
|
|
$(Q)$(SIZE) $@ | $(PYTHON) $(TOP)/tools/build_memory_info.py $(LD_FILE) $(BUILD)
|
2023-06-05 17:16:25 -04:00
|
|
|
endif
|
2020-03-11 18:13:06 -04:00
|
|
|
|
|
|
|
$(BUILD)/firmware.bin: $(BUILD)/firmware.elf
|
|
|
|
$(STEPECHO) "Create $@"
|
2020-04-16 14:53:52 -04:00
|
|
|
$(Q)$(OBJCOPY) -O binary $(MCU_SECTIONS)
|
2020-03-11 18:13:06 -04:00
|
|
|
|
|
|
|
$(BUILD)/firmware.hex: $(BUILD)/firmware.elf
|
|
|
|
$(STEPECHO) "Create $@"
|
2020-04-16 14:53:52 -04:00
|
|
|
$(Q)$(OBJCOPY) -O ihex $(MCU_SECTIONS)
|
2020-03-11 18:13:06 -04:00
|
|
|
|
|
|
|
$(BUILD)/firmware.uf2: $(BUILD)/firmware.hex
|
|
|
|
$(ECHO) "Create $@"
|
2022-05-25 17:18:37 -04:00
|
|
|
$(PYTHON) $(TOP)/tools/uf2/utils/uf2conv.py -f $(UF2_FAMILY_ID) -b $(BOOTLOADER_OFFSET) -c -o "$(BUILD)/firmware.uf2" $^
|
2020-03-11 18:13:06 -04:00
|
|
|
|
2020-04-27 20:43:35 -04:00
|
|
|
flash: $(BUILD)/firmware.bin
|
|
|
|
$(ECHO) "Writing $< to the board"
|
2022-05-25 17:18:37 -04:00
|
|
|
dfu-util -a 0 --dfuse-address $(BOOTLOADER_OFFSET) -D $(BUILD)/firmware.bin
|
2020-04-27 20:43:35 -04:00
|
|
|
|
2020-03-11 18:13:06 -04:00
|
|
|
include $(TOP)/py/mkrules.mk
|