Skip to content

Commit 13a8afa

Browse files
committed
Merge branch 'master' of https://github.com/RT-Thread/rt-thread
2 parents f93fb14 + 33cb916 commit 13a8afa

File tree

20 files changed

+201
-360
lines changed

20 files changed

+201
-360
lines changed

bsp/stm32f10x-HAL/applications/main.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
/*
2-
* File : main.c
3-
* This file is part of RT-Thread RTOS
4-
* COPYRIGHT (C) 2009, RT-Thread Development Team
2+
* Copyright (c) 2006-2018, RT-Thread Development Team
53
*
6-
* The license and distribution terms for this file may be
7-
* found in the file LICENSE in this distribution or at
8-
* http://www.rt-thread.org/license/LICENSE
4+
* SPDX-License-Identifier: Apache-2.0
95
*
106
* Change Logs:
117
* Date Author Notes

bsp/stm32f10x-HAL/drivers/board.c

Lines changed: 51 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
/*
2-
* File : board.c
3-
* This file is part of RT-Thread RTOS
4-
* COPYRIGHT (C) 2009 RT-Thread Develop Team
2+
* Copyright (c) 2006-2018, RT-Thread Development Team
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
55
*
6-
* The license and distribution terms for this file may be
7-
* found in the file LICENSE in this distribution or at
8-
* http://www.rt-thread.org/license/LICENSE
96
*
107
* Change Logs:
118
* Date Author Notes
@@ -47,6 +44,7 @@ void HAL_MspInit(void)
4744
__HAL_AFIO_REMAP_SWJ_NOJTAG();
4845
}
4946

47+
5048
void SystemClock_Config(void)
5149
{
5250
rt_err_t ret = RT_EOK;
@@ -63,7 +61,19 @@ void SystemClock_Config(void)
6361
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
6462
RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL9;
6563
ret = HAL_RCC_OscConfig(&RCC_OscInitStruct);
66-
RT_ASSERT(ret == HAL_OK);
64+
if(ret == HAL_TIMEOUT)
65+
{
66+
/* HSE timeout switch to HSI */
67+
rt_memset(&RCC_OscInitStruct, 0, sizeof(RCC_OscInitStruct));
68+
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
69+
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
70+
RCC_OscInitStruct.HSICalibrationValue = 16;
71+
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
72+
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI_DIV2;
73+
RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL16;
74+
ret = HAL_RCC_OscConfig(&RCC_OscInitStruct);
75+
RT_ASSERT(ret == HAL_OK);
76+
}
6777

6878
/* Initializes the CPU, AHB and APB busses clocks */
6979
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK |
@@ -103,6 +113,39 @@ void SystemClock_Config(void)
103113
#endif
104114
}
105115

116+
static void m3_m4_delay_us(rt_uint32_t us)
117+
{
118+
__IO uint32_t Delay = us * (SystemCoreClock / 8U / 1000000U);
119+
do
120+
{
121+
__NOP();
122+
}
123+
while (Delay --);
124+
}
125+
126+
void HAL_Delay(__IO uint32_t Delay)
127+
{
128+
m3_m4_delay_us(Delay * 10);
129+
}
130+
131+
extern __IO uint32_t uwTick;
132+
uint32_t HAL_GetTick(void)
133+
{
134+
HAL_Delay(1);
135+
uwTick ++;
136+
return uwTick;
137+
}
138+
139+
void HAL_SuspendTick(void)
140+
{
141+
/* we should not suspend tick */
142+
}
143+
144+
void HAL_ResumeTick(void)
145+
{
146+
/* we should not resume tick */
147+
}
148+
106149
/**
107150
* This is the timer interrupt service routine.
108151
*
@@ -111,6 +154,7 @@ void SysTick_Handler(void)
111154
{
112155
/* enter interrupt */
113156
rt_interrupt_enter();
157+
114158
HAL_IncTick();
115159
rt_tick_increase();
116160
/* leave interrupt */

