forked from micropython/micropython
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
STM32: Add F7 and H7 Support #2735
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 4 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
bb167f0
WIP
hierophect bb3ed3a
Merge branch 'master' into stm32x7-setup
hierophect c4db8b8
Add F7 and H7 Support to the STM32 port
hierophect 348df4b
Merge remote-tracking branch 'upstream/master' into stm32x7-setup
hierophect 7995bca
Flash additions
hierophect e2be069
Support cached internal flash on the H743
hierophect a89928c
Implement requested changes
hierophect 5703d1d
Merge branch 'master' into stm32x7-setup
hierophect 2f764de
merge and docs
hierophect 80b08bf
Merge branch 'stm32x7-setup' of https://github.com/hierophect/circuit…
hierophect 47a5d83
Implement F7 Nucleo
hierophect 9761672
Linker file restructure, TCM and MPU additions
hierophect 92a0621
Add busio support, cleanup
hierophect 5ac38c9
Various requested fixes
hierophect 6227e63
Merge remote-tracking branch 'upstream/master' into stm32x7-setup
hierophect 426d2af
Fix pin mapping for the H7 Nucleo
hierophect 83a55f6
Implement cache-based reads
hierophect 6427994
Implement requested changes
hierophect 0f87a75
translations
hierophect 54abfc2
translations-merge
hierophect a1451aa
Correct submodule desync
hierophect 00b2e6a
Fix korea translation error, minor submodule change
hierophect 9e49fc1
startup file crash fix, H7 bin fix
hierophect File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Submodule ulab
updated
25 files
+0 −4 | .github/workflows/build.yml | |
+20 −23 | README.md | |
+1 −1 | build.sh | |
+2 −13 | code/extras.c | |
+0 −1 | code/extras.h | |
+17 −0 | code/fft.c | |
+0 −8 | code/fft.h | |
+6 −66 | code/linalg.c | |
+0 −6 | code/linalg.h | |
+9 −24 | code/ndarray.c | |
+1 −1 | code/ulab.c | |
+1 −1 | code/ulab.h | |
+0 −80 | code/vectorise.c | |
+2 −2 | docs/manual/source/conf.py | |
+302 −445 | docs/manual/source/ulab.rst | |
+0 −12 | docs/ulab-change-log.md | |
+596 −784 | docs/ulab-manual.ipynb | |
+0 −17 | tests/cholesky.py | |
+0 −9 | tests/cholesky.py.exp | |
+0 −17 | tests/linalg.py | |
+0 −12 | tests/linalg.py.exp | |
+0 −27 | tests/poly.py | |
+0 −4 | tests/poly.py.exp | |
+0 −25 | tests/slicing.py | |
+0 −996 | tests/slicing.py.exp |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,6 @@ | |
# 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. | ||
# DEBUG = 1 | ||
|
||
# Select the board to build for. | ||
ifeq ($(BOARD),) | ||
|
@@ -58,21 +57,23 @@ include $(TOP)/py/circuitpy_defns.mk | |
|
||
CROSS_COMPILE = arm-none-eabi- | ||
|
||
####################################### | ||
# CFLAGS | ||
####################################### | ||
MCU_SERIES_LOWER = $(shell echo $(MCU_SERIES) | tr '[:upper:]' '[:lower:]') | ||
MCU_VARIANT_LOWER = $(shell echo $(MCU_VARIANT) | tr '[:upper:]' '[:lower:]') | ||
|
||
HAL_DIR=st_driver/STM32$(MCU_SERIES)xx_HAL_Driver | ||
|
||
INC += -I. | ||
INC += -I../.. | ||
INC += -I$(BUILD) | ||
INC += -I$(BUILD)/genhdr | ||
INC += -I./st_driver/STM32F4xx_HAL_Driver/Inc | ||
INC += -I./st_driver/STM32F4xx_HAL_Driver/Inc/Legacy | ||
INC += -I./st_driver/CMSIS/Device/ST/STM32F4xx/Include | ||
INC += -I./$(HAL_DIR)/Inc | ||
INC += -I./$(HAL_DIR)/Inc/Legacy | ||
INC += -I./st_driver/CMSIS/Device/ST/STM32$(MCU_SERIES)xx/Include | ||
INC += -I./st_driver/CMSIS/Include | ||
INC += -I./boards | ||
INC += -I./boards/$(BOARD) | ||
INC += -I./peripherals | ||
INC += -I./packages | ||
INC += -I../../lib/mp-readline | ||
INC += -I../../lib/tinyusb/src | ||
INC += -I../../supervisor/shared/usb | ||
|
@@ -87,11 +88,11 @@ else | |
CFLAGS += -Os -DNDEBUG | ||
CFLAGS += -ggdb | ||
# TODO: Test with -flto | ||
### CFLAGS += -flto | ||
# CFLAGS += -flto | ||
endif | ||
|
||
|
||
C_DEFS = -DMCU_PACKAGE=$(MCU_PACKAGE) -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -D$(CMSIS_MCU) | ||
# 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) | ||
|
||
CFLAGS += $(INC) -Werror -Wall -std=gnu11 -nostdlib $(BASE_CFLAGS) $(C_DEFS) $(CFLAGS_MOD) $(COPT) | ||
|
||
|
@@ -102,17 +103,24 @@ CFLAGS += -Wno-undef | |
# STM32 might do casts that increase alignment requirements. | ||
CFLAGS += -Wno-cast-align | ||
|
||
CFLAGS += \ | ||
-mthumb \ | ||
-mabi=aapcs-linux \ | ||
-mfloat-abi=hard \ | ||
-mcpu=cortex-m4 \ | ||
-mfpu=fpv4-sp-d16 | ||
CFLAGS += -mthumb -mabi=aapcs-linux | ||
|
||
# TODO: check this | ||
CFLAGS += -D__START=main | ||
# Arm core selection | ||
MCU_FLAGS_F4 = -mtune=cortex-m4 -mcpu=cortex-m4 | ||
MCU_FLAGS_F7 = -mtune=cortex-m7 -mcpu=cortex-m7 | ||
MCU_FLAGS_H7 = -mtune=cortex-m7 -mcpu=cortex-m7 | ||
CFLAGS += $(MCU_FLAGS_$(MCU_SERIES)) | ||
|
||
#need both command and valid file to use uf2 bootloader | ||
CFLAGS += -DSTM32_HAL_H='<stm32$(MCU_SERIES_LOWER)xx_hal.h>' | ||
|
||
# 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 | ||
|
||
# Need both command and valid file to use uf2 bootloader | ||
ifndef LD_FILE | ||
ifneq ($(and $(UF2_BOOTLOADER),$(LD_BOOT)),) | ||
LD_FILE = $(LD_BOOT) | ||
|
@@ -131,63 +139,60 @@ endif | |
LDFLAGS = $(CFLAGS) -fshort-enums -Wl,-nostdlib -Wl,-T,$(LD_FILE) -Wl,[email protected] -Wl,-cref -Wl,-gc-sections -specs=nano.specs | ||
LIBS := -lgcc -lc | ||
|
||
LDFLAGS += -mthumb -mcpu=cortex-m4 | ||
LDFLAGS += -mthumb $(MCU_FLAGS_$(MCU_SERIES)) | ||
hierophect marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
# Use toolchain libm if we're not using our own. | ||
ifndef INTERNAL_LIBM | ||
LIBS += -lm | ||
endif | ||
|
||
# TinyUSB defines | ||
CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_STM32F4 -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 | ||
|
||
|
||
###################################### | ||
# source | ||
###################################### | ||
|
||
SRC_STM32 = \ | ||
st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_adc.c \ | ||
st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_adc_ex.c \ | ||
st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dac.c \ | ||
st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dac_ex.c \ | ||
st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2c.c \ | ||
st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2c_ex.c \ | ||
st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_qspi.c \ | ||
st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rng.c \ | ||
st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rtc.c \ | ||
st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rtc_ex.c \ | ||
st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_spi.c \ | ||
st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.c \ | ||
st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim_ex.c \ | ||
st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_uart.c \ | ||
st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_usart.c \ | ||
st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc.c \ | ||
st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc_ex.c \ | ||
st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash.c \ | ||
st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ex.c \ | ||
st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ramfunc.c \ | ||
st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_gpio.c \ | ||
st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma_ex.c \ | ||
st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.c \ | ||
st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr.c \ | ||
st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr_ex.c \ | ||
st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cortex.c \ | ||
st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.c \ | ||
st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_exti.c \ | ||
st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sd.c \ | ||
st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_gpio.c \ | ||
st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_adc.c \ | ||
st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_fsmc.c \ | ||
st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_i2c.c \ | ||
st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_dma.c \ | ||
st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_sdmmc.c \ | ||
st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_usart.c \ | ||
st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_rcc.c \ | ||
st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_utils.c \ | ||
st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_exti.c \ | ||
system_stm32f4xx.c | ||
|
||
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 | ||
|
||
SRC_STM32 = $(addprefix $(HAL_DIR)/Src/stm32$(MCU_SERIES_LOWER)xx_,\ | ||
hal_adc.c \ | ||
hal_adc_ex.c \ | ||
hal_dac.c \ | ||
hal_dac_ex.c \ | ||
hal_i2c.c \ | ||
hal_i2c_ex.c \ | ||
hal_qspi.c \ | ||
hal_rng.c \ | ||
hal_rtc.c \ | ||
hal_rtc_ex.c \ | ||
hal_spi.c \ | ||
hal_tim.c \ | ||
hal_tim_ex.c \ | ||
hal_uart.c \ | ||
hal_usart.c \ | ||
hal_rcc.c \ | ||
hal_rcc_ex.c \ | ||
hal_flash.c \ | ||
hal_flash_ex.c \ | ||
hal_gpio.c \ | ||
hal_dma_ex.c \ | ||
hal_dma.c \ | ||
hal_pwr.c \ | ||
hal_pwr_ex.c \ | ||
hal_cortex.c \ | ||
hal.c \ | ||
hal_exti.c \ | ||
hal_sd.c \ | ||
ll_gpio.c \ | ||
ll_adc.c \ | ||
ll_i2c.c \ | ||
ll_dma.c \ | ||
ll_sdmmc.c \ | ||
ll_usart.c \ | ||
ll_rcc.c \ | ||
ll_utils.c \ | ||
ll_exti.c \ | ||
) | ||
#removed: | ||
# hal_flash_ramfunc.c \ | ||
# ll_fsmc.c \ | ||
hierophect marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
SRC_STM32 += system_stm32$(MCU_SERIES_LOWER)xx.c | ||
|
||
SRC_C += \ | ||
background.c \ | ||
|
@@ -196,10 +201,11 @@ SRC_C += \ | |
tick.c \ | ||
boards/$(BOARD)/board.c \ | ||
boards/$(BOARD)/pins.c \ | ||
peripherals/stm32f4/$(MCU_SUB_VARIANT)/pins.c \ | ||
peripherals/stm32f4/$(MCU_SUB_VARIANT)/clocks.c \ | ||
peripherals/stm32f4/$(MCU_SUB_VARIANT)/gpio.c \ | ||
peripherals/stm32f4/$(MCU_SUB_VARIANT)/periph.c \ | ||
peripherals/stm32$(MCU_SERIES_LOWER)/$(MCU_VARIANT_LOWER)/pins.c \ | ||
peripherals/stm32$(MCU_SERIES_LOWER)/$(MCU_VARIANT_LOWER)/clocks.c \ | ||
peripherals/stm32$(MCU_SERIES_LOWER)/$(MCU_VARIANT_LOWER)/gpio.c \ | ||
peripherals/stm32$(MCU_SERIES_LOWER)/$(MCU_VARIANT_LOWER)/periph.c \ | ||
packages/$(MCU_PACKAGE).c\ | ||
lib/libc/string0.c \ | ||
lib/mp-readline/readline.c \ | ||
lib/oofatfs/ff.c \ | ||
|
@@ -219,7 +225,7 @@ endif | |
|
||
SRC_S = \ | ||
supervisor/cpu.s \ | ||
boards/startup_$(MCU_SUB_VARIANT).s | ||
boards/startup_$(MCU_VARIANT_LOWER).s | ||
|
||
SRC_COMMON_HAL_EXPANDED = $(addprefix shared-bindings/, $(SRC_COMMON_HAL)) \ | ||
$(addprefix shared-bindings/, $(SRC_BINDINGS_ENUMS)) \ | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
# CircuitPython Port To The ST Microelectronics STM32F4 Series | ||
# CircuitPython Port To The ST Microelectronics STM32 Series | ||
|
||
This is a port of CircuitPython to the STM32F4 series of chips. | ||
This is a port of CircuitPython to the STM32 series of chips. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.