Skip to content

Commit

Permalink
Add initial STM32H723ZG MCU support with external repos downloading
Browse files Browse the repository at this point in the history
This adds initial Nucleo-H723ZG BSP and STM32H723ZG MCU support, but
it uses new feature implemented to Newt, which is ability
to download external repositories that do not contain project.yml
file. This way we do not have to add hundreds of files from
ST's repository to the core. In order for this to work you
have to build newt from this commit:
<m-gorecki/mynewt-newt@4a9b494>
and later add this to your project.yml file:

repository.cmsis_device_h7:
    type: github
    vers: 6dac8c24d7b38ab20806d27dd7d8285a6433b8f7-commit
    user: STMicroelectronics
    repo: cmsis_device_h7

repository.stm32h7xx_hal_driver:
    type: github
    vers: b716379524ba3549e4db11804889776ffeb239d1-commit
    user: STMicroelectronics
    repo: stm32h7xx_hal_driver

After doing so you can run "newt upgrade" and try it out.
  • Loading branch information
m-gorecki authored and kasjer committed Jan 31, 2023
1 parent 9234daa commit d6de7df
Show file tree
Hide file tree
Showing 40 changed files with 3,945 additions and 21 deletions.
8 changes: 8 additions & 0 deletions .rat-excludes
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,9 @@ STM32F7xx
STM32F7xx_HAL_Driver
stm32f7xx

# CMSIS Cortex-H7, STM32h7 - BSD License.
stm32h7xx

# LORA - BSD License
lora

Expand Down Expand Up @@ -397,6 +400,11 @@ stm32l1xx_hal_conf.h
system_stm32l1xx.c
startup_stm32l152xc.s

# NUCLEO-H723ZG BSP - BSD License
stm32h7xx_hal_conf.h
system_stm32h7xx.c
startup_stm32h723xx.s

# NUCLEO-F767 BSP - BSD License
startup_stm32f767xx.s

Expand Down
8 changes: 8 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ these files in later releases. These files are:
* hw/mcu/stm/stm32wbxx/include/mcu/cmsis_nvic.h
* hw/mcu/stm/stm32f1xx/include/mcu/cmsis_nvic.h
* hw/mcu/stm/stm32f7xx/include/mcu/cmsis_nvic.h
* hw/mcu/stm/stm32h7xx/include/mcu/cmsis_nvic.h

This product bundles parts of STM32 SDK by STMicroelectronics, which is
available under the "3-clause BSD" license. Bundled files are:
Expand Down Expand Up @@ -386,6 +387,13 @@ This product bundles parts of STM32CubeF3, which is available under the
* hw/bsp/nucleo-f303re/include/bsp/stm32f3xx_hal_conf.h
* hw/bsp/nucleo-f303re/src/arch/cortex_m4/startup_stm32f303xe.s

This product bundles parts of STM32CubeH7, which is available under the
"3-clause BSD" license. Bundled files are:
* hw/mcu/stm/stm32h7xx/src/clock_stm32h7xx.c
* hw/mcu/stm/stm32h7xx/src/system_stm32h7xx.c
* hw/bsp/nucleo-h723zg/include/bsp/stm32h7xx_hal_conf.h
* hw/bsp/nucleo-h723zg/src/arch/cortex_m7/startup_stm32h723xx.s

This product bundles parts of stm32l1xx, which is available under the
"3-clause BSD" license. Bundled files are:
* hw/mcu/stm/stm32l1xx/src/ext/
Expand Down
32 changes: 32 additions & 0 deletions hw/bsp/nucleo-h723zg/boot-nucleo-h723zg.ld
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

/* Linker script to configure memory regions. */
MEMORY
{
ITCM (xrw) : ORIGIN = 0x00000000, LENGTH = 64K
DTCM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 128K /* Bootloader area */
RAM (xrw) : ORIGIN = 0x24000000, LENGTH = 320K /* AXI (128) + AXI/ITCM (192) */
RAM_D2 (xrw) : ORIGIN = 0x30000000, LENGTH = 32K /* SRAM1 + SRMA2 */
RAM_D3 (xrw) : ORIGIN = 0x38000000, LENGTH = 16K /* SRAM4 */
}

/* The bootloader does not contain an image header */
_imghdr_size = 0x0;
70 changes: 70 additions & 0 deletions hw/bsp/nucleo-h723zg/bsp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#

bsp.name: "NUCLEO-H723ZG"
bsp.url: https://www.st.com/en/evaluation-tools/nucleo-h723zg.html
bsp.maker: "STMicroelectronics"
bsp.arch: cortex_m7
bsp.compiler: compiler/arm-none-eabi-m7
bsp.linkerscript:
- "hw/bsp/nucleo-h723zg/nucleo-h723zg.ld"
- "@apache-mynewt-core/hw/mcu/stm/stm32h7xx/stm32h723.ld"
bsp.linkerscript.BOOT_LOADER.OVERWRITE:
- "hw/bsp/nucleo-h723zg/boot-nucleo-h723zg.ld"
- "@apache-mynewt-core/hw/mcu/stm/stm32h7xx/stm32h723.ld"
bsp.downloadscript: "hw/bsp/nucleo-h723zg/nucleo-h723zg_download.sh"
bsp.debugscript: "hw/bsp/nucleo-h723zg/nucleo-h723zg_debug.sh"

