forked from micropython/micropython
-
Notifications
You must be signed in to change notification settings - Fork 207
Add STM32H743 board support: DEV190806042, FK743M5-XIH6, STM32H7_CORE #104
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
Open
nuraci
wants to merge
2
commits into
lvgl:master
Choose a base branch
from
Copper-And-Code:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
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 |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| /* | ||
| * This file is part of the MicroPython project, http://micropython.org/ | ||
| * | ||
| * The MIT License (MIT) | ||
| * | ||
| * Copyright (c) 2018-2019 Damien P. George | ||
| * | ||
| * 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. | ||
| */ | ||
|
|
||
| #include "storage.h" | ||
| #include "qspi.h" | ||
|
|
||
| #if MICROPY_HW_SPIFLASH_ENABLE_CACHE | ||
| // Shared cache for first and second SPI block devices | ||
| static mp_spiflash_cache_t spi_bdev_cache; | ||
| #endif | ||
|
|
||
| // First external SPI flash uses hardware QSPI interface | ||
|
|
||
| const mp_spiflash_config_t spiflash_config = { | ||
| .bus_kind = MP_SPIFLASH_BUS_QSPI, | ||
| .bus.u_qspi.data = NULL, | ||
| .bus.u_qspi.proto = &qspi_proto, | ||
| #if MICROPY_HW_SPIFLASH_ENABLE_CACHE | ||
| .cache = &spi_bdev_cache, | ||
| #endif | ||
| }; | ||
|
|
||
| spi_bdev_t spi_bdev; |
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 |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| { | ||
| "deploy": [ | ||
| "../deploy.md" | ||
| ], | ||
| "docs": "", | ||
| "features": [], | ||
| "images": [ | ||
| "DEV190806042.jpg", | ||
| "DEV190806042_B.jpg" | ||
| ], | ||
| "mcu": "stm32h7", | ||
| "product": "DEV190806042", | ||
| "thumbnail": "", | ||
| "url": "", | ||
| "vendor": "Aliexpress" | ||
| } |
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 |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| include("$(PORT_DIR)/boards/manifest.py") |
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 |
|---|---|---|
| @@ -0,0 +1,196 @@ | ||
| #define MICROPY_HW_BOARD_NAME "DEV190806042" | ||
| #define MICROPY_HW_MCU_NAME "STM32H743" | ||
|
|
||
| #define MICROPY_HW_ENABLE_RTC (1) | ||
| #define MICROPY_HW_ENABLE_SERVO (1) | ||
| #define MICROPY_HW_ENABLE_RNG (1) | ||
| #define MICROPY_HW_ENABLE_HW_I2C (1) | ||
| #define MICROPY_HW_ENABLE_ADC (1) | ||
| #define MICROPY_HW_ENABLE_DAC (1) | ||
| #define MICROPY_HW_ENABLE_USB (1) | ||
| #define MICROPY_HW_USB_HID (1) | ||
| #define MICROPY_HW_ENABLE_SDCARD (0) | ||
| #define MICROPY_HW_HAS_FLASH (1) | ||
| #define MICROPY_HW_ENABLE_STORAGE (1) | ||
|
|
||
| #define MODULE_ST_LTDC_ENABLED (1) | ||
| #define MODULE_TOUCH_I2C_ENABLED (1) | ||
|
|
||
| // CAUTION: Do not enable! A bug here creates incorrect Option Bytes, | ||
| // potentially bricking the device. | ||
| #define MICROPY_HW_ENABLE_INTERNAL_FLASH_STORAGE (0) | ||
|
|
||
| #define MICROPY_HW_ENTER_BOOTLOADER_VIA_RESET (0) | ||
| #define MICROPY_HW_SDCARD_MOUNT_AT_BOOT (0) | ||
|
|
||
| #if defined(MODULE_ST_LTDC_ENABLED) && MODULE_ST_LTDC_ENABLED | ||
| extern void lv_deinit(void); | ||
| #define MICROPY_BOARD_START_SOFT_RESET(state) do { boardctrl_start_soft_reset(state); lv_deinit(); } while(0) | ||
| #endif | ||
|
|
||
| // The board has an 25MHz HSE, the following gives 480MHz CPU speed | ||
| #define MICROPY_HW_CLK_PLLM (5) | ||
| #define MICROPY_HW_CLK_PLLN (192) | ||
| #define MICROPY_HW_CLK_PLLP (2) | ||
| #define MICROPY_HW_CLK_PLLQ (2) | ||
| #define MICROPY_HW_CLK_PLLR (2) | ||
| #define MICROPY_HW_CLK_PLLVCI (RCC_PLL1VCIRANGE_2) | ||
| #define MICROPY_HW_CLK_PLLVCO (RCC_PLL1VCOWIDE) | ||
| #define MICROPY_HW_CLK_PLLFRAC (0) | ||
|
|
||
| // Bus clock divider values | ||
| #define MICROPY_HW_CLK_AHB_DIV (RCC_HCLK_DIV2) | ||
| #define MICROPY_HW_CLK_APB1_DIV (RCC_APB1_DIV2) | ||
| #define MICROPY_HW_CLK_APB2_DIV (RCC_APB2_DIV2) | ||
| #define MICROPY_HW_CLK_APB3_DIV (RCC_APB3_DIV2) | ||
| #define MICROPY_HW_CLK_APB4_DIV (RCC_APB4_DIV2) | ||
|
|
||
| // 4 wait states | ||
| #define MICROPY_HW_FLASH_LATENCY FLASH_LATENCY_4 | ||
|
|
||
| // UART config | ||
| #define MICROPY_HW_UART1_TX (pin_A9) | ||
| #define MICROPY_HW_UART1_RX (pin_A10) | ||
| #define MICROPY_HW_UART_REPL PYB_UART_1 | ||
| #define MICROPY_HW_UART_REPL_BAUD 115200 | ||
|
|
||
| // FLASH QSPI config - W25Q256 | ||
| #define MICROPY_HW_QSPIFLASH_SIZE_BITS_LOG2 (28) | ||
| #define MICROPY_HW_QSPIFLASH_CS (pin_G6) | ||
| #define MICROPY_HW_QSPIFLASH_SCK (pin_F10) | ||
| #define MICROPY_HW_QSPIFLASH_IO0 (pin_F8) | ||
| #define MICROPY_HW_QSPIFLASH_IO1 (pin_F9) | ||
| #define MICROPY_HW_QSPIFLASH_IO2 (pin_F7) | ||
| #define MICROPY_HW_QSPIFLASH_IO3 (pin_F6) | ||
|
|
||
| // Block device config for SPI flash | ||
| extern const struct _mp_spiflash_config_t spiflash_config; | ||
| extern struct _spi_bdev_t spi_bdev; | ||
| #define MICROPY_HW_SPIFLASH_ENABLE_CACHE (1) | ||
| #define MICROPY_HW_BDEV_SPIFLASH (&spi_bdev) | ||
| #define MICROPY_HW_BDEV_SPIFLASH_CONFIG (&spiflash_config) | ||
| #define MICROPY_HW_SPIFLASH_SIZE_BITS (256 * 1024 * 1024) | ||
| #define MICROPY_HW_BDEV_SPIFLASH_SIZE_BYTES (MICROPY_HW_SPIFLASH_SIZE_BITS / 8) | ||
| #define MICROPY_HW_QSPI_PRESCALER (2) | ||
| #define MICROPY_HW_BDEV_SPIFLASH_EXTENDED (&spi_bdev) | ||
|
|
||
| // USB config | ||
| // Enable the HSI48 oscillator and route it to USB | ||
| #define MICROPY_HW_RCC_HSI48_STATE (RCC_HSI48_ON) | ||
| #define MICROPY_HW_RCC_USB_CLKSOURCE (RCC_USBCLKSOURCE_HSI48) | ||
|
|
||
| #define MICROPY_HW_USB_FS (1) | ||
| #define MICROPY_HW_USB_HS (0) | ||
| #define MICROPY_HW_USB_HS_IN_FS (0) | ||
| #define MICROPY_HW_USB_MAIN_DEV (USB_PHY_FS_ID) | ||
| #define MICROPY_HW_USB_CDC_NUM (2) | ||
| #define MICROPY_HW_USB_MSC (1) | ||
|
|
||
| #define MICROPY_HW_USB_PRODUCT_FS_STRING "STM32H7 Virtual Comm Port in FS Mode" | ||
| #define MICROPY_HW_USB_INTERFACE_FS_STRING "STM32H7 Interface" | ||
| #define MICROPY_HW_USB_MSC_INQUIRY_PRODUCT_STRING "STM32H7 Flash " | ||
|
|
||
| #define MICROPY_HW_LED1 (pin_B0) | ||
| #define MICROPY_HW_LED_ON(pin) (mp_hal_pin_low(pin)) | ||
| #define MICROPY_HW_LED_OFF(pin) (mp_hal_pin_high(pin)) | ||
|
|
||
| #define MICROPY_HW_USRSW_PIN (pin_A0) | ||
| #define MICROPY_HW_HAS_SWITCH (1) | ||
| // USRSW is pulled low. Pressing the button makes the input go high. | ||
| #define MICROPY_HW_USRSW_PULL (GPIO_NOPULL) | ||
| #define MICROPY_HW_USRSW_EXTI_MODE (GPIO_MODE_IT_RISING) | ||
| #define MICROPY_HW_USRSW_PRESSED (1) | ||
|
|
||
| // I2C buses | ||
| #define MICROPY_HW_I2C4_SCL (pin_D12) | ||
| #define MICROPY_HW_I2C4_SDA (pin_D13) | ||
|
|
||
| // SDRAM | ||
| #define MICROPY_HW_SDRAM_SIZE (32 * 1024 * 1024) | ||
| #define MICROPY_HW_SDRAM_STARTUP_TEST (1) | ||
| #define MICROPY_HW_SDRAM_TEST_FAIL_ON_ERROR (1) | ||
| #define MICROPY_HEAP_START ((sdram_valid) ? sdram_start() : &_heap_start) | ||
| #define MICROPY_HEAP_END ((sdram_valid) ? sdram_end() : &_heap_end) | ||
|
|
||
| // Timing configuration for SDRAM @120Mhz | ||
| #define MICROPY_HW_SDRAM_TIMING_TMRD (2) | ||
| #define MICROPY_HW_SDRAM_TIMING_TXSR (9) | ||
| #define MICROPY_HW_SDRAM_TIMING_TRAS (6) | ||
| #define MICROPY_HW_SDRAM_TIMING_TRC (8) | ||
| #define MICROPY_HW_SDRAM_TIMING_TWR (2) | ||
| #define MICROPY_HW_SDRAM_TIMING_TRP (3) | ||
| #define MICROPY_HW_SDRAM_TIMING_TRCD (3) | ||
| #define MICROPY_HW_SDRAM_REFRESH_RATE (64) | ||
| // Required by upstream micropython SDRAM driver; | ||
| // harmless on lv_micropython until sync. | ||
| #define MICROPY_HW_SDRAM_FREQUENCY_KHZ (120000) // 120 MHz | ||
| #define MICROPY_HW_SDRAM_REFRESH_CYCLES 8192 | ||
|
|
||
| #define MICROPY_HW_SDRAM_BURST_LENGTH 8 | ||
| #define MICROPY_HW_SDRAM_CAS_LATENCY 2 | ||
| #define MICROPY_HW_SDRAM_COLUMN_BITS_NUM 9 | ||
| #define MICROPY_HW_SDRAM_ROW_BITS_NUM 12 | ||
| #define MICROPY_HW_SDRAM_MEM_BUS_WIDTH 32 | ||
| #define MICROPY_HW_SDRAM_INTERN_BANKS_NUM 4 | ||
| #define MICROPY_HW_SDRAM_CLOCK_PERIOD 2 | ||
| #define MICROPY_HW_SDRAM_RPIPE_DELAY 1 | ||
| #define MICROPY_HW_SDRAM_RBURST (1) | ||
| #define MICROPY_HW_SDRAM_WRITE_PROTECTION (0) | ||
| #define MICROPY_HW_SDRAM_AUTOREFRESH_NUM (4) | ||
|
|
||
| #define MICROPY_HW_FMC_SDNE0 (pin_C2) | ||
| #define MICROPY_HW_FMC_SDCKE0 (pin_C3) | ||
| #define MICROPY_HW_FMC_SDNWE (pin_C0) | ||
| #define MICROPY_HW_FMC_SDNRAS (pin_F11) | ||
| #define MICROPY_HW_FMC_SDNCAS (pin_G15) | ||
| #define MICROPY_HW_FMC_SDCLK (pin_G8) | ||
| #define MICROPY_HW_FMC_BA0 (pin_G4) | ||
| #define MICROPY_HW_FMC_BA1 (pin_G5) | ||
| #define MICROPY_HW_FMC_NBL0 (pin_E0) | ||
| #define MICROPY_HW_FMC_NBL1 (pin_E1) | ||
| #define MICROPY_HW_FMC_NBL2 (pin_I4) | ||
| #define MICROPY_HW_FMC_NBL3 (pin_I5) | ||
| #define MICROPY_HW_FMC_A0 (pin_F0) | ||
| #define MICROPY_HW_FMC_A1 (pin_F1) | ||
| #define MICROPY_HW_FMC_A2 (pin_F2) | ||
| #define MICROPY_HW_FMC_A3 (pin_F3) | ||
| #define MICROPY_HW_FMC_A4 (pin_F4) | ||
| #define MICROPY_HW_FMC_A5 (pin_F5) | ||
| #define MICROPY_HW_FMC_A6 (pin_F12) | ||
| #define MICROPY_HW_FMC_A7 (pin_F13) | ||
| #define MICROPY_HW_FMC_A8 (pin_F14) | ||
| #define MICROPY_HW_FMC_A9 (pin_F15) | ||
| #define MICROPY_HW_FMC_A10 (pin_G0) | ||
| #define MICROPY_HW_FMC_A11 (pin_G1) | ||
| #define MICROPY_HW_FMC_D0 (pin_D14) | ||
| #define MICROPY_HW_FMC_D1 (pin_D15) | ||
| #define MICROPY_HW_FMC_D2 (pin_D0) | ||
| #define MICROPY_HW_FMC_D3 (pin_D1) | ||
| #define MICROPY_HW_FMC_D4 (pin_E7) | ||
| #define MICROPY_HW_FMC_D5 (pin_E8) | ||
| #define MICROPY_HW_FMC_D6 (pin_E9) | ||
| #define MICROPY_HW_FMC_D7 (pin_E10) | ||
| #define MICROPY_HW_FMC_D8 (pin_E11) | ||
| #define MICROPY_HW_FMC_D9 (pin_E12) | ||
| #define MICROPY_HW_FMC_D10 (pin_E13) | ||
| #define MICROPY_HW_FMC_D11 (pin_E14) | ||
| #define MICROPY_HW_FMC_D12 (pin_E15) | ||
| #define MICROPY_HW_FMC_D13 (pin_D8) | ||
| #define MICROPY_HW_FMC_D14 (pin_D9) | ||
| #define MICROPY_HW_FMC_D15 (pin_D10) | ||
| #define MICROPY_HW_FMC_D16 (pin_H8) | ||
| #define MICROPY_HW_FMC_D17 (pin_H9) | ||
| #define MICROPY_HW_FMC_D18 (pin_H10) | ||
| #define MICROPY_HW_FMC_D19 (pin_H11) | ||
| #define MICROPY_HW_FMC_D20 (pin_H12) | ||
| #define MICROPY_HW_FMC_D21 (pin_H13) | ||
| #define MICROPY_HW_FMC_D22 (pin_H14) | ||
| #define MICROPY_HW_FMC_D23 (pin_H15) | ||
| #define MICROPY_HW_FMC_D24 (pin_I0) | ||
| #define MICROPY_HW_FMC_D25 (pin_I1) | ||
| #define MICROPY_HW_FMC_D26 (pin_I2) | ||
| #define MICROPY_HW_FMC_D27 (pin_I3) | ||
| #define MICROPY_HW_FMC_D28 (pin_I6) | ||
| #define MICROPY_HW_FMC_D29 (pin_I7) | ||
| #define MICROPY_HW_FMC_D30 (pin_I9) | ||
| #define MICROPY_HW_FMC_D31 (pin_I10) |
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 |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
|
|
||
| # MCU settings | ||
| MCU_SERIES = h7 | ||
| CMSIS_MCU = STM32H743xx | ||
| MICROPY_FLOAT_IMPL = double | ||
| AF_FILE = boards/stm32h743_af.csv | ||
| TOP_DIR := $(abspath ../..) | ||
|
|
||
| # Enable LVGL modules | ||
| LV_CONF_PATH = ${TOP_DIR}/user_modules/lv_binding_micropython/driver/stm32/st_ltdc/lv_conf.h | ||
| USER_C_MODULES = ${TOP_DIR}/user_modules/lv_binding_micropython/micropython.mk | ||
| USER_C_MODULES += ${TOP_DIR}/user_modules/lv_binding_micropython/driver/stm32/st_ltdc | ||
|
|
||
| ifeq ($(USE_MBOOT),1) | ||
| # When using Mboot everything goes after the bootloader | ||
| LD_FILES = boards/FK743M5-XIH6/stm32h743.ld | ||
| TEXT0_ADDR = 0x08020000 | ||
| else | ||
| # When not using Mboot everything goes at the start of flash | ||
| LD_FILES = boards/FK743M5-XIH6/stm32h743.ld | ||
| TEXT0_ADDR = 0x08000000 | ||
| endif | ||
|
|
||
| # MicroPython settings | ||
| MICROPY_PY_LWIP = 0 | ||
| MICROPY_PY_SSL = 0 | ||
| MICROPY_SSL_MBEDTLS = 0 | ||
| MICROPY_VFS_LFS2 = 1 | ||
| MICROPY_VFS_FAT = 1 | ||
| MICROPY_HW_ENABLE_ISR_UART_FLASH_FUNCS_IN_RAM = 1 | ||
|
|
||
| FROZEN_MANIFEST ?= $(BOARD_DIR)/manifest.py | ||
| FROZEN_MANIFEST += ${TOP_DIR}/user_modules/lv_binding_micropython/driver/stm32/st_ltdc/manifest.py | ||
|
|
||
| HAL_SRC_C += $(addprefix $(STM32LIB_HAL_BASE)/Src/stm32$(MCU_SERIES)xx_,\ | ||
| hal_ltdc.c \ | ||
| hal_ltdc_ex.c \ | ||
| hal_dma2d.c \ | ||
| ) | ||
Oops, something went wrong.
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.