Skip to content

Commit 1760889

Browse files
authored
Merge pull request #10 from yangjie11/nano315
同步 nano 3.1.5
2 parents 2188be0 + 51f16ef commit 1760889

File tree

435 files changed

+364105
-2423
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

435 files changed

+364105
-2423
lines changed

rt-thread/ChangeLog.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,56 @@
1+
# RT-Thread v3.1.5 Change Log
2+
3+
Change log since v3.1.3
4+
5+
## Kernel
6+
7+
- Fix the issue when block = NULL in rt_mp_free;
8+
- Fix the software issue when the system timer thread is pending
9+
- Fix the timer/software timer handling issue if the timeout function starts/stops/deletes this timer.
10+
- Fix an issue with rt_timer_start being broken and destroying the timer list
11+
- Fix bug of rt_memheap_detach
12+
- Fix the bug that the linked list is still mounted when the single timer is not modified
13+
- Fix the delay_until issue
14+
- Add mb mq value overflow-check code
15+
- Fix the rt_event_recv function, if the event met without blocking, assigning thread->event_set/event_info will goes well
16+
- Add the definition of the maximum value of ipc type
17+
- Fix the delay_until issue
18+
- fixed __rt_ffs bug on account of armclang LTO.
19+
- fixed rt_timer_list_next_timeout multi-task safe
20+
- fix the software issue when the system timer thread pending.
21+
- Fix the timer/software timer handling issue if the timeout function starts/stops/deletes this timer.
22+
- The cleanup operation is executed before the current thread exits
23+
- Modify cleanup to resolve the issue of unable to free memory and communication between threads
24+
- Fix double release for thread
25+
- Fix thread control bug about `RT_THREAD_CTRL_CLOSE` command
26+
- Fix the issue of critical protection when `rt_thread_delete` change the status of thread;
27+
- Fix bug in rt_realloc of mem.c, which may cause memory leak
28+
- Use object_find to implement thread_find/device_find
29+
- fix the timer code depends on c99
30+
- Split the component automatic initialization to component automatic initialization and main funciton;
31+
- Fix RT_IDLE_HOOK spelling issue;
32+
- Add thread waiting for message queue when queue is full;
33+
- Fix the issue of delete mq in `rt_mq_create` in some abnormal case;
34+
- Remove the C++ keywords in the`rt_console_set_device`function;
35+
- Remove the `suspend_thread_count` member from memory_pool structure;
36+
- Fix the issue when block = NULL in rt_mp_free;
37+
- Fix the issue of critical protection when `rt_thread_delete` change the status of thread;
38+
- update code style and license
39+
40+
## libcpu
41+
42+
- add cortex-m23
43+
- add cortex-m33
44+
45+
## components
46+
47+
- add device.c
48+
49+
## bsp
50+
51+
- add samples for gd32e230k-msh
52+
- add samples for lpc55s69-blink
53+
154
# RT-Thread v3.1.3 Change Log
255

356
## Kernel