bsp.flash_map:
areas:
# System areas.
FLASH_AREA_BOOTLOADER:
device: 0
offset: 0x08000000
size: 128kB
FLASH_AREA_IMAGE_0:
device: 0
offset: 0x08020000
size: 256kB
FLASH_AREA_IMAGE_1:
device: 0
offset: 0x08060000
size: 256kB
FLASH_AREA_IMAGE_SCRATCH:
device: 0
offset: 0x080A0000
size: 128kB

# User areas.
FLASH_AREA_REBOOT_LOG:
user_id: 0
device: 0
offset: 0x080C0000
size: 128kB
FLASH_AREA_NFFS:
user_id: 1
device: 0
offset: 0x080E0000
size: 128kB

FLASH_AREA_SPI:
user_id: 2
device: 1
offset: 0x0
size: 128kB
101 changes: 101 additions & 0 deletions hw/bsp/nucleo-h723zg/include/bsp/bsp.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
#ifndef H_BSP_H
#define H_BSP_H

#include <inttypes.h>
#include <mcu/mcu.h>

#ifdef __cplusplus
extern "C" {
#endif

/* Define special stackos sections */
#define sec_data_core __attribute__((section(".data.core")))
#define sec_bss_core __attribute__((section(".bss.core")))
#define sec_bss_nz_core __attribute__((section(".bss.core.nz")))

/* More convenient section placement macros. */
#define bssnz_t sec_bss_nz_core

extern uint8_t _ram_start;
extern uint8_t _dtcmram_start;
extern uint8_t _itcmram_start;
extern uint8_t _ram2_start;

#define RAM_SIZE (320 * 1024)
#define RAM2_SIZE (32 * 1024)
#define RAM3_SIZE (16 * 1024)
#define DTCMRAM_SIZE (128 * 1024)
#define ITCMRAM_SIZE (64 * 1024)

/* LED pins */
#define LED_1 MCU_GPIO_PORTB(0)
#define LED_2 MCU_GPIO_PORTE(1)
#define LED_3 MCU_GPIO_PORTB(14)

#define LED_green LED_1
#define LED_blue LED_2
#define LED_red LED_3

#define LED_BLINK_PIN LED_1

/* BUTTON pins */
#define BTN_USER_1 MCU_GPIO_PORTC(13)

/* Button pin */
#define BUTTON_1 BTN_USER_1

/* Arduino pins */
#define ARDUINO_PIN_D0 MCU_GPIO_PORTB(7)
#define ARDUINO_PIN_D1 MCU_GPIO_PORTB(6)
#define ARDUINO_PIN_D2 MCU_GPIO_PORTG(14)
#define ARDUINO_PIN_D3 MCU_GPIO_PORTE(13)
#define ARDUINO_PIN_D4 MCU_GPIO_PORTE(14)
#define ARDUINO_PIN_D5 MCU_GPIO_PORTE(11)
#define ARDUINO_PIN_D6 MCU_GPIO_PORTE(9)
#define ARDUINO_PIN_D7 MCU_GPIO_PORTG(12)
#define ARDUINO_PIN_D8 MCU_GPIO_PORTF(3)
#define ARDUINO_PIN_D9 MCU_GPIO_PORTD(15)
#define ARDUINO_PIN_D10 MCU_GPIO_PORTD(14)
#define ARDUINO_PIN_D11 MCU_GPIO_PORTB(5)
#define ARDUINO_PIN_D12 MCU_GPIO_PORTA(6)
#define ARDUINO_PIN_D13 MCU_GPIO_PORTA(5)
#define ARDUINO_PIN_A0 MCU_GPIO_PORTA(3)
#define ARDUINO_PIN_A1 MCU_GPIO_PORTC(0)
#define ARDUINO_PIN_A2 MCU_GPIO_PORTC(3)
#define ARDUINO_PIN_A3 MCU_GPIO_PORTB(1)
#define ARDUINO_PIN_A4 MCU_GPIO_PORTC(2)
#define ARDUINO_PIN_A5 MCU_GPIO_PORTF(10)

#define ARDUINO_PIN_RX ARDUINO_PIN_D0
#define ARDUINO_PIN_TX ARDUINO_PIN_D1

#define ARDUINO_PIN_SCL MCU_GPIO_PORTB(8)
#define ARDUINO_PIN_SDA MCU_GPIO_PORTB(9)

#define ARDUINO_PIN_SCK ARDUINO_PIN_D13
#define ARDUINO_PIN_MOSI ARDUINO_PIN_D11
#define ARDUINO_PIN_MISO ARDUINO_PIN_D12

#ifdef __cplusplus
}
#endif

#endif /* H_BSP_H */
Loading

0 comments on commit d6de7df

Please sign in to comment.