Skip to content

Commit aceab1d

Browse files
authored
Merge branch 'hathach:master' into port-ft90x
2 parents 1437ad1 + 2ae6a4d commit aceab1d

File tree

13 files changed

+535
-28
lines changed

13 files changed

+535
-28
lines changed

examples/host/bare_api/CMakeLists.txt

-4
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,8 @@ if(FAMILY STREQUAL "rp2040")
3232

3333
# due to warnings from Pico-PIO-USB
3434
target_compile_options(${PROJECT} PUBLIC
35-
-Wno-error=shadow
36-
-Wno-error=cast-align
3735
-Wno-error=cast-qual
38-
-Wno-error=redundant-decls
3936
-Wno-error=sign-conversion
4037
-Wno-error=conversion
41-
-Wno-error=unused-function
4238
)
4339
endif()

examples/host/cdc_msc_hid/CMakeLists.txt

-4
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,8 @@ if(FAMILY STREQUAL "rp2040")
3434

3535
# due to warnings from Pico-PIO-USB
3636
target_compile_options(${PROJECT} PUBLIC
37-
-Wno-error=shadow
38-
-Wno-error=cast-align
3937
-Wno-error=cast-qual
40-
-Wno-error=redundant-decls
4138
-Wno-error=sign-conversion
4239
-Wno-error=conversion
43-
-Wno-error=unused-function
4440
)
4541
endif()

examples/host/hid_controller/CMakeLists.txt

-4
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,8 @@ if(FAMILY STREQUAL "rp2040")
3333

3434
# due to warnings from Pico-PIO-USB
3535
target_compile_options(${PROJECT} PUBLIC
36-
-Wno-error=shadow
37-
-Wno-error=cast-align
3836
-Wno-error=cast-qual
39-
-Wno-error=redundant-decls
4037
-Wno-error=sign-conversion
4138
-Wno-error=conversion
42-
-Wno-error=unused-function
4339
)
4440
endif()

examples/host/msc_file_explorer/CMakeLists.txt

-4
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,8 @@ if(FAMILY STREQUAL "rp2040")
3838