rt-thread/bsp/_template/board.c

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
/*
2+
* Copyright (c) 2006-2019, RT-Thread Development Team
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*
6+
* Change Logs:
7+
* Date Author Notes
8+
* 2021-05-24 the first version
9+
*/
10+
11+
#include <rthw.h>
12+
#include <rtthread.h>
13+
14+
#if defined(RT_USING_USER_MAIN) && defined(RT_USING_HEAP)
15+
/*
16+
* Please modify RT_HEAP_SIZE if you enable RT_USING_HEAP
17+
* the RT_HEAP_SIZE max value = (sram size - ZI size), 1024 means 1024 bytes
18+
*/
19+
#define RT_HEAP_SIZE (15*1024)
20+
static rt_uint8_t rt_heap[RT_HEAP_SIZE];
21+
22+
RT_WEAK void *rt_heap_begin_get(void)
23+
{
24+
return rt_heap;
25+
}
26+
27+
RT_WEAK void *rt_heap_end_get(void)
28+
{
29+
return rt_heap + RT_HEAP_SIZE;
30+
}
31+
#endif
32+
33+
void rt_os_tick_callback(void)
34+
{
35+
rt_interrupt_enter();
36+
37+
rt_tick_increase();
38+
39+
rt_interrupt_leave();
40+
}
41+
42+
/**
43+
* This function will initial your board.
44+
*/
45+
void rt_hw_board_init(void)
46+
{
47+
#error "TODO 1: OS Tick Configuration."
48+
/*
49+
* TODO 1: OS Tick Configuration
50+
* Enable the hardware timer and call the rt_os_tick_callback function
51+
* periodically with the frequency RT_TICK_PER_SECOND.
52+
*/
53+
54+
/* Call components board initial (use INIT_BOARD_EXPORT()) */
55+
#ifdef RT_USING_COMPONENTS_INIT
56+
rt_components_board_init();
57+
#endif
58+
59+
#if defined(RT_USING_USER_MAIN) && defined(RT_USING_HEAP)
60+
rt_system_heap_init(rt_heap_begin_get(), rt_heap_end_get());
61+
#endif
62+
}
63+
64+
#ifdef RT_USING_CONSOLE
65+
66+
static int uart_init(void)
67+
{
68+
#error "TODO 2: Enable the hardware uart and config baudrate."
69+
return 0;
70+
}
71+
INIT_BOARD_EXPORT(uart_init);
72+
73+
void rt_hw_console_output(const char *str)
74+
{
75+
#error "TODO 3: Output the string 'str' through the uart."
76+
}
77+
78+
#endif
79+
Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
/*
2+
* Copyright (c) 2006-2019, RT-Thread Development Team
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*
6+
* Change Logs:
7+
* Date Author Notes
8+
* 2021-05-24 the first version
9+
*/
10+
11+
#include <rthw.h>
12+
#include <rtthread.h>
13+
14+
#include "main.h"
15+
16+
#if defined(RT_USING_USER_MAIN) && defined(RT_USING_HEAP)
17+
/*
18+
* Please modify RT_HEAP_SIZE if you enable RT_USING_HEAP
19+
* the RT_HEAP_SIZE max value = (sram size - ZI size), 1024 means 1024 bytes
20+
*/
21+
#define RT_HEAP_SIZE (15*1024)
22+
static rt_uint8_t rt_heap[RT_HEAP_SIZE];
23+
24+
RT_WEAK void *rt_heap_begin_get(void)
25+
{
26+
return rt_heap;
27+
}
28+
29+
RT_WEAK void *rt_heap_end_get(void)
30+
{
31+
return rt_heap + RT_HEAP_SIZE;
32+
}
33+
#endif
34+
35+
void SysTick_Handler(void)
36+
{
37+
rt_interrupt_enter();
38+
39+
rt_tick_increase();
40+
41+
rt_interrupt_leave();
42+
}
43+
44+
/**
45+
* This function will initial your board.
46+
*/
47+
void rt_hw_board_init(void)
48+
{
49+
extern void SystemClock_Config(void);
50+
51+
HAL_Init();
52+
SystemClock_Config();
53+
SystemCoreClockUpdate();
54+
/*
55+
* 1: OS Tick Configuration
56+
* Enable the hardware timer and call the rt_os_tick_callback function
57+
* periodically with the frequency RT_TICK_PER_SECOND.
58+
*/
59+
HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq()/RT_TICK_PER_SECOND);
60+
61+
/* Call components board initial (use INIT_BOARD_EXPORT()) */
62+
#ifdef RT_USING_COMPONENTS_INIT
63+
rt_components_board_init();
64+
#endif
65+
66+
#if defined(RT_USING_USER_MAIN) && defined(RT_USING_HEAP)
67+
rt_system_heap_init(rt_heap_begin_get(), rt_heap_end_get());
68+
#endif
69+
}
70+
71+
#ifdef RT_USING_CONSOLE
72+
73+
static UART_HandleTypeDef UartHandle;
74+
static int uart_init(void)
75+
{
76+
/* TODO: Please modify the UART port number according to your needs */
77+
UartHandle.Instance = USART2;
78+
UartHandle.Init.BaudRate = 115200;
79+
UartHandle.Init.WordLength = UART_WORDLENGTH_8B;
80+
UartHandle.Init.StopBits = UART_STOPBITS_1;
81+
UartHandle.Init.Parity = UART_PARITY_NONE;
82+
UartHandle.Init.Mode = UART_MODE_TX_RX;
83+
UartHandle.Init.HwFlowCtl = UART_HWCONTROL_NONE;
84+
UartHandle.Init.OverSampling = UART_OVERSAMPLING_16;
85+
86+
if (HAL_UART_Init(&UartHandle) != HAL_OK)
87+
{
88+
while (1);
89+
}
90+
return 0;
91+
}
92+
INIT_BOARD_EXPORT(uart_init);
93+
94+
void rt_hw_console_output(const char *str)
95+
{
96+
rt_size_t i = 0, size = 0;
97+
char a = '\r';
98+
99+
__HAL_UNLOCK(&UartHandle);
100+
101+
size = rt_strlen(str);
102+
103+
for (i = 0; i < size; i++)
104+
{
105+
if (*(str + i) == '\n')
106+
{
107+
HAL_UART_Transmit(&UartHandle, (uint8_t *)&a, 1, 1);
108+
}
109+
HAL_UART_Transmit(&UartHandle, (uint8_t *)(str + i), 1, 1);
110+
}
111+
}
112+
#endif
113+
114+
#ifdef RT_USING_FINSH
115+
char rt_hw_console_getchar(void)
116+
{
117+
/* Note: the initial value of ch must < 0 */
118+
int ch = -1;
119+
120+
if (__HAL_UART_GET_FLAG(&UartHandle, UART_FLAG_RXNE) != RESET)
121+
{
122+
ch = UartHandle.Instance->DR & 0xff;
123+
}
124+
else
125+
{
126+
rt_thread_mdelay(10);
127+
}
128+
return ch;
129+
}
130+
#endif

0 commit comments

Comments
 (0)