mirror of
https://github.com/hathach/tinyusb.git
synced 2025-01-31 05:52:55 +08:00
commit
7166bb3643
59
.github/workflows/build_iar.yml
vendored
Normal file
59
.github/workflows/build_iar.yml
vendored
Normal file
@ -0,0 +1,59 @@
|
||||
name: Build IAR
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- 'src/**'
|
||||
- 'examples/**'
|
||||
- 'lib/**'
|
||||
- 'hw/**'
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
paths:
|
||||
- 'src/**'
|
||||
- 'examples/**'
|
||||
- 'lib/**'
|
||||
- 'hw/**'
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
build-arm:
|
||||
runs-on: [self-hosted, Linux, X64, hifiphile]
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
family:
|
||||
# Alphabetical order
|
||||
- 'stm32f0'
|
||||
- 'stm32f1'
|
||||
- 'stm32f4'
|
||||
- 'stm32f7'
|
||||
- 'stm32g4'
|
||||
- 'stm32h7'
|
||||
- 'stm32l4'
|
||||
steps:
|
||||
- name: Clean workspace
|
||||
run: |
|
||||
echo "Cleaning up previous run"
|
||||
rm -rf "${{ github.workspace }}"
|
||||
mkdir -p "${{ github.workspace }}"
|
||||
|
||||
- name: Checkout TinyUSB
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Checkout submodules and dependencies
|
||||
run: |
|
||||
git submodule update --init lib/FreeRTOS-Kernel lib/lwip lib/sct_neopixel
|
||||
python3 tools/get_dependencies.py ${{ matrix.family }}
|
||||
|
||||
- name: Checkout pico-sdk for rp2040
|
||||
if: matrix.family == 'rp2040'
|
||||
run: |
|
||||
git clone --depth 1 -b develop https://github.com/raspberrypi/pico-sdk ~/pico-sdk
|
||||
echo >> $GITHUB_ENV PICO_SDK_PATH=~/pico-sdk
|
||||
|
||||
- name: Build
|
||||
run: python3 tools/build_family.py ${{ matrix.family }} CC=iccarm
|
@ -9,10 +9,4 @@ INC += \
|
||||
EXAMPLE_SOURCE += $(wildcard src/*.c)
|
||||
SRC_C += $(addprefix $(CURRENT_PATH)/, $(EXAMPLE_SOURCE))
|
||||
|
||||
# board_test example is special example that doesn't enable device or host stack
|
||||
# This can cause some TinyUSB API missing, this hack to allow us to fill those API
|
||||
# to pass the compilation process
|
||||
CFLAGS += \
|
||||
-D"tud_int_handler(x)= " \
|
||||
|
||||
include ../../rules.mk
|
||||
|
@ -30,6 +30,11 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// board_test example is special example that doesn't enable device or host stack
|
||||
// This can cause some TinyUSB API missing, this define hack to allow us to fill those API
|
||||
// to pass the compilation process
|
||||
#define tud_int_handler(x)
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// COMMON CONFIGURATION
|
||||
//--------------------------------------------------------------------
|
||||
|
@ -4,13 +4,14 @@ include ../../../tools/top.mk
|
||||
include ../../make.mk
|
||||
|
||||
FREERTOS_SRC = lib/FreeRTOS-Kernel
|
||||
FREERTOS_PORTABLE_SRC= $(FREERTOS_SRC)/portable/$(if $(USE_IAR),IAR,GCC)/$(FREERTOS_PORT)
|
||||
|
||||
INC += \
|
||||
src \
|
||||
src/FreeRTOSConfig \
|
||||
$(TOP)/hw \
|
||||
$(TOP)/$(FREERTOS_SRC)/include \
|
||||
$(TOP)/$(FREERTOS_SRC)/portable/GCC/$(FREERTOS_PORT)
|
||||
$(TOP)/$(FREERTOS_PORTABLE_SRC)
|
||||
|
||||
# Example source
|
||||
EXAMPLE_SOURCE = \
|
||||
@ -27,17 +28,20 @@ SRC_C += \
|
||||
$(FREERTOS_SRC)/queue.c \
|
||||
$(FREERTOS_SRC)/tasks.c \
|
||||
$(FREERTOS_SRC)/timers.c \
|
||||
$(subst ../../../,,$(wildcard ../../../$(FREERTOS_SRC)/portable/GCC/$(FREERTOS_PORT)/*.c))
|
||||
$(subst ../../../,,$(wildcard ../../../$(FREERTOS_PORTABLE_SRC)/*.c))
|
||||
|
||||
SRC_S += \
|
||||
$(subst ../../../,,$(wildcard ../../../$(FREERTOS_PORTABLE_SRC)/*.s))
|
||||
|
||||
# include heap manage if configSUPPORT_DYNAMIC_ALLOCATION = 1
|
||||
# SRC_C += $(FREERTOS_SRC)/portable/MemMang/heap_1.c
|
||||
# CFLAGS += -Wno-error=sign-compare
|
||||
|
||||
# Suppress FreeRTOSConfig.h warnings
|
||||
CFLAGS += -Wno-error=redundant-decls
|
||||
GCC_CFLAGS += -Wno-error=redundant-decls
|
||||
|
||||
# Suppress FreeRTOS source warnings
|
||||
CFLAGS += -Wno-error=cast-qual
|
||||
GCC_CFLAGS += -Wno-error=cast-qual
|
||||
|
||||
# FreeRTOS (lto + Os) linker issue
|
||||
LDFLAGS += -Wl,--undefined=vTaskSwitchContext
|
||||
|
@ -42,6 +42,9 @@
|
||||
* See http://www.freertos.org/a00110.html.
|
||||
*----------------------------------------------------------*/
|
||||
|
||||
// skip if included from IAR assembler
|
||||
#ifndef __IASMARM__
|
||||
|
||||
// Include MCU header
|
||||
#include "bsp/board_mcu.h"
|
||||
|
||||
@ -57,6 +60,8 @@
|
||||
extern uint32_t SystemCoreClock;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/* Cortex M23/M33 port configuration. */
|
||||
#define configENABLE_MPU 0
|
||||
#define configENABLE_FPU 1
|
||||
@ -144,10 +149,10 @@
|
||||
|
||||
#ifdef __RX__
|
||||
/* Renesas RX series */
|
||||
#define vSoftwareInterruptISR INT_Excep_ICU_SWINT
|
||||
#define vTickISR INT_Excep_CMT0_CMI0
|
||||
#define configPERIPHERAL_CLOCK_HZ (configCPU_CLOCK_HZ/2)
|
||||
#define configKERNEL_INTERRUPT_PRIORITY 1
|
||||
#define vSoftwareInterruptISR INT_Excep_ICU_SWINT
|
||||
#define vTickISR INT_Excep_CMT0_CMI0
|
||||
#define configPERIPHERAL_CLOCK_HZ (configCPU_CLOCK_HZ/2)
|
||||
#define configKERNEL_INTERRUPT_PRIORITY 1
|
||||
#define configMAX_SYSCALL_INTERRUPT_PRIORITY 4
|
||||
|
||||
#else
|
||||
@ -163,9 +168,18 @@
|
||||
#if defined(__NVIC_PRIO_BITS)
|
||||
// For Cortex-M specific: __NVIC_PRIO_BITS is defined in core_cmx.h
|
||||
#define configPRIO_BITS __NVIC_PRIO_BITS
|
||||
|
||||
#elif defined(__ECLIC_INTCTLBITS)
|
||||
// RISC-V Bumblebee core from nuclei
|
||||
#define configPRIO_BITS __ECLIC_INTCTLBITS
|
||||
|
||||
#elif defined(__IASMARM__)
|
||||
// FIXME: IAR Assembler cannot include mcu header directly to get __NVIC_PRIO_BITS.
|
||||
// Therefore we will hard coded it to minimum value of 2 to get pass ci build.
|
||||
// IAR user must update this to correct value of the target MCU
|
||||
#message "configPRIO_BITS is hard coded to 2 to pass IAR build only. User should update it per MCU"
|
||||
#define configPRIO_BITS 2
|
||||
|
||||
#else
|
||||
#error "FreeRTOS configPRIO_BITS to be defined"
|
||||
#endif
|
||||
|
@ -6,7 +6,10 @@ INC += \
|
||||
$(TOP)/hw \
|
||||
|
||||
# Example source
|
||||
EXAMPLE_SOURCE += $(wildcard src/*.c)
|
||||
EXAMPLE_SOURCE = \
|
||||
src/main.c \
|
||||
src/usb_descriptors.c
|
||||
|
||||
SRC_C += $(addprefix $(CURRENT_PATH)/, $(EXAMPLE_SOURCE))
|
||||
|
||||
include ../../rules.mk
|
||||
|
@ -4,13 +4,14 @@ include ../../../tools/top.mk
|
||||
include ../../make.mk
|
||||
|
||||
FREERTOS_SRC = lib/FreeRTOS-Kernel
|
||||
FREERTOS_PORTABLE_SRC= $(FREERTOS_SRC)/portable/$(if $(USE_IAR),IAR,GCC)/$(FREERTOS_PORT)
|
||||
|
||||
INC += \
|
||||
src \
|
||||
src/FreeRTOSConfig \
|
||||
$(TOP)/hw \
|
||||
$(TOP)/$(FREERTOS_SRC)/include \
|
||||
$(TOP)/$(FREERTOS_SRC)/portable/GCC/$(FREERTOS_PORT)
|
||||
$(TOP)/$(FREERTOS_PORTABLE_SRC)
|
||||
|
||||
# Example source
|
||||
EXAMPLE_SOURCE = \
|
||||
@ -26,17 +27,20 @@ SRC_C += \
|
||||
$(FREERTOS_SRC)/queue.c \
|
||||
$(FREERTOS_SRC)/tasks.c \
|
||||
$(FREERTOS_SRC)/timers.c \
|
||||
$(subst ../../../,,$(wildcard ../../../$(FREERTOS_SRC)/portable/GCC/$(FREERTOS_PORT)/*.c))
|
||||
$(subst ../../../,,$(wildcard ../../../$(FREERTOS_PORTABLE_SRC)/*.c))
|
||||
|
||||
SRC_S += \
|
||||
$(subst ../../../,,$(wildcard ../../../$(FREERTOS_PORTABLE_SRC)/*.s))
|
||||
|
||||
# include heap manage if configSUPPORT_DYNAMIC_ALLOCATION = 1
|
||||
# SRC_C += $(FREERTOS_SRC)/portable/MemMang/heap_1.c
|
||||
# CFLAGS += -Wno-error=sign-compare
|
||||
|
||||
# Suppress FreeRTOSConfig.h warnings
|
||||
CFLAGS += -Wno-error=redundant-decls
|
||||
GCC_CFLAGS += -Wno-error=redundant-decls
|
||||
|
||||
# Suppress FreeRTOS source warnings
|
||||
CFLAGS += -Wno-error=cast-qual
|
||||
GCC_CFLAGS += -Wno-error=cast-qual
|
||||
|
||||
# FreeRTOS (lto + Os) linker issue
|
||||
LDFLAGS += -Wl,--undefined=vTaskSwitchContext
|
||||
|
@ -42,6 +42,9 @@
|
||||
* See http://www.freertos.org/a00110.html.
|
||||
*----------------------------------------------------------*/
|
||||
|
||||
// skip if included from IAR assembler
|
||||
#ifndef __IASMARM__
|
||||
|
||||
// Include MCU header
|
||||
#include "bsp/board_mcu.h"
|
||||
|
||||
@ -57,6 +60,8 @@
|
||||
extern uint32_t SystemCoreClock;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/* Cortex M23/M33 port configuration. */
|
||||
#define configENABLE_MPU 0
|
||||
#define configENABLE_FPU 1
|
||||
@ -144,10 +149,10 @@
|
||||
|
||||
#ifdef __RX__
|
||||
/* Renesas RX series */
|
||||
#define vSoftwareInterruptISR INT_Excep_ICU_SWINT
|
||||
#define vTickISR INT_Excep_CMT0_CMI0
|
||||
#define configPERIPHERAL_CLOCK_HZ (configCPU_CLOCK_HZ/2)
|
||||
#define configKERNEL_INTERRUPT_PRIORITY 1
|
||||
#define vSoftwareInterruptISR INT_Excep_ICU_SWINT
|
||||
#define vTickISR INT_Excep_CMT0_CMI0
|
||||
#define configPERIPHERAL_CLOCK_HZ (configCPU_CLOCK_HZ/2)
|
||||
#define configKERNEL_INTERRUPT_PRIORITY 1
|
||||
#define configMAX_SYSCALL_INTERRUPT_PRIORITY 4
|
||||
|
||||
#else
|
||||
@ -163,9 +168,18 @@
|
||||
#if defined(__NVIC_PRIO_BITS)
|
||||
// For Cortex-M specific: __NVIC_PRIO_BITS is defined in core_cmx.h
|
||||
#define configPRIO_BITS __NVIC_PRIO_BITS
|
||||
|
||||
#elif defined(__ECLIC_INTCTLBITS)
|
||||
// RISC-V Bumblebee core from nuclei
|
||||
#define configPRIO_BITS __ECLIC_INTCTLBITS
|
||||
|
||||
#elif defined(__IASMARM__)
|
||||
// FIXME: IAR Assembler cannot include mcu header directly to get __NVIC_PRIO_BITS.
|
||||
// Therefore we will hard coded it to minimum value of 2 to get pass ci build.
|
||||
// IAR user must update this to correct value of the target MCU
|
||||
#message "configPRIO_BITS is hard coded to 2 to pass IAR build only. User should update it per MCU"
|
||||
#define configPRIO_BITS 2
|
||||
|
||||
#else
|
||||
#error "FreeRTOS configPRIO_BITS to be defined"
|
||||
#endif
|
||||
|
@ -4,7 +4,7 @@ include ../../../tools/top.mk
|
||||
include ../../make.mk
|
||||
|
||||
# suppress warning caused by lwip
|
||||
CFLAGS += \
|
||||
GCC_CFLAGS += \
|
||||
-Wno-error=null-dereference \
|
||||
-Wno-error=unused-parameter \
|
||||
-Wno-error=unused-variable
|
||||
|
35
examples/device/net_lwip_webserver/src/arch/bpstruct.h
Normal file
35
examples/device/net_lwip_webserver/src/arch/bpstruct.h
Normal file
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 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. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
|
||||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
* Author: Adam Dunkels <adam@sics.se>
|
||||
*
|
||||
*/
|
||||
|
||||
#if defined(__ICCARM__)
|
||||
#pragma pack(1)
|
||||
#endif
|
35
examples/device/net_lwip_webserver/src/arch/epstruct.h
Normal file
35
examples/device/net_lwip_webserver/src/arch/epstruct.h
Normal file
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 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. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
|
||||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
* Author: Adam Dunkels <adam@sics.se>
|
||||
*
|
||||
*/
|
||||
|
||||
#if defined(__ICCARM__)
|
||||
#pragma pack()
|
||||
#endif
|
@ -23,7 +23,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <strings.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h> /* atoi */
|
||||
#include "tusb.h"
|
||||
#include "bsp/board.h"
|
||||
@ -148,11 +148,12 @@ bool tud_usbtmc_msg_data_cb(void *data, size_t len, bool transfer_complete)
|
||||
queryState = transfer_complete;
|
||||
idnQuery = 0;
|
||||
|
||||
if(transfer_complete && (len >=4) && !strncasecmp("*idn?",data,4))
|
||||
if ( transfer_complete && (len >= 4) && (!strncmp("*idn?", data, 4) || !strncmp("*IDN?", data, 4)) )
|
||||
{
|
||||
idnQuery = 1;
|
||||
}
|
||||
if(transfer_complete && !strncasecmp("delay ",data,5))
|
||||
|
||||
if ( transfer_complete && (!strncmp("delay ", data, 5) || !strncmp("DELAY ", data, 5)) )
|
||||
{
|
||||
queryState = 0;
|
||||
int d = atoi((char*)data + 5);
|
||||
|
@ -99,6 +99,7 @@ uint8_t const desc_fs_configuration[] =
|
||||
{
|
||||
// Config number, interface count, string index, total length, attribute, power in mA
|
||||
TUD_CONFIG_DESCRIPTOR(1, ITF_NUM_TOTAL, 0, CONFIG_TOTAL_LEN, 0, 500),
|
||||
|
||||
// IAD for Video Control
|
||||
#if defined(CFG_EXAMPLE_VIDEO_READONLY) && !defined(CFG_EXAMPLE_VIDEO_DISABLE_MJPEG)
|
||||
TUD_VIDEO_CAPTURE_DESCRIPTOR_MJPEG(4, EPNUM_VIDEO_IN,
|
||||
|
@ -49,14 +49,31 @@ endif
|
||||
#-------------- Cross Compiler ------------
|
||||
# Can be set by board, default to ARM GCC
|
||||
CROSS_COMPILE ?= arm-none-eabi-
|
||||
|
||||
# Allow for -Os to be changed by board makefiles in case -Os is not allowed
|
||||
CFLAGS_OPTIMIZED ?= -Os
|
||||
|
||||
CC = $(CROSS_COMPILE)gcc
|
||||
CXX = $(CROSS_COMPILE)g++
|
||||
GDB = $(CROSS_COMPILE)gdb
|
||||
OBJCOPY = $(CROSS_COMPILE)objcopy
|
||||
SIZE = $(CROSS_COMPILE)size
|
||||
ifeq ($(CC),iccarm)
|
||||
USE_IAR = 1
|
||||
endif
|
||||
|
||||
ifdef USE_IAR
|
||||
AS = iasmarm
|
||||
LD = ilinkarm
|
||||
OBJCOPY = ielftool
|
||||
SIZE = echo "size not available for IAR"
|
||||
|
||||
else
|
||||
CC = $(CROSS_COMPILE)gcc
|
||||
CXX = $(CROSS_COMPILE)g++
|
||||
AS = $(CC) -x assembler-with-cpp
|
||||
LD = $(CC)
|
||||
|
||||
GDB = $(CROSS_COMPILE)gdb
|
||||
OBJCOPY = $(CROSS_COMPILE)objcopy
|
||||
SIZE = $(CROSS_COMPILE)size
|
||||
endif
|
||||
|
||||
MKDIR = mkdir
|
||||
|
||||
ifeq ($(CMDEXE),1)
|
||||
@ -78,8 +95,8 @@ SRC_C += $(subst $(TOP)/,,$(wildcard $(TOP)/$(BOARD_PATH)/*.c))
|
||||
|
||||
INC += $(TOP)/$(FAMILY_PATH)
|
||||
|
||||
# Compiler Flags
|
||||
CFLAGS += \
|
||||
# GCC Compiler Flags
|
||||
GCC_CFLAGS += \
|
||||
-ggdb \
|
||||
-fdata-sections \
|
||||
-ffunction-sections \
|
||||
@ -110,13 +127,13 @@ CFLAGS += \
|
||||
|
||||
# conversion is too strict for most mcu driver, may be disable sign/int/arith-conversion
|
||||
# -Wconversion
|
||||
|
||||
|
||||
# Debugging/Optimization
|
||||
ifeq ($(DEBUG), 1)
|
||||
CFLAGS += -O0
|
||||
GCC_CFLAGS += -O0
|
||||
NO_LTO = 1
|
||||
else
|
||||
CFLAGS += $(CFLAGS_OPTIMIZED)
|
||||
GCC_CFLAGS += $(CFLAGS_OPTIMIZED)
|
||||
endif
|
||||
|
||||
# Log level is mapped to TUSB DEBUG option
|
||||
|
@ -46,23 +46,51 @@ INC += $(TOP)/src
|
||||
|
||||
CFLAGS += $(addprefix -I,$(INC))
|
||||
|
||||
ifdef USE_IAR
|
||||
|
||||
SRC_S += $(IAR_SRC_S)
|
||||
|
||||
ASFLAGS := $(CFLAGS) $(IAR_ASFLAGS) $(ASFLAGS) -S
|
||||
IAR_LDFLAGS += --config $(TOP)/$(IAR_LD_FILE)
|
||||
CFLAGS += $(IAR_CFLAGS) -e --debug --silent
|
||||
|
||||
else
|
||||
|
||||
SRC_S += $(GCC_SRC_S)
|
||||
|
||||
CFLAGS += $(GCC_CFLAGS) -MD
|
||||
|
||||
# LTO makes it difficult to analyze map file for optimizing size purpose
|
||||
# We will run this option in ci
|
||||
ifeq ($(NO_LTO),1)
|
||||
CFLAGS := $(filter-out -flto,$(CFLAGS))
|
||||
endif
|
||||
|
||||
ifneq ($(LD_FILE),)
|
||||
LDFLAGS_LD_FILE ?= -Wl,-T,$(TOP)/$(LD_FILE)
|
||||
LDFLAGS += $(CFLAGS) -Wl,-Map=$@.map -Wl,-cref -Wl,-gc-sections
|
||||
|
||||
ifdef LD_FILE
|
||||
LDFLAGS += -Wl,-T,$(TOP)/$(LD_FILE)
|
||||
endif
|
||||
|
||||
ifdef GCC_LD_FILE
|
||||
LDFLAGS += -Wl,-T,$(TOP)/$(GCC_LD_FILE)
|
||||
endif
|
||||
|
||||
LDFLAGS += $(CFLAGS) $(LDFLAGS_LD_FILE) -Wl,-Map=$@.map -Wl,-cref -Wl,-gc-sections
|
||||
ifneq ($(SKIP_NANOLIB), 1)
|
||||
LDFLAGS += -specs=nosys.specs -specs=nano.specs
|
||||
endif
|
||||
|
||||
ASFLAGS += $(CFLAGS)
|
||||
|
||||
endif # USE_IAR
|
||||
|
||||
# Verbose mode
|
||||
ifeq ("$(V)","1")
|
||||
$(info CFLAGS $(CFLAGS) ) $(info )
|
||||
$(info LDFLAGS $(LDFLAGS)) $(info )
|
||||
$(info ASFLAGS $(ASFLAGS)) $(info )
|
||||
endif
|
||||
|
||||
# Assembly files can be name with upper case .S, convert it to .s
|
||||
SRC_S := $(SRC_S:.S=.s)
|
||||
|
||||
@ -72,13 +100,6 @@ SRC_S := $(SRC_S:.S=.s)
|
||||
OBJ += $(addprefix $(BUILD)/obj/, $(SRC_S:.s=_asm.o))
|
||||
OBJ += $(addprefix $(BUILD)/obj/, $(SRC_C:.c=.o))
|
||||
|
||||
# Verbose mode
|
||||
ifeq ("$(V)","1")
|
||||
$(info CFLAGS $(CFLAGS) ) $(info )
|
||||
$(info LDFLAGS $(LDFLAGS)) $(info )
|
||||
$(info ASFLAGS $(ASFLAGS)) $(info )
|
||||
endif
|
||||
|
||||
# ---------------------------------------
|
||||
# Rules
|
||||
# ---------------------------------------
|
||||
@ -96,10 +117,30 @@ else
|
||||
@$(MKDIR) -p $@
|
||||
endif
|
||||
|
||||
$(BUILD)/$(PROJECT).elf: $(OBJ)
|
||||
@echo LINK $@
|
||||
@$(CC) -o $@ $(LDFLAGS) $^ -Wl,--start-group $(LIBS) -Wl,--end-group
|
||||
# We set vpath to point to the top of the tree so that the source files
|
||||
# can be located. By following this scheme, it allows a single build rule
|
||||
# to be used to compile all .c files.
|
||||
vpath %.c . $(TOP)
|
||||
vpath %.s . $(TOP)
|
||||
vpath %.S . $(TOP)
|
||||
|
||||
# Compile .c file
|
||||
$(BUILD)/obj/%.o: %.c
|
||||
@echo CC $(notdir $@)
|
||||
@$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
# ASM sources lower case .s
|
||||
$(BUILD)/obj/%_asm.o: %.s
|
||||
@echo AS $(notdir $@)
|
||||
@$(AS) $(ASFLAGS) -c -o $@ $<
|
||||
|
||||
# ASM sources upper case .S
|
||||
$(BUILD)/obj/%_asm.o: %.S
|
||||
@echo AS $(notdir $@)
|
||||
@$(AS) $(ASFLAGS) -c -o $@ $<
|
||||
|
||||
ifndef USE_IAR
|
||||
# GCC based compiler
|
||||
$(BUILD)/$(PROJECT).bin: $(BUILD)/$(PROJECT).elf
|
||||
@echo CREATE $@
|
||||
@$(OBJCOPY) -O binary $^ $@
|
||||
@ -108,6 +149,26 @@ $(BUILD)/$(PROJECT).hex: $(BUILD)/$(PROJECT).elf
|
||||
@echo CREATE $@
|
||||
@$(OBJCOPY) -O ihex $^ $@
|
||||
|
||||
$(BUILD)/$(PROJECT).elf: $(OBJ)
|
||||
@echo LINK $@
|
||||
@$(LD) -o $@ $(LDFLAGS) $^ -Wl,--start-group $(LIBS) -Wl,--end-group
|
||||
|
||||
else
|
||||
|
||||
# IAR Compiler
|
||||
$(BUILD)/$(PROJECT).bin: $(BUILD)/$(PROJECT).elf
|
||||
@echo CREATE $@
|
||||
@$(OBJCOPY) --silent --bin $^ $@
|
||||
|
||||
$(BUILD)/$(PROJECT).hex: $(BUILD)/$(PROJECT).elf
|
||||
@echo CREATE $@
|
||||
@$(OBJCOPY) --silent --ihex $^ $@
|
||||
|
||||
$(BUILD)/$(PROJECT).elf: $(OBJ)
|
||||
@echo LINK $@
|
||||
@$(LD) -o $@ $(IAR_LDFLAGS) $^
|
||||
endif
|
||||
|
||||
# UF2 generation, iMXRT need to strip to text only before conversion
|
||||
ifeq ($(FAMILY),imxrt)
|
||||
$(BUILD)/$(PROJECT).uf2: $(BUILD)/$(PROJECT).elf
|
||||
@ -122,27 +183,8 @@ endif
|
||||
|
||||
copy-artifact: $(BUILD)/$(PROJECT).bin $(BUILD)/$(PROJECT).hex $(BUILD)/$(PROJECT).uf2
|
||||
|
||||
# We set vpath to point to the top of the tree so that the source files
|
||||
# can be located. By following this scheme, it allows a single build rule
|
||||
# to be used to compile all .c files.
|
||||
vpath %.c . $(TOP)
|
||||
$(BUILD)/obj/%.o: %.c
|
||||
@echo CC $(notdir $@)
|
||||
@$(CC) $(CFLAGS) -c -MD -o $@ $<
|
||||
|
||||
# ASM sources lower case .s
|
||||
vpath %.s . $(TOP)
|
||||
$(BUILD)/obj/%_asm.o: %.s
|
||||
@echo AS $(notdir $@)
|
||||
@$(CC) -x assembler-with-cpp $(ASFLAGS) -c -o $@ $<
|
||||
|
||||
# ASM sources upper case .S
|
||||
vpath %.S . $(TOP)
|
||||
$(BUILD)/obj/%_asm.o: %.S
|
||||
@echo AS $(notdir $@)
|
||||
@$(CC) -x assembler-with-cpp $(ASFLAGS) -c -o $@ $<
|
||||
|
||||
endif
|
||||
# ---------------- GNU Make End -----------------------
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
@ -151,7 +193,6 @@ ifeq ($(CMDEXE),1)
|
||||
else
|
||||
$(RM) -rf $(BUILD)
|
||||
endif
|
||||
# ---------------- GNU Make End -----------------------
|
||||
|
||||
# get depenecies
|
||||
.PHONY: get-deps
|
||||
|
@ -77,8 +77,10 @@ void board_led_task(void)
|
||||
//--------------------------------------------------------------------+
|
||||
// newlib read()/write() retarget
|
||||
//--------------------------------------------------------------------+
|
||||
|
||||
#if defined(__MSP430__) || defined(__RX__)
|
||||
#ifdef __ICCARM__
|
||||
#define sys_write __write
|
||||
#define sys_read __read
|
||||
#elif defined(__MSP430__) || defined(__RX__)
|
||||
#define sys_write write
|
||||
#define sys_read read
|
||||
#else
|
||||
|
@ -1,11 +1,15 @@
|
||||
CFLAGS += -DSTM32F070xB -DCFG_EXAMPLE_VIDEO_READONLY
|
||||
|
||||
LD_FILE = $(BOARD_PATH)/stm32F070rbtx_flash.ld
|
||||
# GCC
|
||||
GCC_SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32f070xb.s
|
||||
GCC_LD_FILE = $(BOARD_PATH)/stm32F070rbtx_flash.ld
|
||||
|
||||
SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32f070xb.s
|
||||
# IAR
|
||||
IAR_SRC_S += $(ST_CMSIS)/Source/Templates/iar/startup_stm32f070xb.s
|
||||
IAR_LD_FILE = $(ST_CMSIS)/Source/Templates/iar/linker/stm32f070xb_flash.icf
|
||||
|
||||
# For flash-jlink target
|
||||
JLINK_DEVICE = stm32f070rb
|
||||
|
||||
# flash target using on-board stlink
|
||||
flash: flash-stlink
|
||||
flash: flash-stlink
|
@ -1,8 +1,10 @@
|
||||
CFLAGS += -DSTM32F072xB -DCFG_EXAMPLE_VIDEO_READONLY
|
||||
|
||||
LD_FILE = $(BOARD_PATH)/STM32F072RBTx_FLASH.ld
|
||||
GCC_SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32f072xb.s
|
||||
GCC_LD_FILE = $(BOARD_PATH)/STM32F072RBTx_FLASH.ld
|
||||
|
||||
SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32f072xb.s
|
||||
IAR_SRC_S += $(ST_CMSIS)/Source/Templates/iar/startup_stm32f072xb.s
|
||||
IAR_LD_FILE = $(ST_CMSIS)/Source/Templates/iar/linker/stm32f072xb_flash.icf
|
||||
|
||||
# For flash-jlink target
|
||||
JLINK_DEVICE = stm32f072rb
|
||||
|
@ -1,8 +1,10 @@
|
||||
CFLAGS += -DSTM32F072xB -DLSI_VALUE=40000 -DCFG_EXAMPLE_VIDEO_READONLY
|
||||
|
||||
LD_FILE = $(BOARD_PATH)/STM32F072VBTx_FLASH.ld
|
||||
GCC_SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32f072xb.s
|
||||
GCC_LD_FILE = $(BOARD_PATH)/STM32F072VBTx_FLASH.ld
|
||||
|
||||
SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32f072xb.s
|
||||
IAR_SRC_S += $(ST_CMSIS)/Source/Templates/iar/startup_stm32f072xb.s
|
||||
IAR_LD_FILE = $(ST_CMSIS)/Source/Templates/iar/linker/stm32f072xb_flash.icf
|
||||
|
||||
# For flash-jlink target
|
||||
JLINK_DEVICE = stm32f072vb
|
||||
|
@ -118,7 +118,8 @@ void board_init(void)
|
||||
|
||||
void board_led_write(bool state)
|
||||
{
|
||||
HAL_GPIO_WritePin(LED_PORT, LED_PIN, state ? LED_STATE_ON : (1-LED_STATE_ON));
|
||||
GPIO_PinState pin_state = (GPIO_PinState) (state ? LED_STATE_ON : (1-LED_STATE_ON));
|
||||
HAL_GPIO_WritePin(LED_PORT, LED_PIN, pin_state);
|
||||
}
|
||||
|
||||
uint32_t board_button_read(void)
|
||||
@ -153,7 +154,7 @@ uint32_t board_millis(void)
|
||||
|
||||
void HardFault_Handler (void)
|
||||
{
|
||||
asm("bkpt");
|
||||
__asm("BKPT #0\n");
|
||||
}
|
||||
|
||||
#ifdef USE_FULL_ASSERT
|
||||
|
@ -7,18 +7,32 @@ ST_HAL_DRIVER = hw/mcu/st/stm32$(ST_FAMILY)xx_hal_driver
|
||||
|
||||
include $(TOP)/$(BOARD_PATH)/board.mk
|
||||
|
||||
# --------------
|
||||
# Compiler Flags
|
||||
# --------------
|
||||
CFLAGS += \
|
||||
-DCFG_EXAMPLE_MSC_READONLY \
|
||||
-DCFG_TUSB_MCU=OPT_MCU_STM32F0
|
||||
|
||||
# GCC Flags
|
||||
GCC_CFLAGS += \
|
||||
-flto \
|
||||
-mthumb \
|
||||
-mabi=aapcs \
|
||||
-mcpu=cortex-m0 \
|
||||
-mfloat-abi=soft \
|
||||
-nostdlib -nostartfiles \
|
||||
-DCFG_EXAMPLE_MSC_READONLY \
|
||||
-DCFG_TUSB_MCU=OPT_MCU_STM32F0
|
||||
|
||||
# suppress warning caused by vendor mcu driver
|
||||
CFLAGS += -Wno-error=unused-parameter -Wno-error=cast-align -Wno-error=cast-qual
|
||||
GCC_CFLAGS += -Wno-error=unused-parameter -Wno-error=cast-align -Wno-error=cast-qual
|
||||
|
||||
# IAR Flags
|
||||
IAR_CFLAGS += --cpu cortex-m0
|
||||
IAR_ASFLAGS += --cpu cortex-m0
|
||||
|
||||
# ------------------------
|
||||
# All source paths should be relative to the top level.
|
||||
# ------------------------
|
||||
|
||||
SRC_C += \
|
||||
src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c \
|
||||
|
@ -1,8 +1,12 @@
|
||||
CFLAGS += -DSTM32F103xB -DHSE_VALUE=8000000U -DCFG_EXAMPLE_VIDEO_READONLY
|
||||
|
||||
# All source paths should be relative to the top level.
|
||||
LD_FILE = $(BOARD_PATH)/STM32F103X8_FLASH.ld
|
||||
SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32f103xb.s
|
||||
# GCC
|
||||
GCC_SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32f103xb.s
|
||||
GCC_LD_FILE = $(BOARD_PATH)/STM32F103X8_FLASH.ld
|
||||
|
||||
# IAR
|
||||
IAR_SRC_S += $(ST_CMSIS)/Source/Templates/iar/startup_stm32f103xb.s
|
||||
IAR_LD_FILE = $(BOARD_PATH)/stm32f103x8_flash.icf
|
||||
|
||||
# For flash-jlink target
|
||||
JLINK_DEVICE = stm32f103c8
|
||||
|
@ -0,0 +1,31 @@
|
||||
/*###ICF### Section handled by ICF editor, don't touch! ****/
|
||||
/*-Editor annotation file-*/
|
||||
/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */
|
||||
/*-Specials-*/
|
||||
define symbol __ICFEDIT_intvec_start__ = 0x08000000;
|
||||
/*-Memory Regions-*/
|
||||
define symbol __ICFEDIT_region_ROM_start__ = 0x08000000 ;
|
||||
define symbol __ICFEDIT_region_ROM_end__ = 0x0800FFFF;
|
||||
define symbol __ICFEDIT_region_RAM_start__ = 0x20000000;
|
||||
define symbol __ICFEDIT_region_RAM_end__ = 0x20004FFF;
|
||||
/*-Sizes-*/
|
||||
define symbol __ICFEDIT_size_cstack__ = 0x400;
|
||||
define symbol __ICFEDIT_size_heap__ = 0x200;
|
||||
/**** End of ICF editor section. ###ICF###*/
|
||||
|
||||
|
||||
define memory mem with size = 4G;
|
||||
define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__];
|
||||
define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__];
|
||||
|
||||
define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
|
||||
define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };
|
||||
|
||||
initialize by copy { readwrite };
|
||||
do not initialize { section .noinit };
|
||||
|
||||
place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };
|
||||
|
||||
place in ROM_region { readonly };
|
||||
place in RAM_region { readwrite,
|
||||
block CSTACK, block HEAP };
|
@ -1,8 +1,12 @@
|
||||
CFLAGS += -DSTM32F103xB -DHSE_VALUE=8000000U
|
||||
|
||||
# All source paths should be relative to the top level.
|
||||
LD_FILE = $(BOARD_PATH)/STM32F103XC_FLASH.ld
|
||||
SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32f103xb.s
|
||||
# GCC
|
||||
GCC_SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32f103xb.s
|
||||
GCC_LD_FILE = $(BOARD_PATH)/STM32F103XC_FLASH.ld
|
||||
|
||||
# IAR
|
||||
IAR_SRC_S += $(ST_CMSIS)/Source/Templates/iar/startup_stm32f103xb.s
|
||||
IAR_LD_FILE = $(BOARD_PATH)/stm32f103xc_flash.icf
|
||||
|
||||
# For flash-jlink target
|
||||
JLINK_DEVICE = stm32f103rc
|
||||
|
31
hw/bsp/stm32f1/boards/stm32f103_mini_2/stm32f103xc_flash.icf
Normal file
31
hw/bsp/stm32f1/boards/stm32f103_mini_2/stm32f103xc_flash.icf
Normal file
@ -0,0 +1,31 @@
|
||||
/*###ICF### Section handled by ICF editor, don't touch! ****/
|
||||
/*-Editor annotation file-*/
|
||||
/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */
|
||||
/*-Specials-*/
|
||||
define symbol __ICFEDIT_intvec_start__ = 0x08000000;
|
||||
/*-Memory Regions-*/
|
||||
define symbol __ICFEDIT_region_ROM_start__ = 0x08000000 ;
|
||||
define symbol __ICFEDIT_region_ROM_end__ = 0x0803FFFF;
|
||||
define symbol __ICFEDIT_region_RAM_start__ = 0x20000000;
|
||||
define symbol __ICFEDIT_region_RAM_end__ = 0x2000BFFF;
|
||||
/*-Sizes-*/
|
||||
define symbol __ICFEDIT_size_cstack__ = 0x400;
|
||||
define symbol __ICFEDIT_size_heap__ = 0x200;
|
||||
/**** End of ICF editor section. ###ICF###*/
|
||||
|
||||
|
||||
define memory mem with size = 4G;
|
||||
define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__];
|
||||
define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__];
|
||||
|
||||
define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
|
||||
define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };
|
||||
|
||||
initialize by copy { readwrite };
|
||||
do not initialize { section .noinit };
|
||||
|
||||
place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };
|
||||
|
||||
place in ROM_region { readonly };
|
||||
place in RAM_region { readwrite,
|
||||
block CSTACK, block HEAP };
|
@ -104,7 +104,8 @@ void board_init(void)
|
||||
|
||||
void board_led_write(bool state)
|
||||
{
|
||||
HAL_GPIO_WritePin(LED_PORT, LED_PIN, state ? LED_STATE_ON : (1-LED_STATE_ON));
|
||||
GPIO_PinState pin_state = (GPIO_PinState) (state ? LED_STATE_ON : (1-LED_STATE_ON));
|
||||
HAL_GPIO_WritePin(LED_PORT, LED_PIN, pin_state);
|
||||
}
|
||||
|
||||
uint32_t board_button_read(void)
|
||||
@ -139,7 +140,7 @@ uint32_t board_millis(void)
|
||||
|
||||
void HardFault_Handler (void)
|
||||
{
|
||||
asm("bkpt");
|
||||
__asm("BKPT #0\n");
|
||||
}
|
||||
|
||||
#ifdef USE_FULL_ASSERT
|
||||
|
@ -6,19 +6,28 @@ ST_HAL_DRIVER = hw/mcu/st/stm32$(ST_FAMILY)xx_hal_driver
|
||||
|
||||
include $(TOP)/$(BOARD_PATH)/board.mk
|
||||
|
||||
# --------------
|
||||
# Compiler Flags
|
||||
# --------------
|
||||
CFLAGS += \
|
||||
-DCFG_TUSB_MCU=OPT_MCU_STM32F1
|
||||
|
||||
# GCC Flags
|
||||
GCC_CFLAGS += \
|
||||
-flto \
|
||||
-mthumb \
|
||||
-mabi=aapcs \
|
||||
-mcpu=cortex-m3 \
|
||||
-mfloat-abi=soft \
|
||||
-nostdlib -nostartfiles \
|
||||
-DCFG_TUSB_MCU=OPT_MCU_STM32F1
|
||||
|
||||
# mcu driver cause following warnings
|
||||
#CFLAGS += -Wno-error=unused-parameter
|
||||
# IAR Flags
|
||||
IAR_CFLAGS += --cpu cortex-m3
|
||||
IAR_ASFLAGS += --cpu cortex-m3
|
||||
|
||||
# ------------------------
|
||||
# All source paths should be relative to the top level.
|
||||
# ------------------------
|
||||
SRC_C += \
|
||||
src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c \
|
||||
$(ST_CMSIS)/Source/Templates/system_stm32$(ST_FAMILY)xx.c \
|
||||
|
@ -1,8 +1,12 @@
|
||||
CFLAGS += -DSTM32F405xx
|
||||
|
||||
LD_FILE = $(BOARD_PATH)/STM32F405RGTx_FLASH.ld
|
||||
# GCC
|
||||
GCC_SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32f405xx.s
|
||||
GCC_LD_FILE = $(BOARD_PATH)/STM32F405RGTx_FLASH.ld
|
||||
|
||||
SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32f405xx.s
|
||||
# IAR
|
||||
IAR_SRC_S += $(ST_CMSIS)/Source/Templates/iar/startup_stm32f405xx.s
|
||||
IAR_LD_FILE = $(ST_CMSIS)/Source/Templates/iar/linker/stm32f405xx_flash.icf
|
||||
|
||||
# For flash-jlink target
|
||||
JLINK_DEVICE = stm32f405rg
|
||||
|
@ -1,8 +1,12 @@
|
||||
CFLAGS += -DSTM32F405xx
|
||||
|
||||
LD_FILE = $(BOARD_PATH)/STM32F405RGTx_FLASH.ld
|
||||
# GCC
|
||||
GCC_SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32f405xx.s
|
||||
GCC_LD_FILE = $(BOARD_PATH)/STM32F405RGTx_FLASH.ld
|
||||
|
||||
SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32f405xx.s
|
||||
# IAR
|
||||
IAR_SRC_S += $(ST_CMSIS)/Source/Templates/iar/startup_stm32f405xx.s
|
||||
IAR_LD_FILE = $(ST_CMSIS)/Source/Templates/iar/linker/stm32f405xx_flash.icf
|
||||
|
||||
# For flash-jlink target
|
||||
JLINK_DEVICE = stm32f405rg
|
||||
|
@ -1,8 +1,12 @@
|
||||
CFLAGS += -DSTM32F401xC
|
||||
|
||||
LD_FILE = $(BOARD_PATH)/STM32F401VCTx_FLASH.ld
|
||||
# GCC
|
||||
GCC_SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32f401xc.s
|
||||
GCC_LD_FILE = $(BOARD_PATH)/STM32F401VCTx_FLASH.ld
|
||||
|
||||
SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32f401xc.s
|
||||
# IAR
|
||||
IAR_SRC_S += $(ST_CMSIS)/Source/Templates/iar/startup_stm32f401xc.s
|
||||
IAR_LD_FILE = $(ST_CMSIS)/Source/Templates/iar/linker/stm32f401xc_flash.icf
|
||||
|
||||
# For flash-jlink target
|
||||
JLINK_DEVICE = stm32f401cc
|
||||
|
@ -1,8 +1,13 @@
|
||||
CFLAGS += -DSTM32F407xx
|
||||
|
||||
LD_FILE = $(BOARD_PATH)/STM32F407VGTx_FLASH.ld
|
||||
# GCC
|
||||
GCC_SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32f407xx.s
|
||||
GCC_LD_FILE = $(BOARD_PATH)/STM32F407VGTx_FLASH.ld
|
||||
|
||||
# IAR
|
||||
IAR_SRC_S += $(ST_CMSIS)/Source/Templates/iar/startup_stm32f407xx.s
|
||||
IAR_LD_FILE = $(ST_CMSIS)/Source/Templates/iar/linker/stm32f407xx_flash.icf
|
||||
|
||||
SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32f407xx.s
|
||||
|
||||
# For flash-jlink target
|
||||
JLINK_DEVICE = stm32f407vg
|
||||
|
@ -1,8 +1,12 @@
|
||||
CFLAGS += -DSTM32F411xE
|
||||
|
||||
LD_FILE = $(BOARD_PATH)/STM32F411CEUx_FLASH.ld
|
||||
# GCC
|
||||
GCC_SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32f411xe.s
|
||||
GCC_LD_FILE = $(BOARD_PATH)/STM32F411CEUx_FLASH.ld
|
||||
|
||||
SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32f411xe.s
|
||||
# IAR
|
||||
IAR_SRC_S += $(ST_CMSIS)/Source/Templates/iar/startup_stm32f411xe.s
|
||||
IAR_LD_FILE = $(ST_CMSIS)/Source/Templates/iar/linker/stm32f411xe_flash.icf
|
||||
|
||||
# For flash-jlink target
|
||||
JLINK_DEVICE = stm32f411ce
|
||||
|
@ -1,8 +1,12 @@
|
||||
CFLAGS += -DSTM32F411xE
|
||||
|
||||
LD_FILE = $(BOARD_PATH)/STM32F411VETx_FLASH.ld
|
||||
# GCC
|
||||
GCC_SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32f411xe.s
|
||||
GCC_LD_FILE = $(BOARD_PATH)/STM32F411VETx_FLASH.ld
|
||||
|
||||
SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32f411xe.s
|
||||
# IAR
|
||||
IAR_SRC_S += $(ST_CMSIS)/Source/Templates/iar/startup_stm32f411xe.s
|
||||
IAR_LD_FILE = $(ST_CMSIS)/Source/Templates/iar/linker/stm32f411xe_flash.icf
|
||||
|
||||
# For flash-jlink target
|
||||
JLINK_DEVICE = stm32f411ve
|
||||
|
@ -1,8 +1,12 @@
|
||||
CFLAGS += -DSTM32F412Zx
|
||||
|
||||
LD_FILE = $(BOARD_PATH)/STM32F412ZGTx_FLASH.ld
|
||||
# GCC
|
||||
GCC_SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32f412zx.s
|
||||
GCC_LD_FILE = $(BOARD_PATH)/STM32F412ZGTx_FLASH.ld
|
||||
|
||||
SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32f412zx.s
|
||||
# IAR
|
||||
IAR_SRC_S += $(ST_CMSIS)/Source/Templates/iar/startup_stm32f412zx.s
|
||||
IAR_LD_FILE = $(ST_CMSIS)/Source/Templates/iar/linker/stm32f412zx_flash.icf
|
||||
|
||||
# For flash-jlink target
|
||||
JLINK_DEVICE = stm32f412zg
|
||||
|
@ -1,8 +1,12 @@
|
||||
CFLAGS += -DSTM32F412Zx
|
||||
|
||||
LD_FILE = $(BOARD_PATH)/STM32F412ZGTx_FLASH.ld
|
||||
# GCC
|
||||
GCC_SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32f412zx.s
|
||||
GCC_LD_FILE = $(BOARD_PATH)/STM32F412ZGTx_FLASH.ld
|
||||
|
||||
SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32f412zx.s
|
||||
# IAR
|
||||
IAR_SRC_S += $(ST_CMSIS)/Source/Templates/iar/startup_stm32f412zx.s
|
||||
IAR_LD_FILE = $(ST_CMSIS)/Source/Templates/iar/linker/stm32f412zx_flash.icf
|
||||
|
||||
# For flash-jlink target
|
||||
JLINK_DEVICE = stm32f412zg
|
||||
|
@ -1,8 +1,12 @@
|
||||
CFLAGS += -DSTM32F439xx
|
||||
|
||||
LD_FILE = $(BOARD_PATH)/STM32F439ZITX_FLASH.ld
|
||||
# GCC
|
||||
GCC_SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32f439xx.s
|
||||
GCC_LD_FILE = $(BOARD_PATH)/STM32F439ZITX_FLASH.ld
|
||||
|
||||
SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32f439xx.s
|
||||
# IAR
|
||||
IAR_SRC_S += $(ST_CMSIS)/Source/Templates/iar/startup_stm32f439xx.s
|
||||
IAR_LD_FILE = $(ST_CMSIS)/Source/Templates/iar/linker/stm32f439xx_flash.icf
|
||||
|
||||
# For flash-jlink target
|
||||
JLINK_DEVICE = stm32f439zi
|
||||
|
@ -150,7 +150,8 @@ void board_init(void)
|
||||
|
||||
void board_led_write(bool state)
|
||||
{
|
||||
HAL_GPIO_WritePin(LED_PORT, LED_PIN, state ? LED_STATE_ON : (1-LED_STATE_ON));
|
||||
GPIO_PinState pin_state = (GPIO_PinState) (state ? LED_STATE_ON : (1-LED_STATE_ON));
|
||||
HAL_GPIO_WritePin(LED_PORT, LED_PIN, pin_state);
|
||||
}
|
||||
|
||||
uint32_t board_button_read(void)
|
||||
@ -190,7 +191,7 @@ uint32_t board_millis(void)
|
||||
|
||||
void HardFault_Handler (void)
|
||||
{
|
||||
asm("bkpt");
|
||||
__asm("BKPT #0\n");
|
||||
}
|
||||
|
||||
// Required by __libc_init_array in startup code if we are compiling using
|
||||
|
@ -7,18 +7,32 @@ ST_HAL_DRIVER = hw/mcu/st/stm32$(ST_FAMILY)xx_hal_driver
|
||||
|
||||
include $(TOP)/$(BOARD_PATH)/board.mk
|
||||
|
||||
# --------------
|
||||
# Compiler Flags
|
||||
# --------------
|
||||
CFLAGS += \
|
||||
-DCFG_TUSB_MCU=OPT_MCU_STM32F4
|
||||
|
||||
# GCC Flags
|
||||
GCC_CFLAGS += \
|
||||
-flto \
|
||||
-mthumb \
|
||||
-mabi=aapcs \
|
||||
-mcpu=cortex-m4 \
|
||||
-mfloat-abi=hard \
|
||||
-mfpu=fpv4-sp-d16 \
|
||||
-nostdlib -nostartfiles \
|
||||
-DCFG_TUSB_MCU=OPT_MCU_STM32F4
|
||||
-nostdlib -nostartfiles
|
||||
|
||||
# suppress warning caused by vendor mcu driver
|
||||
CFLAGS += -Wno-error=cast-align
|
||||
GCC_CFLAGS += -Wno-error=cast-align
|
||||
|
||||
# IAR Flags
|
||||
IAR_CFLAGS += --cpu cortex-m4 --fpu VFPv4
|
||||
IAR_ASFLAGS += --cpu cortex-m4 --fpu VFPv4
|
||||
|
||||
# -----------------
|
||||
# Sources & Include
|
||||
# -----------------
|
||||
|
||||
SRC_C += \
|
||||
src/portable/synopsys/dwc2/dcd_dwc2.c \
|
||||
|
@ -6,9 +6,13 @@ CFLAGS += \
|
||||
-DSTM32F723xx \
|
||||
-DHSE_VALUE=25000000 \
|
||||
|
||||
# All source paths should be relative to the top level.
|
||||
LD_FILE = $(BOARD_PATH)/STM32F723xE_FLASH.ld
|
||||
SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32f723xx.s
|
||||
# GCC
|
||||
GCC_SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32f723xx.s
|
||||
GCC_LD_FILE = $(BOARD_PATH)/STM32F723xE_FLASH.ld
|
||||
|
||||
# IAR
|
||||
IAR_SRC_S += $(ST_CMSIS)/Source/Templates/iar/startup_stm32f723xx.s
|
||||
IAR_LD_FILE = $(ST_CMSIS)/Source/Templates/iar/linker/stm32f723xx_flash.icf
|
||||
|
||||
# flash target using on-board stlink
|
||||
flash: flash-stlink
|
||||
|
@ -5,8 +5,13 @@ CFLAGS += \
|
||||
-DSTM32F723xx \
|
||||
-DHSE_VALUE=25000000 \
|
||||
|
||||
LD_FILE = $(BOARD_PATH)/STM32F723xE_FLASH.ld
|
||||
SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32f723xx.s
|
||||
# GCC
|
||||
GCC_LD_FILE = $(BOARD_PATH)/STM32F723xE_FLASH.ld
|
||||
GCC_SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32f723xx.s
|
||||
|
||||
# IAR
|
||||
IAR_SRC_S += $(ST_CMSIS)/Source/Templates/iar/startup_stm32f723xx.s
|
||||
IAR_LD_FILE = $(ST_CMSIS)/Source/Templates/iar/linker/stm32f723xx_flash.icf
|
||||
|
||||
# flash target using on-board stlink
|
||||
flash: flash-stlink
|
||||
|
@ -5,8 +5,13 @@ CFLAGS += \
|
||||
-DSTM32F746xx \
|
||||
-DHSE_VALUE=25000000
|
||||
|
||||
LD_FILE = $(BOARD_PATH)/STM32F746ZGTx_FLASH.ld
|
||||
SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32f746xx.s
|
||||
# GCC
|
||||
GCC_LD_FILE = $(BOARD_PATH)/STM32F746ZGTx_FLASH.ld
|
||||
GCC_SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32f746xx.s
|
||||
|
||||
# IAR
|
||||
IAR_SRC_S += $(ST_CMSIS)/Source/Templates/iar/startup_stm32f746xx.s
|
||||
IAR_LD_FILE = $(ST_CMSIS)/Source/Templates/iar/linker/stm32f746xx_flash.icf
|
||||
|
||||
# flash target using on-board stlink
|
||||
flash: flash-stlink
|
||||
|
@ -5,8 +5,13 @@ CFLAGS += \
|
||||
-DSTM32F746xx \
|
||||
-DHSE_VALUE=8000000
|
||||
|
||||
LD_FILE = $(BOARD_PATH)/STM32F746ZGTx_FLASH.ld
|
||||
SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32f746xx.s
|
||||
# GCC
|
||||
GCC_LD_FILE = $(BOARD_PATH)/STM32F746ZGTx_FLASH.ld
|
||||
GCC_SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32f746xx.s
|
||||
|
||||
# IAR
|
||||
IAR_SRC_S += $(ST_CMSIS)/Source/Templates/iar/startup_stm32f746xx.s
|
||||
IAR_LD_FILE = $(ST_CMSIS)/Source/Templates/iar/linker/stm32f746xx_flash.icf
|
||||
|
||||
# flash target using on-board stlink
|
||||
flash: flash-stlink
|
||||
|
@ -5,8 +5,13 @@ CFLAGS += \
|
||||
-DSTM32F767xx \
|
||||
-DHSE_VALUE=8000000 \
|
||||
|
||||
LD_FILE = $(BOARD_PATH)/STM32F767ZITx_FLASH.ld
|
||||
SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32f767xx.s
|
||||
# GCC
|
||||
GCC_LD_FILE = $(BOARD_PATH)/STM32F767ZITx_FLASH.ld
|
||||
GCC_SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32f767xx.s
|
||||
|
||||
# IAR
|
||||
IAR_SRC_S += $(ST_CMSIS)/Source/Templates/iar/startup_stm32f767xx.s
|
||||
IAR_LD_FILE = $(ST_CMSIS)/Source/Templates/iar/linker/stm32f767xx_flash.icf
|
||||
|
||||
# For flash-jlink target
|
||||
JLINK_DEVICE = stm32f767zi
|
||||
|
@ -6,8 +6,13 @@ CFLAGS += \
|
||||
-DSTM32F769xx \
|
||||
-DHSE_VALUE=25000000 \
|
||||
|
||||
LD_FILE = $(BOARD_PATH)/STM32F769ZITx_FLASH.ld
|
||||
SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32f769xx.s
|
||||
# GCC
|
||||
GCC_LD_FILE = $(BOARD_PATH)/STM32F769ZITx_FLASH.ld
|
||||
GCC_SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32f769xx.s
|
||||
|
||||
# IAR
|
||||
IAR_SRC_S += $(ST_CMSIS)/Source/Templates/iar/startup_stm32f769xx.s
|
||||
IAR_LD_FILE = $(ST_CMSIS)/Source/Templates/iar/linker/stm32f769xx_flash.icf
|
||||
|
||||
# flash target using on-board stlink
|
||||
flash: flash-stlink
|
||||
|
@ -268,7 +268,8 @@ void board_init(void)
|
||||
|
||||
void board_led_write(bool state)
|
||||
{
|
||||
HAL_GPIO_WritePin(LED_PORT, LED_PIN, state ? LED_STATE_ON : (1-LED_STATE_ON));
|
||||
GPIO_PinState pin_state = (GPIO_PinState) (state ? LED_STATE_ON : (1-LED_STATE_ON));
|
||||
HAL_GPIO_WritePin(LED_PORT, LED_PIN, pin_state);
|
||||
}
|
||||
|
||||
uint32_t board_button_read(void)
|
||||
@ -303,7 +304,7 @@ uint32_t board_millis(void)
|
||||
|
||||
void HardFault_Handler (void)
|
||||
{
|
||||
asm("bkpt");
|
||||
__asm("BKPT #0\n");
|
||||
}
|
||||
|
||||
// Required by __libc_init_array in startup code if we are compiling using
|
||||
|
@ -7,14 +7,10 @@ ST_HAL_DRIVER = hw/mcu/st/stm32$(ST_FAMILY)xx_hal_driver
|
||||
|
||||
include $(TOP)/$(BOARD_PATH)/board.mk
|
||||
|
||||
# --------------
|
||||
# Compiler Flags
|
||||
# --------------
|
||||
CFLAGS += \
|
||||
-flto \
|
||||
-mthumb \
|
||||
-mabi=aapcs \
|
||||
-mcpu=cortex-m7 \
|
||||
-mfloat-abi=hard \
|
||||
-mfpu=fpv5-d16 \
|
||||
-nostdlib -nostartfiles \
|
||||
-DCFG_TUSB_MCU=OPT_MCU_STM32F7 \
|
||||
-DBOARD_TUD_RHPORT=$(PORT)
|
||||
|
||||
@ -30,8 +26,26 @@ else
|
||||
$(info "Using OTG_FS")
|
||||
endif
|
||||
|
||||
# GCC Flags
|
||||
GCC_CFLAGS += \
|
||||
-flto \
|
||||
-mthumb \
|
||||
-mabi=aapcs \
|
||||
-mcpu=cortex-m7 \
|
||||
-mfloat-abi=hard \
|
||||
-mfpu=fpv5-d16 \
|
||||
-nostdlib -nostartfiles
|
||||
|
||||
# mcu driver cause following warnings
|
||||
CFLAGS += -Wno-error=shadow -Wno-error=cast-align
|
||||
GCC_CFLAGS += -Wno-error=shadow -Wno-error=cast-align
|
||||
|
||||
# IAR Flags
|
||||
IAR_CFLAGS += --cpu cortex-m7 --fpu VFPv5_D16
|
||||
IAR_ASFLAGS += --cpu cortex-m7 --fpu VFPv5_D16
|
||||
|
||||
# -----------------
|
||||
# Sources & Include
|
||||
# -----------------
|
||||
|
||||
SRC_C += \
|
||||
src/portable/synopsys/dwc2/dcd_dwc2.c \
|
||||
|
@ -2,9 +2,13 @@ CFLAGS += \
|
||||
-DSTM32G474xx \
|
||||
-DHSE_VALUE=24000000
|
||||
|
||||
LD_FILE = $(BOARD_PATH)/STM32G474RETx_FLASH.ld
|
||||
# GCC
|
||||
GCC_SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32g474xx.s
|
||||
GCC_LD_FILE = $(BOARD_PATH)/STM32G474RETx_FLASH.ld
|
||||
|
||||
SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32g474xx.s
|
||||
# IAR
|
||||
IAR_SRC_S += $(ST_CMSIS)/Source/Templates/iar/startup_stm32g474xx.s
|
||||
IAR_LD_FILE = $(ST_CMSIS)/Source/Templates/iar/linker/stm32g474xx_flash.icf
|
||||
|
||||
# For flash-jlink target
|
||||
JLINK_DEVICE = stm32g474re
|
||||
|
@ -137,7 +137,8 @@ void board_init(void)
|
||||
|
||||
void board_led_write(bool state)
|
||||
{
|
||||
HAL_GPIO_WritePin(LED_PORT, LED_PIN, state ? LED_STATE_ON : (1-LED_STATE_ON));
|
||||
GPIO_PinState pin_state = (GPIO_PinState) (state ? LED_STATE_ON : (1-LED_STATE_ON));
|
||||
HAL_GPIO_WritePin(LED_PORT, LED_PIN, pin_state);
|
||||
}
|
||||
|
||||
uint32_t board_button_read(void)
|
||||
@ -177,7 +178,7 @@ uint32_t board_millis(void)
|
||||
|
||||
void HardFault_Handler (void)
|
||||
{
|
||||
asm("bkpt");
|
||||
__asm("BKPT #0\n");
|
||||
}
|
||||
|
||||
// Required by __libc_init_array in startup code if we are compiling using
|
||||
|
@ -7,7 +7,14 @@ ST_HAL_DRIVER = hw/mcu/st/stm32$(ST_FAMILY)xx_hal_driver
|
||||
|
||||
include $(TOP)/$(BOARD_PATH)/board.mk
|
||||
|
||||
# --------------
|
||||
# Compiler Flags
|
||||
# --------------
|
||||
CFLAGS += \
|
||||
-DCFG_TUSB_MCU=OPT_MCU_STM32G4
|
||||
|
||||
# GCC Flags
|
||||
GCC_CFLAGS += \
|
||||
-flto \
|
||||
-mthumb \
|
||||
-mabi=aapcs \
|
||||
@ -15,10 +22,17 @@ CFLAGS += \
|
||||
-mfloat-abi=hard \
|
||||
-mfpu=fpv4-sp-d16 \
|
||||
-nostdlib -nostartfiles \
|
||||
-DCFG_TUSB_MCU=OPT_MCU_STM32G4
|
||||
|
||||
# suppress warning caused by vendor mcu driver
|
||||
CFLAGS += -Wno-error=cast-align
|
||||
GCC_CFLAGS += -Wno-error=cast-align
|
||||
|
||||
# IAR Flags
|
||||
IAR_CFLAGS += --cpu cortex-m4 --fpu VFPv4
|
||||
IAR_ASFLAGS += --cpu cortex-m4 --fpu VFPv4
|
||||
|
||||
# -----------------
|
||||
# Sources & Include
|
||||
# -----------------
|
||||
|
||||
SRC_C += \
|
||||
src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c \
|
||||
|
@ -3,8 +3,13 @@ CFLAGS += -DSTM32H750xx -DCORE_CM7 -DHSE_VALUE=16000000
|
||||
# Default is FulSpeed port
|
||||
PORT ?= 0
|
||||
|
||||
SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32h750xx.s
|
||||
LD_FILE = $(BOARD_PATH)/stm32h750ibkx_flash.ld
|
||||
# GCC
|
||||
GCC_SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32h750xx.s
|
||||
GCC_LD_FILE = $(BOARD_PATH)/stm32h750ibkx_flash.ld
|
||||
|
||||
# IAR
|
||||
IAR_SRC_S += $(ST_CMSIS)/Source/Templates/iar/startup_stm32h750xx.s
|
||||
IAR_LD_FILE = $(ST_CMSIS)/Source/Templates/iar/linker/stm32h750xx_flash.icf
|
||||
|
||||
# For flash-jlink target
|
||||
JLINK_DEVICE = stm32h750ibk6_m7
|
||||
|
@ -3,8 +3,13 @@ CFLAGS += -DSTM32H723xx -DHSE_VALUE=8000000
|
||||
# Default is FulSpeed port
|
||||
PORT ?= 0
|
||||
|
||||
SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32h723xx.s
|
||||
LD_FILE = $(BOARD_PATH)/stm32h723xx_flash.ld
|
||||
# GCC
|
||||
GCC_SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32h723xx.s
|
||||
GCC_LD_FILE = $(BOARD_PATH)/stm32h723xx_flash.ld
|
||||
|
||||
# IAR
|
||||
IAR_SRC_S += $(ST_CMSIS)/Source/Templates/iar/startup_stm32h723xx.s
|
||||
IAR_LD_FILE = $(ST_CMSIS)/Source/Templates/iar/linker/stm32h723xx_flash.icf
|
||||
|
||||
# For flash-jlink target
|
||||
JLINK_DEVICE = stm32h723zg
|
||||
|
@ -4,8 +4,13 @@ CFLAGS += -DSTM32H743xx -DHSE_VALUE=25000000
|
||||
PORT ?= 1
|
||||
SPEED ?= high
|
||||
|
||||
SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32h743xx.s
|
||||
LD_FILE = $(BOARD_PATH)/stm32h743xx_flash.ld
|
||||
# GCC
|
||||
GCC_SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32h743xx.s
|
||||
GCC_LD_FILE = $(BOARD_PATH)/stm32h743xx_flash.ld
|
||||
|
||||
# IAR
|
||||
IAR_SRC_S += $(ST_CMSIS)/Source/Templates/iar/startup_stm32h743xx.s
|
||||
IAR_LD_FILE = $(ST_CMSIS)/Source/Templates/iar/linker/stm32h743xx_flash.icf
|
||||
|
||||
# For flash-jlink target
|
||||
JLINK_DEVICE = stm32h743xi
|
||||
|
@ -3,8 +3,13 @@ CFLAGS += -DSTM32H743xx -DHSE_VALUE=8000000
|
||||
# Default is FulSpeed port
|
||||
PORT ?= 0
|
||||
|
||||
SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32h743xx.s
|
||||
LD_FILE = $(BOARD_PATH)/stm32h743xx_flash.ld
|
||||
# GCC
|
||||
GCC_SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32h743xx.s
|
||||
GCC_LD_FILE = $(BOARD_PATH)/stm32h743xx_flash.ld
|
||||
|
||||
# IAR
|
||||
IAR_SRC_S += $(ST_CMSIS)/Source/Templates/iar/startup_stm32h743xx.s
|
||||
IAR_LD_FILE = $(ST_CMSIS)/Source/Templates/iar/linker/stm32h743xx_flash.icf
|
||||
|
||||
# For flash-jlink target
|
||||
JLINK_DEVICE = stm32h743zi
|
||||
|
@ -6,8 +6,13 @@ CFLAGS += -DSTM32H745xx -DCORE_CM7 -DHSE_VALUE=25000000
|
||||
# Default is FulSpeed port
|
||||
PORT ?= 0
|
||||
|
||||
SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32h745xx.s
|
||||
LD_FILE = $(ST_CMSIS)/Source/Templates/gcc/linker/stm32h745xx_flash_CM7.ld
|
||||
# GCC
|
||||
GCC_SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32h745xx.s
|
||||
GCC_LD_FILE = $(ST_CMSIS)/Source/Templates/gcc/linker/stm32h745xx_flash_CM7.ld
|
||||
|
||||
# IAR
|
||||
IAR_SRC_S += $(ST_CMSIS)/Source/Templates/iar/startup_stm32h745xx.s
|
||||
IAR_LD_FILE = $(ST_CMSIS)/Source/Templates/iar/linker/stm32h745xx_flash_CM7.icf
|
||||
|
||||
# For flash-jlink target
|
||||
JLINK_DEVICE = stm32h745xi_m7
|
||||
|
@ -212,9 +212,9 @@ static inline void board_stm32h7_post_init(void)
|
||||
|
||||
// Reset PHY, change the delays as you see fit
|
||||
timer_board_delay(&tim2Handle, 5U);
|
||||
HAL_GPIO_WritePin(ULPI_RST_PORT, ULPI_RST_PIN, 1U);
|
||||
HAL_GPIO_WritePin(ULPI_RST_PORT, ULPI_RST_PIN, GPIO_PIN_SET);
|
||||
timer_board_delay(&tim2Handle, 20U);
|
||||
HAL_GPIO_WritePin(ULPI_RST_PORT, ULPI_RST_PIN, 0U);
|
||||
HAL_GPIO_WritePin(ULPI_RST_PORT, ULPI_RST_PIN, GPIO_PIN_RESET);
|
||||
timer_board_delay(&tim2Handle, 20U);
|
||||
|
||||
//Disable the timer used for delays
|
||||
|
@ -3,15 +3,20 @@ CFLAGS += -DSTM32H743xx -DHSE_VALUE=8000000
|
||||
# Default is HS port
|
||||
PORT ?= 1
|
||||
|
||||
SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32h743xx.s
|
||||
LD_FILE = $(BOARD_PATH)/STM32H743IITX_FLASH.ld
|
||||
|
||||
# Use Timer module for ULPI PHY reset
|
||||
CFLAGS += -DHAL_TIM_MODULE_ENABLED
|
||||
SRC_C += \
|
||||
$(ST_HAL_DRIVER)/Src/stm32$(ST_FAMILY)xx_hal_tim.c \
|
||||
$(ST_HAL_DRIVER)/Src/stm32$(ST_FAMILY)xx_hal_tim_ex.c
|
||||
|
||||
# GCC
|
||||
GCC_SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32h743xx.s
|
||||
GCC_LD_FILE = $(BOARD_PATH)/STM32H743IITX_FLASH.ld
|
||||
|
||||
# IAR
|
||||
IAR_SRC_S += $(ST_CMSIS)/Source/Templates/iar/startup_stm32h743xx.s
|
||||
IAR_LD_FILE = $(ST_CMSIS)/Source/Templates/iar/linker/stm32h743xx_flash.icf
|
||||
|
||||
# For flash-jlink target
|
||||
JLINK_DEVICE = stm32h743ii
|
||||
|
||||
|
@ -225,7 +225,8 @@ void board_init(void)
|
||||
|
||||
void board_led_write(bool state)
|
||||
{
|
||||
HAL_GPIO_WritePin(LED_PORT, LED_PIN, state ? LED_STATE_ON : (1-LED_STATE_ON));
|
||||
GPIO_PinState pin_state = (GPIO_PinState) (state ? LED_STATE_ON : (1-LED_STATE_ON));
|
||||
HAL_GPIO_WritePin(LED_PORT, LED_PIN, pin_state);
|
||||
}
|
||||
|
||||
uint32_t board_button_read(void)
|
||||
@ -261,7 +262,7 @@ uint32_t board_millis(void)
|
||||
|
||||
void HardFault_Handler(void)
|
||||
{
|
||||
asm("bkpt");
|
||||
__asm("BKPT #0\n");
|
||||
}
|
||||
|
||||
// Required by __libc_init_array in startup code if we are compiling using
|
||||
|
@ -7,14 +7,10 @@ ST_HAL_DRIVER = hw/mcu/st/stm32$(ST_FAMILY)xx_hal_driver
|
||||
|
||||
include $(TOP)/$(BOARD_PATH)/board.mk
|
||||
|
||||
# --------------
|
||||
# Compiler Flags
|
||||
# --------------
|
||||
CFLAGS += \
|
||||
-flto \
|
||||
-mthumb \
|
||||
-mabi=aapcs \
|
||||
-mcpu=cortex-m7 \
|
||||
-mfloat-abi=hard \
|
||||
-mfpu=fpv5-d16 \
|
||||
-nostdlib -nostartfiles \
|
||||
-DCFG_TUSB_MCU=OPT_MCU_STM32H7 \
|
||||
-DBOARD_TUD_RHPORT=$(PORT)
|
||||
|
||||
@ -30,10 +26,26 @@ else
|
||||
$(info "Using OTG_FS")
|
||||
endif
|
||||
|
||||
# suppress warning caused by vendor mcu driver
|
||||
CFLAGS += -Wno-error=maybe-uninitialized -Wno-error=cast-align
|
||||
# GCC Flags
|
||||
GCC_CFLAGS += \
|
||||
-flto \
|
||||
-mthumb \
|
||||
-mabi=aapcs \
|
||||
-mcpu=cortex-m7 \
|
||||
-mfloat-abi=hard \
|
||||
-mfpu=fpv5-d16 \
|
||||
-nostdlib -nostartfiles
|
||||
|
||||
# All source paths should be relative to the top level.
|
||||
# suppress warning caused by vendor mcu driver
|
||||
GCC_CFLAGS += -Wno-error=maybe-uninitialized -Wno-error=cast-align
|
||||
|
||||
# IAR Flags
|
||||
IAR_CFLAGS += --cpu cortex-m7 --fpu VFPv5_D16
|
||||
IAR_ASFLAGS += --cpu cortex-m7 --fpu VFPv5_D16
|
||||
|
||||
# -----------------
|
||||
# Sources & Include
|
||||
# -----------------
|
||||
|
||||
SRC_C += \
|
||||
src/portable/synopsys/dwc2/dcd_dwc2.c \
|
||||
|
@ -1,10 +1,13 @@
|
||||
CFLAGS += \
|
||||
-DSTM32L412xx \
|
||||
|
||||
# All source paths should be relative to the top level.
|
||||
LD_FILE = $(BOARD_PATH)/STM32L412KBUx_FLASH.ld
|
||||
# GCC
|
||||
GCC_SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32l412xx.s
|
||||
GCC_LD_FILE = $(BOARD_PATH)/STM32L412KBUx_FLASH.ld
|
||||
|
||||
SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32l412xx.s
|
||||
# IAR
|
||||
IAR_SRC_S += $(ST_CMSIS)/Source/Templates/iar/startup_stm32l412xx.s
|
||||
IAR_LD_FILE = $(ST_CMSIS)/Source/Templates/iar/linker/stm32l412xx_flash.icf
|
||||
|
||||
# For flash-jlink target
|
||||
JLINK_DEVICE = stm32l412kb
|
||||
|
@ -1,10 +1,13 @@
|
||||
CFLAGS += \
|
||||
-DSTM32L476xx \
|
||||
|
||||
# All source paths should be relative to the top level.
|
||||
LD_FILE = $(BOARD_PATH)/STM32L476VGTx_FLASH.ld
|
||||
# GCC
|
||||
GCC_SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32l476xx.s
|
||||
GCC_LD_FILE = $(BOARD_PATH)/STM32L476VGTx_FLASH.ld
|
||||
|
||||
SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32l476xx.s
|
||||
# IAR
|
||||
IAR_SRC_S += $(ST_CMSIS)/Source/Templates/iar/startup_stm32l476xx.s
|
||||
IAR_LD_FILE = $(ST_CMSIS)/Source/Templates/iar/linker/stm32l476xx_flash.icf
|
||||
|
||||
# For flash-jlink target
|
||||
JLINK_DEVICE = stm32l476vg
|
||||
|
@ -1,10 +1,13 @@
|
||||
CFLAGS += \
|
||||
-DSTM32L4P5xx \
|
||||
|
||||
# All source paths should be relative to the top level.
|
||||
LD_FILE = $(BOARD_PATH)/STM32L4P5ZGTX_FLASH.ld
|
||||
# GCC
|
||||
GCC_SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32l4p5xx.s
|
||||
GCC_LD_FILE = $(BOARD_PATH)/STM32L4P5ZGTX_FLASH.ld
|
||||
|
||||
SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32l4p5xx.s
|
||||
# IAR
|
||||
IAR_SRC_S += $(ST_CMSIS)/Source/Templates/iar/startup_stm32l4p5xx.s
|
||||
IAR_LD_FILE = $(ST_CMSIS)/Source/Templates/iar/linker/stm32l4p5xx_flash.icf
|
||||
|
||||
# For flash-jlink target
|
||||
JLINK_DEVICE = stm32l4p5zg
|
||||
|
@ -2,10 +2,13 @@ CFLAGS += \
|
||||
-DHSE_VALUE=8000000 \
|
||||
-DSTM32L4R5xx \
|
||||
|
||||
# All source paths should be relative to the top level.
|
||||
LD_FILE = $(BOARD_PATH)/STM32L4RXxI_FLASH.ld
|
||||
# GCC
|
||||
GCC_SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32l4r5xx.s
|
||||
GCC_LD_FILE = $(BOARD_PATH)/STM32L4RXxI_FLASH.ld
|
||||
|
||||
SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32l4r5xx.s
|
||||
# IAR
|
||||
IAR_SRC_S += $(ST_CMSIS)/Source/Templates/iar/startup_stm32l4r5xx.s
|
||||
IAR_LD_FILE = $(ST_CMSIS)/Source/Templates/iar/linker/stm32l4r5xx_flash.icf
|
||||
|
||||
# For flash-jlink target
|
||||
JLINK_DEVICE = stm32l4r5zi
|
||||
|
@ -179,7 +179,8 @@ void board_init(void)
|
||||
|
||||
void board_led_write(bool state)
|
||||
{
|
||||
HAL_GPIO_WritePin(LED_PORT, LED_PIN, state ? LED_STATE_ON : (1-LED_STATE_ON));
|
||||
GPIO_PinState pin_state = (GPIO_PinState) (state ? LED_STATE_ON : (1-LED_STATE_ON));
|
||||
HAL_GPIO_WritePin(LED_PORT, LED_PIN, pin_state);
|
||||
}
|
||||
|
||||
uint32_t board_button_read(void)
|
||||
@ -214,7 +215,7 @@ uint32_t board_millis(void)
|
||||
|
||||
void HardFault_Handler (void)
|
||||
{
|
||||
asm("bkpt 0x10");
|
||||
__asm("BKPT #0\n");
|
||||
}
|
||||
|
||||
// Required by __libc_init_array in startup code if we are compiling using
|
||||
|
@ -6,23 +6,36 @@ ST_HAL_DRIVER = hw/mcu/st/stm32$(ST_FAMILY)xx_hal_driver
|
||||
|
||||
include $(TOP)/$(BOARD_PATH)/board.mk
|
||||
|
||||
# --------------
|
||||
# Compiler Flags
|
||||
# --------------
|
||||
CFLAGS += \
|
||||
-DCFG_TUSB_MCU=OPT_MCU_STM32L4
|
||||
|
||||
# GCC Flags
|
||||
GCC_CFLAGS += \
|
||||
-flto \
|
||||
-mthumb \
|
||||
-mabi=aapcs \
|
||||
-mcpu=cortex-m4 \
|
||||
-mfloat-abi=hard \
|
||||
-mfpu=fpv4-sp-d16 \
|
||||
-nostdlib -nostartfiles \
|
||||
-DCFG_TUSB_MCU=OPT_MCU_STM32L4
|
||||
-nostdlib -nostartfiles
|
||||
|
||||
# suppress warning caused by vendor mcu driver
|
||||
CFLAGS += -Wno-error=maybe-uninitialized -Wno-error=cast-align
|
||||
GCC_CFLAGS += -Wno-error=maybe-uninitialized -Wno-error=cast-align
|
||||
|
||||
# IAR Flags
|
||||
IAR_CFLAGS += --cpu cortex-m4 --fpu VFPv4
|
||||
IAR_ASFLAGS += --cpu cortex-m4 --fpu VFPv4
|
||||
|
||||
# -----------------
|
||||
# Sources & Include
|
||||
# -----------------
|
||||
|
||||
#src/portable/st/synopsys/dcd_synopsys.c
|
||||
SRC_C += \
|
||||
src/portable/synopsys/dwc2/dcd_dwc2.c \
|
||||
src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c \
|
||||
src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c \
|
||||
$(ST_CMSIS)/Source/Templates/system_stm32$(ST_FAMILY)xx.c \
|
||||
$(ST_HAL_DRIVER)/Src/stm32$(ST_FAMILY)xx_hal.c \
|
||||
$(ST_HAL_DRIVER)/Src/stm32$(ST_FAMILY)xx_hal_cortex.c \
|
||||
|
@ -108,7 +108,7 @@ typedef struct TU_ATTR_PACKED {
|
||||
|
||||
/* video control interface */
|
||||
typedef struct TU_ATTR_PACKED {
|
||||
void const *beg; /* The head of the first video control interface descriptor */
|
||||
uint8_t const *beg; /* The head of the first video control interface descriptor */
|
||||
uint16_t len; /* Byte length of the descriptors */
|
||||
uint16_t cur; /* offset for current video control interface */
|
||||
uint8_t stm[CFG_TUD_VIDEO_STREAMING]; /* Indices of streaming interface */
|
||||
@ -174,7 +174,7 @@ static tusb_desc_vc_itf_t const* _get_desc_vc(videod_interface_t const *self)
|
||||
static tusb_desc_vs_itf_t const* _get_desc_vs(videod_streaming_interface_t const *self)
|
||||
{
|
||||
if (!self->desc.cur) return NULL;
|
||||
void const *desc = _videod_itf[self->index_vc].beg;
|
||||
uint8_t const *desc = _videod_itf[self->index_vc].beg;
|
||||
return (tusb_desc_vs_itf_t const*)(desc + self->desc.cur);
|
||||
}
|
||||
|
||||
@ -247,9 +247,9 @@ static void const* _next_desc_itf(void const *beg, void const *end)
|
||||
*
|
||||
* @return The pointer for interface descriptor.
|
||||
* @retval end did not found interface descriptor */
|
||||
static inline void const* _find_desc_itf(void const *beg, void const *end, uint_fast8_t itfnum, uint_fast8_t altnum)
|
||||
static inline uint8_t const* _find_desc_itf(void const *beg, void const *end, uint_fast8_t itfnum, uint_fast8_t altnum)
|
||||
{
|
||||
return _find_desc_3(beg, end, TUSB_DESC_INTERFACE, itfnum, altnum);
|
||||
return (uint8_t const*) _find_desc_3(beg, end, TUSB_DESC_INTERFACE, itfnum, altnum);
|
||||
}
|
||||
|
||||
/** Find the first endpoint descriptor belonging to the current interface descriptor.
|
||||
@ -275,7 +275,7 @@ static void const* _find_desc_ep(void const *beg, void const *end)
|
||||
static inline void const* _end_of_control_descriptor(void const *desc)
|
||||
{
|
||||
tusb_desc_vc_itf_t const *vc = (tusb_desc_vc_itf_t const *)desc;
|
||||
return desc + vc->std.bLength + vc->ctl.wTotalLength;
|
||||
return ((uint8_t const*) desc) + vc->std.bLength + tu_le16toh(vc->ctl.wTotalLength);
|
||||
}
|
||||
|
||||
/** Find the first entity descriptor with the entity ID
|
||||
@ -305,7 +305,7 @@ static void const* _find_desc_entity(void const *desc, uint_fast8_t entityid)
|
||||
static inline void const* _end_of_streaming_descriptor(void const *desc)
|
||||
{
|
||||
tusb_desc_vs_itf_t const *vs = (tusb_desc_vs_itf_t const *)desc;
|
||||
return desc + vs->std.bLength + vs->stm.wTotalLength;
|
||||
return ((uint8_t const*) desc) + vs->std.bLength + tu_le16toh(vs->stm.wTotalLength);
|
||||
}
|
||||
|
||||
/** Find the first format descriptor with the specified format number. */
|
||||
@ -581,8 +581,10 @@ static bool _negotiate_streaming_parameters(videod_streaming_interface_t const *
|
||||
static bool _close_vc_itf(uint8_t rhport, videod_interface_t *self)
|
||||
{
|
||||
tusb_desc_vc_itf_t const *vc = _get_desc_vc(self);
|
||||
|
||||
/* The next descriptor after the class-specific VC interface header descriptor. */
|
||||
void const *cur = (void const*)vc + vc->std.bLength + vc->ctl.bLength;
|
||||
void const *cur = (uint8_t const*)vc + vc->std.bLength + vc->ctl.bLength;
|
||||
|
||||
/* The end of the video control interface descriptor. */
|
||||
void const *end = _end_of_control_descriptor(vc);
|
||||
if (vc->std.bNumEndpoints) {
|
||||
@ -603,10 +605,11 @@ static bool _close_vc_itf(uint8_t rhport, videod_interface_t *self)
|
||||
static bool _open_vc_itf(uint8_t rhport, videod_interface_t *self, uint_fast8_t altnum)
|
||||
{
|
||||
TU_LOG2(" open VC %d\n", altnum);
|
||||
void const *beg = self->beg;
|
||||
void const *end = beg + self->len;
|
||||
uint8_t const *beg = self->beg;
|
||||
uint8_t const *end = beg + self->len;
|
||||
|
||||
/* The first descriptor is a video control interface descriptor. */
|
||||
void const *cur = _find_desc_itf(beg, end, _desc_itfnum(beg), altnum);
|
||||
uint8_t const *cur = _find_desc_itf(beg, end, _desc_itfnum(beg), altnum);
|
||||
TU_LOG2(" cur %d\n", cur - beg);
|
||||
TU_VERIFY(cur < end);
|
||||
|
||||
@ -616,7 +619,8 @@ static bool _open_vc_itf(uint8_t rhport, videod_interface_t *self, uint_fast8_t
|
||||
TU_ASSERT(vc->ctl.bInCollection <= CFG_TUD_VIDEO_STREAMING);
|
||||
|
||||
/* Update to point the end of the video control interface descriptor. */
|
||||
end = _end_of_control_descriptor(cur);
|
||||
end = _end_of_control_descriptor(cur);
|
||||
|
||||
/* Advance to the next descriptor after the class-specific VC interface header descriptor. */
|
||||
cur += vc->std.bLength + vc->ctl.bLength;
|
||||
TU_LOG2(" bNumEndpoints %d\n", vc->std.bNumEndpoints);
|
||||
@ -631,7 +635,7 @@ static bool _open_vc_itf(uint8_t rhport, videod_interface_t *self, uint_fast8_t
|
||||
/* Open the notification endpoint */
|
||||
TU_ASSERT(usbd_edpt_open(rhport, notif));
|
||||
}
|
||||
self->cur = (uint16_t) ((void const*)vc - beg);
|
||||
self->cur = (uint16_t) ((uint8_t const*)vc - beg);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -643,7 +647,7 @@ static bool _open_vs_itf(uint8_t rhport, videod_streaming_interface_t *stm, uint
|
||||
{
|
||||
uint_fast8_t i;
|
||||
TU_LOG2(" reopen VS %d\n", altnum);
|
||||
void const *desc = _videod_itf[stm->index_vc].beg;
|
||||
uint8_t const *desc = _videod_itf[stm->index_vc].beg;
|
||||
|
||||
/* Close endpoints of previous settings. */
|
||||
for (i = 0; i < TU_ARRAY_SIZE(stm->desc.ep); ++i) {
|
||||
@ -654,16 +658,18 @@ static bool _open_vs_itf(uint8_t rhport, videod_streaming_interface_t *stm, uint
|
||||
stm->desc.ep[i] = 0;
|
||||
TU_LOG2(" close EP%02x\n", ep_adr);
|
||||
}
|
||||
|
||||
/* clear transfer management information */
|
||||
stm->buffer = NULL;
|
||||
stm->bufsize = 0;
|
||||
stm->offset = 0;
|
||||
|
||||
/* Find a alternate interface */
|
||||
void const *beg = desc + stm->desc.beg;
|
||||
void const *end = desc + stm->desc.end;
|
||||
void const *cur = _find_desc_itf(beg, end, _desc_itfnum(beg), altnum);
|
||||
uint8_t const *beg = desc + stm->desc.beg;
|
||||
uint8_t const *end = desc + stm->desc.end;
|
||||
uint8_t const *cur = _find_desc_itf(beg, end, _desc_itfnum(beg), altnum);
|
||||
TU_VERIFY(cur < end);
|
||||
|
||||
uint_fast8_t numeps = ((tusb_desc_interface_t const *)cur)->bNumEndpoints;
|
||||
TU_ASSERT(numeps <= TU_ARRAY_SIZE(stm->desc.ep));
|
||||
stm->desc.cur = (uint16_t) (cur - desc); /* Save the offset of the new settings */
|
||||
@ -1043,7 +1049,6 @@ static int handle_video_stm_req(uint8_t rhport, uint8_t stage,
|
||||
|
||||
default: return VIDEO_ERROR_INVALID_REQUEST;
|
||||
}
|
||||
return VIDEO_ERROR_UNKNOWN;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
@ -1076,7 +1081,7 @@ bool tud_video_n_frame_xfer(uint_fast8_t ctl_idx, uint_fast8_t stm_idx, void *bu
|
||||
if (!stm || !stm->desc.ep[0] || stm->buffer) return false;
|
||||
|
||||
/* Find EP address */
|
||||
void const *desc = _videod_itf[stm->index_vc].beg;
|
||||
uint8_t const *desc = _videod_itf[stm->index_vc].beg;
|
||||
uint8_t ep_addr = 0;
|
||||
for (uint_fast8_t i = 0; i < CFG_TUD_VIDEO_STREAMING; ++i) {
|
||||
uint_fast16_t ofs_ep = stm->desc.ep[i];
|
||||
@ -1143,13 +1148,15 @@ uint16_t videod_open(uint8_t rhport, tusb_desc_interface_t const * itf_desc, uin
|
||||
}
|
||||
TU_ASSERT(ctl_idx < CFG_TUD_VIDEO, 0);
|
||||
|
||||
void const *end = (void const*)itf_desc + max_len;
|
||||
self->beg = itf_desc;
|
||||
uint8_t const *end = (uint8_t const*)itf_desc + max_len;
|
||||
self->beg = (uint8_t const*) itf_desc;
|
||||
self->len = max_len;
|
||||
|
||||
/*------------- Video Control Interface -------------*/
|
||||
TU_VERIFY(_open_vc_itf(rhport, self, 0), 0);
|
||||
tusb_desc_vc_itf_t const *vc = _get_desc_vc(self);
|
||||
uint_fast8_t bInCollection = vc->ctl.bInCollection;
|
||||
|
||||
/* Find the end of the video interface descriptor */
|
||||
void const *cur = _next_desc_itf(itf_desc, end);
|
||||
for (uint8_t stm_idx = 0; stm_idx < bInCollection; ++stm_idx) {
|
||||
@ -1200,7 +1207,7 @@ bool videod_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb_control_request_
|
||||
for (itf = 0; itf < CFG_TUD_VIDEO_STREAMING; ++itf) {
|
||||
videod_streaming_interface_t *stm = &_videod_streaming_itf[itf];
|
||||
if (!stm->desc.beg) continue;
|
||||
void const *desc = _videod_itf[stm->index_vc].beg;
|
||||
uint8_t const *desc = _videod_itf[stm->index_vc].beg;
|
||||
if (itfnum == _desc_itfnum(desc + stm->desc.beg)) break;
|
||||
}
|
||||
|
||||
@ -1226,7 +1233,7 @@ bool videod_xfer_cb(uint8_t rhport, uint8_t ep_addr, xfer_result_t result, uint3
|
||||
uint_fast16_t const ep_ofs = stm->desc.ep[0];
|
||||
if (!ep_ofs) continue;
|
||||
ctl = &_videod_itf[stm->index_vc];
|
||||
void const *desc = ctl->beg;
|
||||
uint8_t const *desc = ctl->beg;
|
||||
if (ep_addr == _desc_ep_addr(desc + ep_ofs)) break;
|
||||
}
|
||||
|
||||
|
@ -76,9 +76,9 @@
|
||||
* - ##__VA_ARGS__ is used to deal with 0 paramerter (swallows comma)
|
||||
*------------------------------------------------------------------*/
|
||||
#if !defined(__CCRX__)
|
||||
#define TU_ARGS_NUM(...) _TU_NARG(_0, ##__VA_ARGS__,_RSEQ_N())
|
||||
#define TU_ARGS_NUM(...) _TU_NARG(_0, ##__VA_ARGS__, _RSEQ_N())
|
||||
#else
|
||||
#define TU_ARGS_NUM(...) _TU_NARG(_0, __VA_ARGS__,_RSEQ_N())
|
||||
#define TU_ARGS_NUM(...) _TU_NARG(_0, __VA_ARGS__, _RSEQ_N())
|
||||
#endif
|
||||
|
||||
#define _TU_NARG(...) _GET_NTH_ARG(__VA_ARGS__)
|
||||
|
@ -543,22 +543,35 @@ TU_ATTR_ALWAYS_INLINE static inline const char *tu_edpt_type_str(tusb_xfer_type_
|
||||
//--------------------------------------------------------------------+
|
||||
// Descriptor helper
|
||||
//--------------------------------------------------------------------+
|
||||
|
||||
// return next descriptor
|
||||
TU_ATTR_ALWAYS_INLINE static inline uint8_t const * tu_desc_next(void const* desc)
|
||||
{
|
||||
uint8_t const* desc8 = (uint8_t const*) desc;
|
||||
return desc8 + desc8[DESC_OFFSET_LEN];
|
||||
}
|
||||
|
||||
// get descriptor type
|
||||
TU_ATTR_ALWAYS_INLINE static inline uint8_t tu_desc_type(void const* desc)
|
||||
{
|
||||
return ((uint8_t const*) desc)[DESC_OFFSET_TYPE];
|
||||
}
|
||||
|
||||
// get descriptor length
|
||||
TU_ATTR_ALWAYS_INLINE static inline uint8_t tu_desc_len(void const* desc)
|
||||
{
|
||||
return ((uint8_t const*) desc)[DESC_OFFSET_LEN];
|
||||
}
|
||||
|
||||
// find descriptor that match byte1 (type)
|
||||
uint8_t const * tu_desc_find(uint8_t const* desc, uint8_t const* end, uint8_t byte1);
|
||||
|
||||
// find descriptor that match byte1 (type) and byte2
|
||||
uint8_t const * tu_desc_find2(uint8_t const* desc, uint8_t const* end, uint8_t byte1, uint8_t byte2);
|
||||
|
||||
// find descriptor that match byte1 (type) and byte2
|
||||
uint8_t const * tu_desc_find3(uint8_t const* desc, uint8_t const* end, uint8_t byte1, uint8_t byte2, uint8_t byte3);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
35
src/tusb.c
35
src/tusb.c
@ -73,6 +73,41 @@ bool tusb_inited(void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// Descriptor helper
|
||||
//--------------------------------------------------------------------+
|
||||
|
||||
uint8_t const * tu_desc_find(uint8_t const* desc, uint8_t const* end, uint8_t byte1)
|
||||
{
|
||||
while(desc+1 < end)
|
||||
{
|
||||
if ( desc[1] == byte1 ) return desc;
|
||||
desc += desc[DESC_OFFSET_LEN];
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
uint8_t const * tu_desc_find2(uint8_t const* desc, uint8_t const* end, uint8_t byte1, uint8_t byte2)
|
||||
{
|
||||
while(desc+2 < end)
|
||||
{
|
||||
if ( desc[1] == byte1 && desc[2] == byte2) return desc;
|
||||
desc += desc[DESC_OFFSET_LEN];
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
uint8_t const * tu_desc_find3(uint8_t const* desc, uint8_t const* end, uint8_t byte1, uint8_t byte2, uint8_t byte3)
|
||||
{
|
||||
while(desc+3 < end)
|
||||
{
|
||||
if (desc[1] == byte1 && desc[2] == byte2 && desc[3] == byte3) return desc;
|
||||
desc += desc[DESC_OFFSET_LEN];
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// Endpoint Helper for both Host and Device stack
|
||||
//--------------------------------------------------------------------+
|
||||
|
@ -27,9 +27,6 @@
|
||||
#ifndef _TUSB_OPTION_H_
|
||||
#define _TUSB_OPTION_H_
|
||||
|
||||
// To avoid GCC compiler warnings when -pedantic option is used (strict ISO C)
|
||||
typedef int make_iso_compilers_happy;
|
||||
|
||||
#include "common/tusb_compiler.h"
|
||||
|
||||
#define TUSB_VERSION_MAJOR 0
|
||||
@ -435,6 +432,9 @@ typedef int make_iso_compilers_happy;
|
||||
#error Control Endpoint Max Packet Size cannot be larger than 64
|
||||
#endif
|
||||
|
||||
// To avoid GCC compiler warnings when -pedantic option is used (strict ISO C)
|
||||
typedef int make_iso_compilers_happy;
|
||||
|
||||
#endif /* _TUSB_OPTION_H_ */
|
||||
|
||||
/** @} */
|
||||
|
82
test/unit-test/test/test_common_func.c
Normal file
82
test/unit-test/test/test_common_func.c
Normal file
@ -0,0 +1,82 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2023, Ha Thach (tinyusb.org)
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* This file is part of the TinyUSB stack.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include "unity.h"
|
||||
|
||||
#include "tusb_common.h"
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// MACRO TYPEDEF CONSTANT ENUM DECLARATION
|
||||
//--------------------------------------------------------------------+
|
||||
|
||||
|
||||
//------------- IMPLEMENTATION -------------//
|
||||
|
||||
void setUp(void)
|
||||
{
|
||||
}
|
||||
|
||||
void tearDown(void)
|
||||
{
|
||||
}
|
||||
|
||||
void test_TU_ARGS_NUM(void)
|
||||
{
|
||||
TEST_ASSERT_EQUAL( 0, TU_ARGS_NUM());
|
||||
TEST_ASSERT_EQUAL( 1, TU_ARGS_NUM(a1));
|
||||
TEST_ASSERT_EQUAL( 2, TU_ARGS_NUM(a1, a2));
|
||||
TEST_ASSERT_EQUAL( 3, TU_ARGS_NUM(a1, a2, a3));
|
||||
TEST_ASSERT_EQUAL( 4, TU_ARGS_NUM(a1, a2, a3, a4));
|
||||
TEST_ASSERT_EQUAL( 5, TU_ARGS_NUM(a1, a2, a3, a4, a5));
|
||||
TEST_ASSERT_EQUAL( 6, TU_ARGS_NUM(a1, a2, a3, a4, a5, a6));
|
||||
TEST_ASSERT_EQUAL( 7, TU_ARGS_NUM(a1, a2, a3, a4, a5, a6, a7));
|
||||
TEST_ASSERT_EQUAL( 8, TU_ARGS_NUM(a1, a2, a3, a4, a5, a6, a7, a8));
|
||||
TEST_ASSERT_EQUAL( 9, TU_ARGS_NUM(a1, a2, a3, a4, a5, a6, a7, a8, a9));
|
||||
TEST_ASSERT_EQUAL(10, TU_ARGS_NUM(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10));
|
||||
TEST_ASSERT_EQUAL(11, TU_ARGS_NUM(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11));
|
||||
TEST_ASSERT_EQUAL(12, TU_ARGS_NUM(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12));
|
||||
TEST_ASSERT_EQUAL(13, TU_ARGS_NUM(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13));
|
||||
TEST_ASSERT_EQUAL(14, TU_ARGS_NUM(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14));
|
||||
TEST_ASSERT_EQUAL(15, TU_ARGS_NUM(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15));
|
||||
TEST_ASSERT_EQUAL(16, TU_ARGS_NUM(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16));
|
||||
TEST_ASSERT_EQUAL(17, TU_ARGS_NUM(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17));
|
||||
TEST_ASSERT_EQUAL(18, TU_ARGS_NUM(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18));
|
||||
TEST_ASSERT_EQUAL(19, TU_ARGS_NUM(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19));
|
||||
TEST_ASSERT_EQUAL(20, TU_ARGS_NUM(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20));
|
||||
TEST_ASSERT_EQUAL(21, TU_ARGS_NUM(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21));
|
||||
TEST_ASSERT_EQUAL(22, TU_ARGS_NUM(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22));
|
||||
TEST_ASSERT_EQUAL(23, TU_ARGS_NUM(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23));
|
||||
TEST_ASSERT_EQUAL(24, TU_ARGS_NUM(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24));
|
||||
TEST_ASSERT_EQUAL(25, TU_ARGS_NUM(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, a25));
|
||||
TEST_ASSERT_EQUAL(26, TU_ARGS_NUM(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, a25, a26));
|
||||
TEST_ASSERT_EQUAL(27, TU_ARGS_NUM(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, a25, a26, a27));
|
||||
TEST_ASSERT_EQUAL(28, TU_ARGS_NUM(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, a25, a26, a27, a28));
|
||||
TEST_ASSERT_EQUAL(29, TU_ARGS_NUM(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, a25, a26, a27, a28, a29));
|
||||
TEST_ASSERT_EQUAL(30, TU_ARGS_NUM(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, a25, a26, a27, a28, a29, a30));
|
||||
TEST_ASSERT_EQUAL(31, TU_ARGS_NUM(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, a25, a26, a27, a28, a29, a30, a31));
|
||||
TEST_ASSERT_EQUAL(32, TU_ARGS_NUM(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, a25, a26, a27, a28, a29, a30, a31, a32));
|
||||
}
|
@ -52,7 +52,7 @@ if __name__ == '__main__':
|
||||
for example in all_examples:
|
||||
print(build_separator)
|
||||
with Pool(processes=os.cpu_count()) as pool:
|
||||
pool_args = list((map(lambda b, e=example: [e, b], all_boards)))
|
||||
pool_args = list((map(lambda b, e=example, o='': [e, b, o], all_boards)))
|
||||
result = pool.starmap(build_utils.build_example, pool_args)
|
||||
# sum all element of same index (column sum)
|
||||
result = list(map(sum, list(zip(*result))))
|
||||
|
@ -11,6 +11,7 @@ SKIPPED = "\033[33mskipped\033[0m"
|
||||
|
||||
build_separator = '-' * 106
|
||||
|
||||
make_iar_option = 'CC=iccarm'
|
||||
|
||||
def filter_with_input(mylist):
|
||||
if len(sys.argv) > 1:
|
||||
@ -19,7 +20,7 @@ def filter_with_input(mylist):
|
||||
mylist[:] = input_args
|
||||
|
||||
|
||||
def build_family(example, family):
|
||||
def build_family(example, family, make_option):
|
||||
all_boards = []
|
||||
for entry in os.scandir("hw/bsp/{}/boards".format(family)):
|
||||
if entry.is_dir() and entry.name != 'pico_sdk':
|
||||
@ -28,13 +29,17 @@ def build_family(example, family):
|
||||
all_boards.sort()
|
||||
|
||||
with Pool(processes=os.cpu_count()) as pool:
|
||||
pool_args = list((map(lambda b, e=example: [e, b], all_boards)))
|
||||
pool_args = list((map(lambda b, e=example, o=make_option: [e, b, o], all_boards)))
|
||||
result = pool.starmap(build_utils.build_example, pool_args)
|
||||
# sum all element of same index (column sum)
|
||||
return list(map(sum, list(zip(*result))))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
# IAR CC
|
||||
if make_iar_option not in sys.argv:
|
||||
make_iar_option = ''
|
||||
|
||||
# If examples are not specified in arguments, build all
|
||||
all_examples = []
|
||||
for dir1 in os.scandir("examples"):
|
||||
@ -62,7 +67,7 @@ if __name__ == '__main__':
|
||||
for example in all_examples:
|
||||
print(build_separator)
|
||||
for family in all_families:
|
||||
fret = build_family(example, family)
|
||||
fret = build_family(example, family, make_iar_option)
|
||||
total_result = list(map(lambda x, y: x + y, total_result, fret))
|
||||
|
||||
total_time = time.monotonic() - total_time
|
||||
|
@ -77,7 +77,7 @@ def skip_example(example, board):
|
||||
return False
|
||||
|
||||
|
||||
def build_example(example, board):
|
||||
def build_example(example, board, make_option):
|
||||
start_time = time.monotonic()
|
||||
flash_size = "-"
|
||||
sram_size = "-"
|
||||
@ -91,14 +91,14 @@ def build_example(example, board):
|
||||
ret[2] = 1
|
||||
print(build_format.format(example, board, status, '-', flash_size, sram_size))
|
||||
else:
|
||||
build_result = subprocess.run("make -j -C examples/{} BOARD={} all".format(example, board), shell=True,
|
||||
build_result = subprocess.run("make -j -C examples/{} BOARD={} {} all".format(example, board, make_option), shell=True,
|
||||
stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||
|
||||
if build_result.returncode == 0:
|
||||
status = SUCCEEDED
|
||||
ret[0] = 1
|
||||
(flash_size, sram_size) = build_size(example, board)
|
||||
subprocess.run("make -j -C examples/{} BOARD={} copy-artifact".format(example, board), shell=True,
|
||||
subprocess.run("make -j -C examples/{} BOARD={} {} copy-artifact".format(example, board, make_option), shell=True,
|
||||
stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||
else:
|
||||
status = FAILED
|
||||
|
Loading…
x
Reference in New Issue
Block a user