3939
# due to warnings from Pico-PIO-USB
4040
target_compile_options(${PROJECT} PUBLIC
41-
-Wno-error=shadow
42-
-Wno-error=cast-align
4341
-Wno-error=cast-qual
44-
-Wno-error=redundant-decls
4542
-Wno-error=sign-conversion
4643
-Wno-error=conversion
47-
-Wno-error=unused-function
4844
)
4945
endif()
+140
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
/*
2+
* The MIT License (MIT)
3+
*
4+
* Copyright (c) 2021, Ha Thach (tinyusb.org)
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in
14+
* all copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22+
* THE SOFTWARE.
23+
*
24+
* This file is part of the TinyUSB stack.
25+
*/
26+
27+
#ifndef BOARD_H_
28+
#define BOARD_H_
29+
30+
#ifdef __cplusplus
31+
extern "C" {
32+
#endif
33+
34+
#define LED_PORT GPIOC
35+
#define LED_PIN GPIO_PIN_7
36+
#define LED_STATE_ON 1
37+
38+
// Blue push-button
39+
#define BUTTON_PORT GPIOC
40+
#define BUTTON_PIN GPIO_PIN_13
41+
#define BUTTON_STATE_ACTIVE 1
42+
43+
// UART
44+
#define UART_DEV USART3
45+
#define UART_CLK_EN __HAL_RCC_USART3_CLK_ENABLE
46+
#define UART_GPIO_PORT GPIOB
47+
#define UART_GPIO_AF GPIO_AF7_USART3
48+
#define UART_TX_PIN GPIO_PIN_10
49+
#define UART_RX_PIN GPIO_PIN_11
50+
51+
// VBUS Sense detection
52+
#define OTG_FS_VBUS_SENSE 1
53+
#define OTG_HS_VBUS_SENSE 0
54+
55+
//--------------------------------------------------------------------+
56+
// RCC Clock
57+
//--------------------------------------------------------------------+
58+
static inline void board_stm32h7_clock_init(void)
59+
{
60+
RCC_ClkInitTypeDef RCC_ClkInitStruct;
61+
RCC_OscInitTypeDef RCC_OscInitStruct;
62+
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct;
63+
64+
/*!< Supply configuration update enable */
65+
/* For STM32H750XB, use "HAL_PWREx_ConfigSupply(PWR_LDO_SUPPLY);" */
66+
// HAL_PWREx_ConfigSupply(PWR_DIRECT_SMPS_SUPPLY);
67+
HAL_PWREx_ConfigSupply(PWR_LDO_SUPPLY);
68+
69+
/* The voltage scaling allows optimizing the power consumption when the
70+
device is clocked below the maximum system frequency, to update the
71+
voltage scaling value regarding system frequency refer to product
72+
datasheet. */
73+
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
74+
75+
while ((PWR->D3CR & (PWR_D3CR_VOSRDY)) != PWR_D3CR_VOSRDY) {}
76+
77+
/* Enable HSE Oscillator and activate PLL with HSE as source */
78+
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
79+
RCC_OscInitStruct.HSEState = RCC_HSE_BYPASS;
80+
RCC_OscInitStruct.HSIState = RCC_HSI_OFF;
81+
RCC_OscInitStruct.CSIState = RCC_CSI_OFF;
82+
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
83+
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
84+
85+
/* PLL1 for System Clock */
86+
RCC_OscInitStruct.PLL.PLLM = 5;
87+
RCC_OscInitStruct.PLL.PLLN = 160;
88+
RCC_OscInitStruct.PLL.PLLFRACN = 0;
89+
RCC_OscInitStruct.PLL.PLLP = 2;
90+
RCC_OscInitStruct.PLL.PLLR = 2;
91+
RCC_OscInitStruct.PLL.PLLQ = 4;
92+
93+
RCC_OscInitStruct.PLL.PLLVCOSEL = RCC_PLL1VCOMEDIUM;
94+
RCC_OscInitStruct.PLL.PLLRGE = RCC_PLL1VCIRANGE_2;
95+
HAL_RCC_OscConfig(&RCC_OscInitStruct);
96+
97+
/* PLL3 for USB Clock */
98+
PeriphClkInitStruct.PLL3.PLL3M = 25;
99+
PeriphClkInitStruct.PLL3.PLL3N = 336;
100+
PeriphClkInitStruct.PLL3.PLL3FRACN = 0;
101+
PeriphClkInitStruct.PLL3.PLL3P = 2;
102+
PeriphClkInitStruct.PLL3.PLL3R = 2;
103+
PeriphClkInitStruct.PLL3.PLL3Q = 7;
104+
105+
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_USB;
106+
PeriphClkInitStruct.UsbClockSelection = RCC_USBCLKSOURCE_PLL3;
107+
HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct);
108+
109+
/* Select PLL as system clock source and configure bus clocks dividers */
110+
RCC_ClkInitStruct.ClockType = (RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_D1PCLK1 | RCC_CLOCKTYPE_PCLK1 | \
111+
RCC_CLOCKTYPE_PCLK2 | RCC_CLOCKTYPE_D3PCLK1);
112+
113+
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
114+
RCC_ClkInitStruct.SYSCLKDivider = RCC_SYSCLK_DIV1;
115+
RCC_ClkInitStruct.AHBCLKDivider = RCC_HCLK_DIV2;
116+
RCC_ClkInitStruct.APB1CLKDivider = RCC_APB1_DIV2;
117+
RCC_ClkInitStruct.APB2CLKDivider = RCC_APB2_DIV2;
118+
RCC_ClkInitStruct.APB3CLKDivider = RCC_APB3_DIV1;
119+
HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_4);
120+
121+
/*activate CSI clock mondatory for I/O Compensation Cell*/
122+
__HAL_RCC_CSI_ENABLE() ;
123+
124+
/* Enable SYSCFG clock mondatory for I/O Compensation Cell */
125+
__HAL_RCC_SYSCFG_CLK_ENABLE() ;
126+
127+
/* Enables the I/O Compensation Cell */
128+
HAL_EnableCompensationCell();
129+
}
130+
131+
static inline void board_stm32h7_post_init(void)
132+
{
133+
// For this board does nothing
134+
}
135+
136+
#ifdef __cplusplus
137+
}
138+
#endif
139+
140+
#endif
+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
CFLAGS += -DSTM32H750xx -DCORE_CM7 -DHSE_VALUE=16000000
2+
3+
# Default is FulSpeed port
4+
PORT ?= 0
5+
6+
SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32h750xx.s
7+
LD_FILE = $(BOARD_PATH)/stm32h750ibkx_flash.ld
8+
9+
# For flash-jlink target
10+
JLINK_DEVICE = stm32h750ibk6_m7
11+
12+
# flash target using on-board stlink
13+
flash: flash-stlink
14+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
/*
2+
******************************************************************************
3+
**
4+
** File : LinkerScript.ld
5+
**
6+
** Author : STM32CubeIDE
7+
**
8+
** Abstract : Linker script for STM32H7 series
9+
** 128Kbytes FLASH and 1056Kbytes RAM
10+
**
11+
** Set heap size, stack size and stack location according
12+
** to application requirements.
13+
**
14+
** Set memory bank area and size if external memory is used.
15+
**
16+
** Target : STMicroelectronics STM32
17+
**
18+
** Distribution: The file is distributed as is, without any warranty
19+
** of any kind.
20+
**
21+
*****************************************************************************
22+
** @attention
23+
**
24+
** Copyright (c) 2022 STMicroelectronics.
25+
** All rights reserved.
26+
**
27+
** This software is licensed under terms that can be found in the LICENSE file
28+
** in the root directory of this software component.
29+
** If no LICENSE file comes with this software, it is provided AS-IS.
30+
**
31+
****************************************************************************
32+
*/
33+
34+
/* Entry Point */
35+
ENTRY(Reset_Handler)
36+
37+
/* Highest address of the user mode stack */
38+
_estack = ORIGIN(RAM_D1) + LENGTH(RAM_D1); /* end of RAM */
39+
/* Generate a link error if heap and stack don't fit into RAM */
40+
_Min_Heap_Size = 0x2000 ; /* required amount of heap */
41+
_Min_Stack_Size = 0x4000 ; /* required amount of stack */
42+
43+
/* Specify the memory areas */
44+
MEMORY
45+
{
46+
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 128K
47+
DTCMRAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K
48+
RAM_D1 (xrw) : ORIGIN = 0x24000000, LENGTH = 512K
49+
RAM_D2 (xrw) : ORIGIN = 0x30000000, LENGTH = 288K
50+
RAM_D3 (xrw) : ORIGIN = 0x38000000, LENGTH = 64K
51+
ITCMRAM (xrw) : ORIGIN = 0x00000000, LENGTH = 64K
52+
}
53+
54+
/* Define output sections */
55+
SECTIONS
56+
{
57+
/* The startup code goes first into FLASH */
58+
.isr_vector :
59+
{
60+
. = ALIGN(4);
61+
KEEP(*(.isr_vector)) /* Startup code */
62+
. = ALIGN(4);
63+
} >FLASH
64+
65+
/* The program code and other data goes into FLASH */
66+
.text :
67+
{
68+
. = ALIGN(4);
69+
*(.text) /* .text sections (code) */
70+
*(.text*) /* .text* sections (code) */
71+
*(.glue_7) /* glue arm to thumb code */
72+
*(.glue_7t) /* glue thumb to arm code */
73+
*(.eh_frame)
74+
75+
KEEP (*(.init))
76+
KEEP (*(.fini))
77+
78+
. = ALIGN(4);
79+
_etext = .; /* define a global symbols at end of code */
80+
} >FLASH
81+
82+
/* Constant data goes into FLASH */
83+
.rodata :
84+
{
85+
. = ALIGN(4);
86+
*(.rodata) /* .rodata sections (constants, strings, etc.) */
87+
*(.rodata*) /* .rodata* sections (constants, strings, etc.) */
88+
. = ALIGN(4);
89+
} >FLASH
90+
91+
.ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
92+
.ARM : {
93+
__exidx_start = .;
94+
*(.ARM.exidx*)
95+
__exidx_end = .;
96+
} >FLASH
97+
98+
.preinit_array :
99+
{
100+
PROVIDE_HIDDEN (__preinit_array_start = .);
101+
KEEP (*(.preinit_array*))
102+
PROVIDE_HIDDEN (__preinit_array_end = .);
103+
} >FLASH
104+
105+
.init_array :
106+
{
107+
PROVIDE_HIDDEN (__init_array_start = .);
108+
KEEP (*(SORT(.init_array.*)))
109+
KEEP (*(.init_array*))
110+
PROVIDE_HIDDEN (__init_array_end = .);
111+
} >FLASH
112+
113+
.fini_array :
114+
{
115+
PROVIDE_HIDDEN (__fini_array_start = .);
116+
KEEP (*(SORT(.fini_array.*)))
117+
KEEP (*(.fini_array*))
118+
PROVIDE_HIDDEN (__fini_array_end = .);
119+
} >FLASH
120+
121+
/* used by the startup to initialize data */
122+
_sidata = LOADADDR(.data);
123+
124+
/* Initialized data sections goes into RAM, load LMA copy after code */
125+
.data :
126+
{
127+
. = ALIGN(4);
128+
_sdata = .; /* create a global symbol at data start */
129+
*(.data) /* .data sections */
130+
*(.data*) /* .data* sections */
131+
*(.RamFunc) /* .RamFunc sections */
132+
*(.RamFunc*) /* .RamFunc* sections */
133+
134+
. = ALIGN(4);
135+
_edata = .; /* define a global symbol at data end */
136+
} >RAM_D1 AT> FLASH
137+
138+
/* Uninitialized data section */
139+
. = ALIGN(4);
140+
.bss :
141+
{
142+
/* This is used by the startup in order to initialize the .bss section */
143+
_sbss = .; /* define a global symbol at bss start */
144+
__bss_start__ = _sbss;
145+
*(.bss)
146+
*(.bss*)
147+
*(COMMON)
148+
149+
. = ALIGN(4);
150+
_ebss = .; /* define a global symbol at bss end */
151+
__bss_end__ = _ebss;
152+
} >RAM_D1
153+
154+
/* User_heap_stack section, used to check that there is enough RAM left */
155+
._user_heap_stack :
156+
{
157+
. = ALIGN(8);
158+
PROVIDE ( end = . );
159+
PROVIDE ( _end = . );
160+
. = . + _Min_Heap_Size;
161+
. = . + _Min_Stack_Size;
162+
. = ALIGN(8);
163+
} >RAM_D1
164+
165+
/* Remove information from the standard libraries */
166+
/DISCARD/ :
167+
{
168+
libc.a ( * )
169+
libm.a ( * )
170+
libgcc.a ( * )
171+
}
172+
173+
.ARM.attributes 0 : { *(.ARM.attributes) }
174+
}
175+
176+

0 commit comments

Comments
 (0)