bsp/stm32f10x-HAL/drivers/board.h

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
/*
2-
* File : board.h
3-
* This file is part of RT-Thread RTOS
4-
* COPYRIGHT (C) 2009, RT-Thread Development Team
2+
* Copyright (c) 2006-2018, RT-Thread Development Team
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
55
*
6-
* The license and distribution terms for this file may be
7-
* found in the file LICENSE in this distribution or at
8-
* http://www.rt-thread.org/license/LICENSE
96
*
107
* Change Logs:
118
* Date Author Notes

bsp/stm32f10x-HAL/drivers/drv_gpio.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
/*
2-
* File : drv_gpio.c
3-
* This file is part of RT-Thread RTOS
4-
* COPYRIGHT (C) 2015, RT-Thread Development Team
2+
* Copyright (c) 2006-2018, RT-Thread Development Team
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
55
*
6-
* The license and distribution terms for this file may be
7-
* found in the file LICENSE in this distribution or at
8-
* http://www.rt-thread.org/license/LICENSE
96
*
107
* Change Logs:
118
* Date Author Notes

bsp/stm32f10x-HAL/drivers/drv_gpio.h

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
/*
2-
* File : drv_gpio.h
3-
* This file is part of RT-Thread RTOS
4-
* COPYRIGHT (C) 2015, RT-Thread Development Team
2+
* Copyright (c) 2006-2018, RT-Thread Development Team
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
55
*
6-
* The license and distribution terms for this file may be
7-
* found in the file LICENSE in this distribution or at
8-
* http://www.rt-thread.org/license/LICENSE
96
*
107
* Change Logs:
118
* Date Author Notes

bsp/stm32f10x-HAL/drivers/drv_sdcard.c

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,8 @@
11
/*
2-
* File : drv_sdcard.c
3-
* This file is part of RT-Thread RTOS
4-
* COPYRIGHT (C) 2017, RT-Thread Development Team
2+
* Copyright (c) 2006-2018, RT-Thread Development Team
53
*
6-
* This program is free software; you can redistribute it and/or modify
7-
* it under the terms of the GNU General Public License as published by
8-
* the Free Software Foundation; either version 2 of the License, or
9-
* (at your option) any later version.
4+
* SPDX-License-Identifier: Apache-2.0
105
*
11-
* This program is distributed in the hope that it will be useful,
12-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14-
* GNU General Public License for more details.
15-
*
16-
* You should have received a copy of the GNU General Public License along
17-
* with this program; if not, write to the Free Software Foundation, Inc.,
18-
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
196
*
207
* Change Logs:
218
* Date Author Notes

bsp/stm32f10x-HAL/drivers/drv_sdcard.h

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,8 @@
11
/*
2-
* File : drv_sdcard.h
3-
* This file is part of RT-Thread RTOS
4-
* COPYRIGHT (C) 2017, RT-Thread Development Team
2+
* Copyright (c) 2006-2018, RT-Thread Development Team
53
*
6-
* This program is free software; you can redistribute it and/or modify
7-
* it under the terms of the GNU General Public License as published by
8-
* the Free Software Foundation; either version 2 of the License, or
9-
* (at your option) any later version.
4+
* SPDX-License-Identifier: Apache-2.0
105
*
11-
* This program is distributed in the hope that it will be useful,
12-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14-
* GNU General Public License for more details.
15-
*
16-
* You should have received a copy of the GNU General Public License along
17-
* with this program; if not, write to the Free Software Foundation, Inc.,
18-
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
196
*
207
* Change Logs:
218
* Date Author Notes

bsp/stm32f10x-HAL/drivers/drv_spi.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
/*
2-
* File : dev_gpio.c
3-
* This file is part of RT-Thread RTOS
4-
* COPYRIGHT (C) 2015, RT-Thread Development Team
2+
* Copyright (c) 2006-2018, RT-Thread Development Team
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
55
*
6-
* The license and distribution terms for this file may be
7-
* found in the file LICENSE in this distribution or at
8-
* http://www.rt-thread.org/license/LICENSE
96
*
107
* Change Logs:
118
* Date Author Notes

bsp/stm32f10x-HAL/drivers/drv_spi.h

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
/*
2-
* File : gpio.c
3-
* This file is part of RT-Thread RTOS
4-
* COPYRIGHT (C) 2015, RT-Thread Development Team
2+
* Copyright (c) 2006-2018, RT-Thread Development Team
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
55
*
6-
* The license and distribution terms for this file may be
7-
* found in the file LICENSE in this distribution or at
8-
* http://www.rt-thread.org/license/LICENSE
96
*
107
* Change Logs:
118
* Date Author Notes

bsp/stm32f10x-HAL/drivers/drv_usart.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
/*
2-
* File : drv_usart.c
3-
* This file is part of RT-Thread RTOS
4-
* COPYRIGHT (C) 2006-2013, RT-Thread Development Team
2+
* Copyright (c) 2006-2018, RT-Thread Development Team
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
55
*
6-
* The license and distribution terms for this file may be
7-
* found in the file LICENSE in this distribution or at
8-
* http://www.rt-thread.org/license/LICENSE
96
*
107
* Change Logs:
118
* Date Author Notes

0 commit comments

Comments
 (0)