update h5 build make/cmake
This commit is contained in:
1
.github/workflows/cmake_arm.yml
vendored
1
.github/workflows/cmake_arm.yml
vendored
@@ -49,6 +49,7 @@ jobs:
|
|||||||
- 'stm32f7'
|
- 'stm32f7'
|
||||||
- 'stm32g0'
|
- 'stm32g0'
|
||||||
- 'stm32g4'
|
- 'stm32g4'
|
||||||
|
- 'stm32h5'
|
||||||
- 'stm32h7'
|
- 'stm32h7'
|
||||||
- 'stm32l4'
|
- 'stm32l4'
|
||||||
- 'stm32u5'
|
- 'stm32u5'
|
||||||
|
@@ -1,7 +1,5 @@
|
|||||||
UF2_FAMILY_ID = 0x4c71240a
|
UF2_FAMILY_ID = 0x4c71240a
|
||||||
ST_FAMILY = g4
|
ST_FAMILY = g4
|
||||||
DEPS_SUBMODULES += lib/CMSIS_5 hw/mcu/st/cmsis_device_$(ST_FAMILY) hw/mcu/st/stm32$(ST_FAMILY)xx_hal_driver
|
|
||||||
|
|
||||||
ST_CMSIS = hw/mcu/st/cmsis_device_$(ST_FAMILY)
|
ST_CMSIS = hw/mcu/st/cmsis_device_$(ST_FAMILY)
|
||||||
ST_HAL_DRIVER = hw/mcu/st/stm32$(ST_FAMILY)xx_hal_driver
|
ST_HAL_DRIVER = hw/mcu/st/stm32$(ST_FAMILY)xx_hal_driver
|
||||||
|
|
||||||
|
8
hw/bsp/stm32h5/boards/stm32h563nucleo/board.cmake
Normal file
8
hw/bsp/stm32h5/boards/stm32h563nucleo/board.cmake
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
set(MCU_VARIANT stm32h563xx)
|
||||||
|
set(JLINK_DEVICE stm32h563zi)
|
||||||
|
|
||||||
|
function(update_board TARGET)
|
||||||
|
target_compile_definitions(${TARGET} PUBLIC
|
||||||
|
STM32H563xx
|
||||||
|
)
|
||||||
|
endfunction()
|
7
hw/bsp/stm32h5/boards/stm32h563nucleo/board.mk
Normal file
7
hw/bsp/stm32h5/boards/stm32h563nucleo/board.mk
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
MCU_VARIANT = stm32h563xx
|
||||||
|
|
||||||
|
CFLAGS += \
|
||||||
|
-DSTM32H563xx
|
||||||
|
|
||||||
|
# For flash-jlink target
|
||||||
|
JLINK_DEVICE = stm32h563zi
|
@@ -1,187 +0,0 @@
|
|||||||
/*
|
|
||||||
******************************************************************************
|
|
||||||
**
|
|
||||||
|
|
||||||
** File : LinkerScript.ld
|
|
||||||
**
|
|
||||||
** Author : STM32CubeMX
|
|
||||||
**
|
|
||||||
** Abstract : Linker script for stm32h573i-dk series
|
|
||||||
** 640Kbytes FLASH and 2048Kbytes RAM
|
|
||||||
**
|
|
||||||
** Set heap size, stack size and stack location according
|
|
||||||
** to application requirements.
|
|
||||||
**
|
|
||||||
** Set memory bank area and size if external memory is used.
|
|
||||||
**
|
|
||||||
** Target : STMicroelectronics STM32
|
|
||||||
**
|
|
||||||
** Distribution: The file is distributed “as is,” without any warranty
|
|
||||||
** of any kind.
|
|
||||||
**
|
|
||||||
*****************************************************************************
|
|
||||||
** @attention
|
|
||||||
**
|
|
||||||
** <h2><center>© COPYRIGHT(c) 2019 STMicroelectronics</center></h2>
|
|
||||||
**
|
|
||||||
** Redistribution and use in source and binary forms, with or without modification,
|
|
||||||
** are permitted provided that the following conditions are met:
|
|
||||||
** 1. Redistributions of source code must retain the above copyright notice,
|
|
||||||
** this list of conditions and the following disclaimer.
|
|
||||||
** 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
** this list of conditions and the following disclaimer in the documentation
|
|
||||||
** and/or other materials provided with the distribution.
|
|
||||||
** 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
||||||
** may be used to endorse or promote products derived from this software
|
|
||||||
** without specific prior written permission.
|
|
||||||
**
|
|
||||||
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
||||||
** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
** SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
||||||
** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
**
|
|
||||||
*****************************************************************************
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Entry Point */
|
|
||||||
ENTRY(Reset_Handler)
|
|
||||||
|
|
||||||
/* Highest address of the user mode stack */
|
|
||||||
_estack = ORIGIN(RAM) + LENGTH(RAM); /* end of RAM */
|
|
||||||
/* Generate a link error if heap and stack don't fit into RAM */
|
|
||||||
_Min_Heap_Size = 0x200; /* required amount of heap */
|
|
||||||
_Min_Stack_Size = 0x400; /* required amount of stack */
|
|
||||||
|
|
||||||
/* Specify the memory areas */
|
|
||||||
MEMORY
|
|
||||||
{
|
|
||||||
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 640K
|
|
||||||
FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 2048K
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Define output sections */
|
|
||||||
SECTIONS
|
|
||||||
{
|
|
||||||
/* The startup code goes first into FLASH */
|
|
||||||
.isr_vector :
|
|
||||||
{
|
|
||||||
. = ALIGN(4);
|
|
||||||
KEEP(*(.isr_vector)) /* Startup code */
|
|
||||||
. = ALIGN(4);
|
|
||||||
} >FLASH
|
|
||||||
|
|
||||||
/* The program code and other data goes into FLASH */
|
|
||||||
.text :
|
|
||||||
{
|
|
||||||
. = ALIGN(4);
|
|
||||||
*(.text) /* .text sections (code) */
|
|
||||||
*(.text*) /* .text* sections (code) */
|
|
||||||
*(.glue_7) /* glue arm to thumb code */
|
|
||||||
*(.glue_7t) /* glue thumb to arm code */
|
|
||||||
*(.eh_frame)
|
|
||||||
|
|
||||||
KEEP (*(.init))
|
|
||||||
KEEP (*(.fini))
|
|
||||||
|
|
||||||
. = ALIGN(4);
|
|
||||||
_etext = .; /* define a global symbols at end of code */
|
|
||||||
} >FLASH
|
|
||||||
|
|
||||||
/* Constant data goes into FLASH */
|
|
||||||
.rodata :
|
|
||||||
{
|
|
||||||
. = ALIGN(4);
|
|
||||||
*(.rodata) /* .rodata sections (constants, strings, etc.) */
|
|
||||||
*(.rodata*) /* .rodata* sections (constants, strings, etc.) */
|
|
||||||
. = ALIGN(4);
|
|
||||||
} >FLASH
|
|
||||||
|
|
||||||
.ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
|
|
||||||
.ARM : {
|
|
||||||
__exidx_start = .;
|
|
||||||
*(.ARM.exidx*)
|
|
||||||
__exidx_end = .;
|
|
||||||
} >FLASH
|
|
||||||
|
|
||||||
.preinit_array :
|
|
||||||
{
|
|
||||||
PROVIDE_HIDDEN (__preinit_array_start = .);
|
|
||||||
KEEP (*(.preinit_array*))
|
|
||||||
PROVIDE_HIDDEN (__preinit_array_end = .);
|
|
||||||
} >FLASH
|
|
||||||
.init_array :
|
|
||||||
{
|
|
||||||
PROVIDE_HIDDEN (__init_array_start = .);
|
|
||||||
KEEP (*(SORT(.init_array.*)))
|
|
||||||
KEEP (*(.init_array*))
|
|
||||||
PROVIDE_HIDDEN (__init_array_end = .);
|
|
||||||
} >FLASH
|
|
||||||
.fini_array :
|
|
||||||
{
|
|
||||||
PROVIDE_HIDDEN (__fini_array_start = .);
|
|
||||||
KEEP (*(SORT(.fini_array.*)))
|
|
||||||
KEEP (*(.fini_array*))
|
|
||||||
PROVIDE_HIDDEN (__fini_array_end = .);
|
|
||||||
} >FLASH
|
|
||||||
|
|
||||||
/* used by the startup to initialize data */
|
|
||||||
_sidata = LOADADDR(.data);
|
|
||||||
|
|
||||||
/* Initialized data sections goes into RAM, load LMA copy after code */
|
|
||||||
.data :
|
|
||||||
{
|
|
||||||
. = ALIGN(4);
|
|
||||||
_sdata = .; /* create a global symbol at data start */
|
|
||||||
*(.data) /* .data sections */
|
|
||||||
*(.data*) /* .data* sections */
|
|
||||||
|
|
||||||
. = ALIGN(4);
|
|
||||||
_edata = .; /* define a global symbol at data end */
|
|
||||||
} >RAM AT> FLASH
|
|
||||||
|
|
||||||
|
|
||||||
/* Uninitialized data section */
|
|
||||||
. = ALIGN(4);
|
|
||||||
.bss :
|
|
||||||
{
|
|
||||||
/* This is used by the startup in order to initialize the .bss section */
|
|
||||||
_sbss = .; /* define a global symbol at bss start */
|
|
||||||
__bss_start__ = _sbss;
|
|
||||||
*(.bss)
|
|
||||||
*(.bss*)
|
|
||||||
*(COMMON)
|
|
||||||
|
|
||||||
. = ALIGN(4);
|
|
||||||
_ebss = .; /* define a global symbol at bss end */
|
|
||||||
__bss_end__ = _ebss;
|
|
||||||
} >RAM
|
|
||||||
|
|
||||||
/* User_heap_stack section, used to check that there is enough RAM left */
|
|
||||||
._user_heap_stack :
|
|
||||||
{
|
|
||||||
. = ALIGN(8);
|
|
||||||
PROVIDE ( end = . );
|
|
||||||
PROVIDE ( _end = . );
|
|
||||||
. = . + _Min_Heap_Size;
|
|
||||||
. = . + _Min_Stack_Size;
|
|
||||||
. = ALIGN(8);
|
|
||||||
} >RAM
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Remove information from the standard libraries */
|
|
||||||
/DISCARD/ :
|
|
||||||
{
|
|
||||||
libc.a ( * )
|
|
||||||
libm.a ( * )
|
|
||||||
libgcc.a ( * )
|
|
||||||
}
|
|
||||||
|
|
||||||
.ARM.attributes 0 : { *(.ARM.attributes) }
|
|
||||||
}
|
|
@@ -1,7 +1,5 @@
|
|||||||
set(MCU_VARIANT stm32h573i-dk)
|
set(MCU_VARIANT stm32h573xx)
|
||||||
set(JLINK_DEVICE stm32h573i-dk)
|
set(JLINK_DEVICE stm32h573ii)
|
||||||
|
|
||||||
set(LD_FILE_GNU ${CMAKE_CURRENT_LIST_DIR}/STM32H573I-DK_FLASH.ld)
|
|
||||||
|
|
||||||
function(update_board TARGET)
|
function(update_board TARGET)
|
||||||
target_compile_definitions(${TARGET} PUBLIC
|
target_compile_definitions(${TARGET} PUBLIC
|
||||||
|
@@ -1,13 +1,7 @@
|
|||||||
|
MCU_VARIANT = stm32h573xx
|
||||||
|
|
||||||
CFLAGS += \
|
CFLAGS += \
|
||||||
-DSTM32H573xx
|
-DSTM32H573xx
|
||||||
|
|
||||||
# GCC
|
|
||||||
SRC_S_GCC += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32h573xx.s
|
|
||||||
LD_FILE_GCC = $(BOARD_PATH)/STM32H573I-DK_FLASH.ld
|
|
||||||
|
|
||||||
# IAR
|
|
||||||
SRC_S_IAR += $(ST_CMSIS)/Source/Templates/iar/startup_stm32h573xx.s
|
|
||||||
LD_FILE_IAR = $(ST_CMSIS)/Source/Templates/iar/linker/stm32h573xx_flash.icf
|
|
||||||
|
|
||||||
# For flash-jlink target
|
# For flash-jlink target
|
||||||
JLINK_DEVICE = stm32h573i-dk
|
JLINK_DEVICE = stm32h573ii
|
||||||
|
@@ -25,7 +25,19 @@
|
|||||||
* This file is part of the TinyUSB stack.
|
* This file is part of the TinyUSB stack.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
// Suppress warning caused by mcu driver
|
||||||
|
#ifdef __GNUC__
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wundef"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "stm32h5xx_hal.h"
|
#include "stm32h5xx_hal.h"
|
||||||
|
|
||||||
|
#ifdef __GNUC__
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "bsp/board_api.h"
|
#include "bsp/board_api.h"
|
||||||
#include "board.h"
|
#include "board.h"
|
||||||
|
|
||||||
|
@@ -15,7 +15,7 @@ set(CMSIS_5 ${TOP}/lib/CMSIS_5)
|
|||||||
include(${CMAKE_CURRENT_LIST_DIR}/boards/${BOARD}/board.cmake)
|
include(${CMAKE_CURRENT_LIST_DIR}/boards/${BOARD}/board.cmake)
|
||||||
|
|
||||||
# toolchain set up
|
# toolchain set up
|
||||||
set(CMAKE_SYSTEM_PROCESSOR cortex-m0plus CACHE INTERNAL "System Processor")
|
set(CMAKE_SYSTEM_PROCESSOR cortex-m33 CACHE INTERNAL "System Processor")
|
||||||
set(CMAKE_TOOLCHAIN_FILE ${TOP}/examples/build_system/cmake/toolchain/arm_${TOOLCHAIN}.cmake)
|
set(CMAKE_TOOLCHAIN_FILE ${TOP}/examples/build_system/cmake/toolchain/arm_${TOOLCHAIN}.cmake)
|
||||||
|
|
||||||
set(FAMILY_MCUS STM32H5 CACHE INTERNAL "")
|
set(FAMILY_MCUS STM32H5 CACHE INTERNAL "")
|
||||||
@@ -26,52 +26,52 @@ set(FAMILY_MCUS STM32H5 CACHE INTERNAL "")
|
|||||||
#------------------------------------
|
#------------------------------------
|
||||||
# only need to be built ONCE for all examples
|
# only need to be built ONCE for all examples
|
||||||
function(add_board_target BOARD_TARGET)
|
function(add_board_target BOARD_TARGET)
|
||||||
if (NOT TARGET ${BOARD_TARGET})
|
if (TARGET ${BOARD_TARGET})
|
||||||
# Startup & Linker script
|
return()
|
||||||
set(STARTUP_FILE_GNU ${ST_CMSIS}/Source/Templates/gcc/startup_${MCU_VARIANT}.s)
|
endif ()
|
||||||
set(STARTUP_FILE_IAR ${ST_CMSIS}/Source/Templates/iar/startup_${MCU_VARIANT}.s)
|
|
||||||
set(LD_FILE_IAR ${ST_CMSIS}/Source/Templates/iar/linker/${MCU_VARIANT}_flash.icf)
|
|
||||||
|
|
||||||
add_library(${BOARD_TARGET} STATIC
|
# Startup & Linker script
|
||||||
${ST_CMSIS}/Source/Templates/system_${ST_PREFIX}.c
|
set(STARTUP_FILE_GNU ${ST_CMSIS}/Source/Templates/gcc/startup_${MCU_VARIANT}.s)
|
||||||
${ST_HAL_DRIVER}/Src/${ST_PREFIX}_hal.c
|
set(STARTUP_FILE_IAR ${ST_CMSIS}/Source/Templates/iar/startup_${MCU_VARIANT}.s)
|
||||||
${ST_HAL_DRIVER}/Src/${ST_PREFIX}_hal_cortex.c
|
set(LD_FILE_IAR ${ST_CMSIS}/Source/Templates/iar/linker/${MCU_VARIANT}_flash.icf)
|
||||||
${ST_HAL_DRIVER}/Src/${ST_PREFIX}_hal_pwr.c
|
|
||||||
${ST_HAL_DRIVER}/Src/${ST_PREFIX}_hal_pwr_ex.c
|
|
||||||
${ST_HAL_DRIVER}/Src/${ST_PREFIX}_hal_rcc.c
|
|
||||||
${ST_HAL_DRIVER}/Src/${ST_PREFIX}_hal_rcc_ex.c
|
|
||||||
${ST_HAL_DRIVER}/Src/${ST_PREFIX}_hal_gpio.c
|
|
||||||
${ST_HAL_DRIVER}/Src/${ST_PREFIX}_hal_uart.c
|
|
||||||
${ST_HAL_DRIVER}/Src/${ST_PREFIX}_hal_uart_ex.c
|
|
||||||
${ST_HAL_DRIVER}/Src/${ST_PREFIX}_hal_dma.c
|
|
||||||
${STARTUP_FILE_${CMAKE_C_COMPILER_ID}}
|
|
||||||
)
|
|
||||||
target_include_directories(${BOARD_TARGET} PUBLIC
|
|
||||||
${CMAKE_CURRENT_FUNCTION_LIST_DIR}
|
|
||||||
${CMSIS_5}/CMSIS/Core/Include
|
|
||||||
${ST_CMSIS}/Include
|
|
||||||
${ST_HAL_DRIVER}/Inc
|
|
||||||
)
|
|
||||||
target_compile_options(${BOARD_TARGET} PUBLIC
|
|
||||||
)
|
|
||||||
target_compile_definitions(${BOARD_TARGET} PUBLIC
|
|
||||||
)
|
|
||||||
|
|
||||||
update_board(${BOARD_TARGET})
|
string(REPLACE "stm32h" "STM32H" MCU_VARIANT_UPPER ${MCU_VARIANT})
|
||||||
|
set(LD_FILE_GNU ${ST_CMSIS}/Source/Templates/gcc/linker/${MCU_VARIANT_UPPER}_FLASH.ld)
|
||||||
|
|
||||||
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
|
add_library(${BOARD_TARGET} STATIC
|
||||||
target_link_options(${BOARD_TARGET} PUBLIC
|
${ST_CMSIS}/Source/Templates/system_${ST_PREFIX}.c
|
||||||
"LINKER:--script=${LD_FILE_GNU}"
|
${ST_HAL_DRIVER}/Src/${ST_PREFIX}_hal.c
|
||||||
-nostartfiles
|
${ST_HAL_DRIVER}/Src/${ST_PREFIX}_hal_cortex.c
|
||||||
# nanolib
|
${ST_HAL_DRIVER}/Src/${ST_PREFIX}_hal_gpio.c
|
||||||
--specs=nosys.specs
|
${ST_HAL_DRIVER}/Src/${ST_PREFIX}_hal_pwr.c
|
||||||
--specs=nano.specs
|
${ST_HAL_DRIVER}/Src/${ST_PREFIX}_hal_pwr_ex.c
|
||||||
)
|
${ST_HAL_DRIVER}/Src/${ST_PREFIX}_hal_rcc.c
|
||||||
elseif (CMAKE_C_COMPILER_ID STREQUAL "IAR")
|
${ST_HAL_DRIVER}/Src/${ST_PREFIX}_hal_rcc_ex.c
|
||||||
target_link_options(${BOARD_TARGET} PUBLIC
|
${ST_HAL_DRIVER}/Src/${ST_PREFIX}_hal_uart.c
|
||||||
"LINKER:--config=${LD_FILE_IAR}"
|
${ST_HAL_DRIVER}/Src/${ST_PREFIX}_hal_uart_ex.c
|
||||||
)
|
${ST_HAL_DRIVER}/Src/${ST_PREFIX}_hal_dma.c
|
||||||
endif ()
|
${STARTUP_FILE_${CMAKE_C_COMPILER_ID}}
|
||||||
|
)
|
||||||
|
target_include_directories(${BOARD_TARGET} PUBLIC
|
||||||
|
${CMAKE_CURRENT_FUNCTION_LIST_DIR}
|
||||||
|
${CMSIS_5}/CMSIS/Core/Include
|
||||||
|
${ST_CMSIS}/Include
|
||||||
|
${ST_HAL_DRIVER}/Inc
|
||||||
|
)
|
||||||
|
|
||||||
|
update_board(${BOARD_TARGET})
|
||||||
|
|
||||||
|
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
|
||||||
|
target_link_options(${BOARD_TARGET} PUBLIC
|
||||||
|
"LINKER:--script=${LD_FILE_GNU}"
|
||||||
|
-nostartfiles
|
||||||
|
# nanolib
|
||||||
|
--specs=nosys.specs --specs=nano.specs
|
||||||
|
)
|
||||||
|
elseif (CMAKE_C_COMPILER_ID STREQUAL "IAR")
|
||||||
|
target_link_options(${BOARD_TARGET} PUBLIC
|
||||||
|
"LINKER:--config=${LD_FILE_IAR}"
|
||||||
|
)
|
||||||
endif ()
|
endif ()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
@@ -112,5 +112,5 @@ function(family_configure_example TARGET RTOS)
|
|||||||
|
|
||||||
# Flashing
|
# Flashing
|
||||||
family_flash_stlink(${TARGET})
|
family_flash_stlink(${TARGET})
|
||||||
#family_flash_jlink(${TARGET})
|
family_flash_jlink(${TARGET})
|
||||||
endfunction()
|
endfunction()
|
||||||
|
@@ -1,33 +1,30 @@
|
|||||||
ST_FAMILY = h5
|
ST_FAMILY = h5
|
||||||
DEPS_SUBMODULES += lib/CMSIS_5 hw/mcu/st/cmsis_device_$(ST_FAMILY) hw/mcu/st/stm32$(ST_FAMILY)xx_hal_driver
|
|
||||||
|
|
||||||
ST_CMSIS = hw/mcu/st/cmsis_device_$(ST_FAMILY)
|
ST_CMSIS = hw/mcu/st/cmsis_device_$(ST_FAMILY)
|
||||||
ST_HAL_DRIVER = hw/mcu/st/stm32$(ST_FAMILY)xx_hal_driver
|
ST_HAL_DRIVER = hw/mcu/st/stm32$(ST_FAMILY)xx_hal_driver
|
||||||
|
|
||||||
include $(TOP)/$(BOARD_PATH)/board.mk
|
include $(TOP)/$(BOARD_PATH)/board.mk
|
||||||
CPU_CORE ?= cortex-m33
|
CPU_CORE ?= cortex-m33
|
||||||
|
|
||||||
|
MCU_VARIANT_UPPER = $(subst stm32h,STM32H,$(MCU_VARIANT))
|
||||||
|
|
||||||
# --------------
|
# --------------
|
||||||
# Compiler Flags
|
# Compiler Flags
|
||||||
# --------------
|
# --------------
|
||||||
CFLAGS += \
|
CFLAGS += \
|
||||||
-DCFG_TUSB_MCU=OPT_MCU_STM32H5
|
-DCFG_TUSB_MCU=OPT_MCU_STM32H5
|
||||||
|
|
||||||
# workaround to fix a build issue due to a wrong define check in hal, this define must be removed as soon as the repo is fixed
|
|
||||||
CFLAGS += \
|
|
||||||
-D__ARMCC_VERSION=0
|
|
||||||
|
|
||||||
# GCC Flags
|
# GCC Flags
|
||||||
CFLAGS_GCC += \
|
CFLAGS_GCC += \
|
||||||
-flto \
|
-flto \
|
||||||
-nostdlib -nostartfiles \
|
-nostdlib -nostartfiles \
|
||||||
-Wno-unused-parameter \
|
|
||||||
-Wno-cast-align
|
|
||||||
|
|
||||||
# suppress warning caused by vendor mcu driver
|
# suppress warning caused by vendor mcu driver
|
||||||
CFLAGS_GCC += -Wno-error=cast-align
|
CFLAGS_GCC += \
|
||||||
|
-Wno-error=cast-align \
|
||||||
|
-Wno-error=undef \
|
||||||
|
-Wno-error=unused-parameter \
|
||||||
|
|
||||||
#LDFLAGS_GCC += -specs=nosys.specs -specs=nano.specs
|
LDFLAGS_GCC += -specs=nosys.specs -specs=nano.specs
|
||||||
|
|
||||||
# -----------------
|
# -----------------
|
||||||
# Sources & Include
|
# Sources & Include
|
||||||
@@ -53,5 +50,13 @@ INC += \
|
|||||||
$(TOP)/$(ST_CMSIS)/Include \
|
$(TOP)/$(ST_CMSIS)/Include \
|
||||||
$(TOP)/$(ST_HAL_DRIVER)/Inc
|
$(TOP)/$(ST_HAL_DRIVER)/Inc
|
||||||
|
|
||||||
|
# Startup
|
||||||
|
SRC_S_GCC += $(ST_CMSIS)/Source/Templates/gcc/startup_$(MCU_VARIANT).s
|
||||||
|
SRC_S_IAR += $(ST_CMSIS)/Source/Templates/iar/startup_$(MCU_VARIANT).s
|
||||||
|
|
||||||
|
# Linker
|
||||||
|
LD_FILE_IAR = $(ST_CMSIS)/Source/Templates/iar/linker/$(MCU_VARIANT)_flash.icf
|
||||||
|
LD_FILE_GCC = $(ST_CMSIS)/Source/Templates/gcc/linker/$(MCU_VARIANT_UPPER)_FLASH.ld
|
||||||
|
|
||||||
# flash target using on-board stlink
|
# flash target using on-board stlink
|
||||||
flash: flash-stlink
|
flash: flash-stlink
|
||||||
|
@@ -210,16 +210,16 @@ def get_a_dep(d):
|
|||||||
# Init git deps if not existed
|
# Init git deps if not existed
|
||||||
if not p.exists():
|
if not p.exists():
|
||||||
p.mkdir(parents=True)
|
p.mkdir(parents=True)
|
||||||
run_cmd(f"git -C {p} init")
|
run_cmd(f"{git_cmd} init")
|
||||||
run_cmd(f"git -C {p} remote add origin {url}")
|
run_cmd(f"{git_cmd} remote add origin {url}")
|
||||||
|
|
||||||
# Check if commit is already fetched
|
# Check if commit is already fetched
|
||||||
result = run_cmd(f"git -C {p} rev-parse HEAD")
|
result = run_cmd(f"{git_cmd} rev-parse HEAD")
|
||||||
head = result.stdout.decode("utf-8").splitlines()[0]
|
head = result.stdout.decode("utf-8").splitlines()[0]
|
||||||
run_cmd(f"git -C {p} reset --hard")
|
run_cmd(f"{git_cmd} reset --hard")
|
||||||
if commit != head:
|
if commit != head:
|
||||||
run_cmd(f"git -C {p} fetch --depth 1 origin {commit}")
|
run_cmd(f"{git_cmd} fetch --depth 1 origin {commit}")
|
||||||
run_cmd(f"git -C {p} checkout FETCH_HEAD")
|
run_cmd(f"{git_cmd} checkout FETCH_HEAD")
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user