bsp/nuclei: Fix issues mentioned in PR #3868
Signed-off-by: Huaqi Fang <578567190@qq.com>
This commit is contained in:
parent
bc3471e8fa
commit
a64f36f198
|
@ -94,16 +94,16 @@ Nuclei OpenOCD, i386 Open On-Chip Debugger 0.10.0+dev-g11f0cf429 (2020-07-15-04:
|
|||
Licensed under GNU GPL v2
|
||||
For bug reports, read
|
||||
http://openocd.org/doc/doxygen/bugs.html
|
||||
rt_thread_idle_entry (parameter=<optimized out>) at D:\workspace\Sourcecode\rt-thread\src\idle.c:249
|
||||
249 for (i = 0; i < RT_IDLE_HOOK_LIST_SIZE; i++)
|
||||
rt_list_insert_before (n=0xdeadbeef, l=0x90000f80 <timer_thread_stack+464>) at D:\workspace\Sourcecode\rt-thread\include/rtservice.h:79
|
||||
79 n->next = l;
|
||||
cleared protection for sectors 0 through 63 on flash bank 0
|
||||
|
||||
Loading section .init, size 0x284 lma 0x80000000
|
||||
Loading section .text, size 0xb57e lma 0x800002c0
|
||||
Loading section .rodata, size 0x3248 lma 0x8000b840
|
||||
Loading section .data, size 0x350 lma 0x8000ea88
|
||||
Start address 0x80000198, load size 60826
|
||||
Transfer rate: 49 KB/sec, 10137 bytes/write.
|
||||
Loading section .text, size 0xb30a lma 0x800002c0
|
||||
Loading section .rodata, size 0x3248 lma 0x8000b5d0
|
||||
Loading section .data, size 0x340 lma 0x8000e818
|
||||
Start address 0x80000198, load size 60182
|
||||
Transfer rate: 48 KB/sec, 10030 bytes/write.
|
||||
shutdown command invoked
|
||||
A debugging session is active.
|
||||
|
||||
|
@ -140,12 +140,10 @@ msh />
|
|||
msh />ps
|
||||
thread pri status sp stack size max used left tick error
|
||||
-------- --- ------- ---------- ---------- ------ ---------- ---
|
||||
thread01 19 suspend 0x00000158 0x0000018c 87% 0x00000005 000
|
||||
thread00 19 suspend 0x00000158 0x0000018c 87% 0x00000005 000
|
||||
tshell 20 running 0x00000258 0x00001000 18% 0x00000004 000
|
||||
tidle0 31 ready 0x000000a8 0x0000018c 59% 0x0000000e 000
|
||||
timer 4 suspend 0x000000f8 0x00000200 49% 0x00000009 000
|
||||
main 10 suspend 0x00000168 0x00000800 36% 0x00000006 000
|
||||
serrxsim 5 suspend 0x00000134 0x0000018c 77% 0x00000005 000
|
||||
tshell 20 running 0x000002b0 0x00001000 17% 0x00000005 000
|
||||
tidle0 31 ready 0x00000164 0x0000018c 89% 0x0000000b 000
|
||||
timer 4 suspend 0x00000120 0x00000200 56% 0x00000009 000
|
||||
msh />
|
||||
~~~
|
||||
|
||||
|
@ -182,26 +180,26 @@ Nuclei OpenOCD, i386 Open On-Chip Debugger 0.10.0+dev-g11f0cf429 (2020-07-15-04:
|
|||
Licensed under GNU GPL v2
|
||||
For bug reports, read
|
||||
http://openocd.org/doc/doxygen/bugs.html
|
||||
0x0000000080000f14 in _has_defunct_thread () at D:\workspace\Sourcecode\rt-thread\src\idle.c:153
|
||||
153 while (_has_defunct_thread())
|
||||
0x0000000080000e80 in rt_thread_idle_entry (parameter=<optimized out>)
|
||||
at D:\workspace\Sourcecode\rt-thread\src\idle.c:253
|
||||
253 idle_hook_list[i]();
|
||||
(gdb) load
|
||||
Loading section .init, size 0x284 lma 0x80000000
|
||||
Loading section .text, size 0xb57e lma 0x800002c0
|
||||
Loading section .rodata, size 0x3248 lma 0x8000b840
|
||||
Loading section .data, size 0x350 lma 0x8000ea88
|
||||
Start address 0x80000198, load size 60826
|
||||
Transfer rate: 48 KB/sec, 10137 bytes/write.
|
||||
Loading section .text, size 0xb30a lma 0x800002c0
|
||||
Loading section .rodata, size 0x3248 lma 0x8000b5d0
|
||||
Loading section .data, size 0x340 lma 0x8000e818
|
||||
Start address 0x80000198, load size 60182
|
||||
Transfer rate: 49 KB/sec, 10030 bytes/write.
|
||||
(gdb) b main
|
||||
Breakpoint 1 at 0x800002c0: file applications\main.c, line 95.
|
||||
Breakpoint 1 at 0x800002c0: file applications\main.c, line 35.
|
||||
(gdb) c
|
||||
Continuing.
|
||||
|
||||
Breakpoint 1, main () at applications\main.c:95
|
||||
95 board_gpio_init();
|
||||
Breakpoint 1, main () at applications\main.c:35
|
||||
35 board_serial_init();
|
||||
(gdb) n
|
||||
96 create_thread_demo();
|
||||
(gdb) n
|
||||
99 board_serial_init();
|
||||
rt_thread_exit () at D:\workspace\Sourcecode\rt-thread\src\thread.c:277
|
||||
277 return rt_current_thread;
|
||||
(gdb) c
|
||||
Continuing.
|
||||
~~~
|
||||
|
|
|
@ -7,8 +7,6 @@ cwd = GetCurrentDir()
|
|||
objs = []
|
||||
list = os.listdir(cwd)
|
||||
|
||||
ASFLAGS = ' -I' + cwd
|
||||
|
||||
for d in list:
|
||||
path = os.path.join(cwd, d)
|
||||
if os.path.isfile(os.path.join(path, 'SConscript')):
|
||||
|
|
|
@ -5,84 +5,25 @@
|
|||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2019-07-23 tyustli first version
|
||||
* 2020-09-02 hqfang first version
|
||||
*/
|
||||
|
||||
#include <rtthread.h>
|
||||
#include <rtdevice.h>
|
||||
#include <nuclei_sdk_hal.h>
|
||||
|
||||
#define THREAD_PRIORITY 19
|
||||
#define THREAD_STACK_SIZE 396
|
||||
#define THREAD_TIMESLICE 5
|
||||
#define THREAD_NUM 2
|
||||
// #define APP_DEBUG_PRINT
|
||||
|
||||
/* Align stack when using static thread */
|
||||
ALIGN(RT_ALIGN_SIZE)
|
||||
static rt_uint8_t thread_stack[THREAD_NUM][THREAD_STACK_SIZE];
|
||||
static struct rt_thread tid[THREAD_NUM];
|
||||
|
||||
/* Thread entry function */
|
||||
static void thread_entry(void *parameter)
|
||||
{
|
||||
rt_uint32_t count = 0;
|
||||
|
||||
while (1) {
|
||||
#ifdef APP_DEBUG_PRINT
|
||||
rt_kprintf("thread %d count: %d\n", (rt_uint32_t)parameter, count++);
|
||||
#endif
|
||||
rt_thread_mdelay(500);
|
||||
if (((uint32_t)parameter) % 2) {
|
||||
gpio_toggle(GPIO, SOC_LED_BLUE_GPIO_MASK);
|
||||
} else {
|
||||
gpio_toggle(GPIO, SOC_LED_GREEN_GPIO_MASK);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Thread demo */
|
||||
int create_thread_demo(void)
|
||||
{
|
||||
int i;
|
||||
static char tname[9] = "thread";
|
||||
|
||||
for (i = 0; i < THREAD_NUM; i ++) {
|
||||
/* Create static threads */
|
||||
tname[6] = i/10 + '0';
|
||||
tname[7] = i%10 + '0';
|
||||
tname[8] = '\0';
|
||||
rt_thread_init(&tid[i], tname, thread_entry, (void *)i, thread_stack[i],
|
||||
THREAD_STACK_SIZE, THREAD_PRIORITY, THREAD_TIMESLICE);
|
||||
}
|
||||
|
||||
/* Startup threads */
|
||||
for (i = 0; i < THREAD_NUM; i ++) {
|
||||
rt_thread_startup(&tid[i]);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void board_gpio_init(void)
|
||||
{
|
||||
gpio_enable_input(GPIO, SOC_BUTTON_GPIO_MASK);
|
||||
gpio_set_pue(GPIO, SOC_BUTTON_GPIO_MASK, GPIO_BIT_ALL_ONE);
|
||||
|
||||
gpio_enable_output(GPIO, SOC_LED_GPIO_MASK);
|
||||
gpio_write(GPIO, SOC_LED_GPIO_MASK, GPIO_BIT_ALL_ZERO);
|
||||
}
|
||||
|
||||
#ifdef RT_USING_SERIAL
|
||||
|
||||
#define SERIAL_THREAD_STACK_SIZE 396
|
||||
/* Currently UART IRQ is not connected,
|
||||
* So I use task to interact with uart input
|
||||
*/
|
||||
#define SERIAL_THREAD_STACK_SIZE 396
|
||||
static rt_uint8_t serial_stack[SERIAL_THREAD_STACK_SIZE];
|
||||
static struct rt_thread serial_tid;
|
||||
extern void rt_hw_serial_thread_entry(void *parameter);
|
||||
extern void rt_hw_serial_rcvtsk(void *parameter);
|
||||
|
||||
void board_serial_init(void)
|
||||
{
|
||||
rt_thread_init(&serial_tid, "serrxsim", rt_hw_serial_thread_entry,
|
||||
rt_thread_init(&serial_tid, "serrxsim", rt_hw_serial_rcvtsk,
|
||||
(void *)NULL, serial_stack, SERIAL_THREAD_STACK_SIZE, 5, 5);
|
||||
rt_thread_startup(&serial_tid);
|
||||
}
|
||||
|
@ -90,22 +31,9 @@ void board_serial_init(void)
|
|||
|
||||
int main(void)
|
||||
{
|
||||
rt_uint32_t count = 0;
|
||||
|
||||
board_gpio_init();
|
||||
create_thread_demo();
|
||||
|
||||
#ifdef RT_USING_SERIAL
|
||||
board_serial_init();
|
||||
#endif /* RT_USING_SERIAL */
|
||||
|
||||
while (1) {
|
||||
#ifdef APP_DEBUG_PRINT
|
||||
rt_kprintf("Main thread count: %d\n", count++);
|
||||
#endif
|
||||
rt_thread_mdelay(1000);
|
||||
gpio_toggle(GPIO, SOC_LED_RED_GPIO_MASK);
|
||||
}
|
||||
}
|
||||
|
||||
/******************** end of file *******************/
|
||||
|
|
|
@ -219,7 +219,7 @@ int rt_hw_uart_init(void)
|
|||
return result;
|
||||
}
|
||||
|
||||
void rt_hw_serial_thread_entry(void *parameter)
|
||||
void rt_hw_serial_rcvtsk(void *parameter)
|
||||
{
|
||||
struct hbird_uart_config *uart_cfg;
|
||||
|
||||
|
|
Loading…
Reference in New Issue