summaryrefslogtreecommitdiff
path: root/bsp/ls1bdev
diff options
context:
space:
mode:
authoryangjie11 <[email protected]>2020-11-18 09:56:35 +0800
committerGitHub <[email protected]>2020-11-18 09:56:35 +0800
commitd4a682e8d97fa131e5a8d795f8c5451d55cdd5b0 (patch)
tree4773b40cb012475c5daf74bfd55707e141477669 /bsp/ls1bdev
parent2b98f4720c827ae1850df78299f6b273d568c8c7 (diff)
parent2ef3c9d861f55253620996a94831a4be31ca6620 (diff)
Merge pull request #3 from RT-Thread/master
sync
Diffstat (limited to 'bsp/ls1bdev')
-rw-r--r--bsp/ls1bdev/.gitignore0
-rw-r--r--bsp/ls1bdev/Kconfig44
-rw-r--r--bsp/ls1bdev/SConstruct10
-rw-r--r--bsp/ls1bdev/applications/application.c59
-rw-r--r--bsp/ls1bdev/applications/main.c17
-rw-r--r--bsp/ls1bdev/applications/startup.c92
-rw-r--r--bsp/ls1bdev/drivers/board.c112
-rw-r--r--bsp/ls1bdev/drivers/uart.c344
-rw-r--r--bsp/ls1bdev/drivers/uart.h63
-rw-r--r--bsp/ls1bdev/ls1b_ram.lds29
-rw-r--r--bsp/ls1bdev/readme.md (renamed from bsp/ls1bdev/readme.txt)2
-rw-r--r--bsp/ls1bdev/rtconfig.h325
-rw-r--r--bsp/ls1bdev/rtconfig.py9
13 files changed, 476 insertions, 630 deletions
diff --git a/bsp/ls1bdev/.gitignore b/bsp/ls1bdev/.gitignore
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/bsp/ls1bdev/.gitignore
diff --git a/bsp/ls1bdev/Kconfig b/bsp/ls1bdev/Kconfig
new file mode 100644
index 0000000000..c1788b1c6b
--- /dev/null
+++ b/bsp/ls1bdev/Kconfig
@@ -0,0 +1,44 @@
+mainmenu "RT-Thread Configuration"
+
+config BSP_DIR
+ string
+ option env="BSP_ROOT"
+ default "."
+
+config RTT_DIR
+ string
+ option env="RTT_ROOT"
+ default "../.."
+
+config PKGS_DIR
+ string
+ option env="PKGS_ROOT"
+ default "packages"
+
+source "$RTT_DIR/Kconfig"
+source "$RTT_DIR/libcpu/mips/common/Kconfig"
+source "$PKGS_DIR/Kconfig"
+
+config SOC_LS1B
+ bool
+ select RT_USING_COMPONENTS_INIT
+ select RT_USING_USER_MAIN
+ default y
+
+if RT_USING_SERIAL
+config RT_USING_UART0
+ bool "Using RT_USING_UART0"
+ default y
+config RT_USING_UART1
+ bool "Using RT_USING_UART1"
+ default n
+config RT_USING_UART3
+ bool "Using RT_USING_UART3"
+ default n
+
+config RT_UART_RX_BUFFER_SIZE
+ int "The rx buffer size"
+ default 64 if RT_USING_SERIAL
+ default 64
+endif
+
diff --git a/bsp/ls1bdev/SConstruct b/bsp/ls1bdev/SConstruct
index 17e1d15db3..8288427b80 100644
--- a/bsp/ls1bdev/SConstruct
+++ b/bsp/ls1bdev/SConstruct
@@ -12,12 +12,14 @@ from building import *
TARGET = 'rtthread.' + rtconfig.TARGET_EXT
+DefaultEnvironment(tools=[])
env = Environment(tools = ['mingw'],
- AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
- CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS,
- AR = rtconfig.AR, ARFLAGS = '-rc',
- LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
+ AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
+ CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS,
+ AR = rtconfig.AR, ARFLAGS = '-rc',
+ LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
+env['ASCOM'] = env['ASPPCOM']
Export('RTT_ROOT')
Export('rtconfig')
diff --git a/bsp/ls1bdev/applications/application.c b/bsp/ls1bdev/applications/application.c
deleted file mode 100644
index 3daf489a3e..0000000000
--- a/bsp/ls1bdev/applications/application.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * File : application.c
- * This file is part of RT-Thread RTOS
- * COPYRIGHT (C) 2006-2012, RT-Thread Develop Team
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rt-thread.org/license/LICENSE
- *
- * Change Logs:
- * Date Author Notes
- * 2010-06-25 Bernard first version
- * 2011-08-08 lgnq modified for Loongson LS1B
- */
-
-#include <rtthread.h>
-#include <ls1b.h>
-
-#ifdef RT_USING_RTGUI
-#include <rtgui/rtgui.h>
-extern void rt_hw_dc_init(void);
-#endif
-
-void rt_init_thread_entry(void *parameter)
-{
-#ifdef RT_USING_RTGUI
- {
- rt_device_t dc;
-
- /* init Display Controller */
- rt_hw_dc_init();
-
- /* find Display Controller device */
- dc = rt_device_find("dc");
-
- /* set Display Controller device as rtgui graphic driver */
- rtgui_graphic_set_device(dc);
- }
-#endif
-
-#ifdef RT_USING_COMPONENTS_INIT
- /* initialization RT-Thread Components */
- rt_components_init();
-#endif
-}
-
-int rt_application_init(void)
-{
- rt_thread_t tid;
-
- /* create initialization thread */
- tid = rt_thread_create("init",
- rt_init_thread_entry, RT_NULL,
- 4096, 8, 20);
- if (tid != RT_NULL)
- rt_thread_startup(tid);
-
- return 0;
-}
diff --git a/bsp/ls1bdev/applications/main.c b/bsp/ls1bdev/applications/main.c
new file mode 100644
index 0000000000..fac004d832
--- /dev/null
+++ b/bsp/ls1bdev/applications/main.c
@@ -0,0 +1,17 @@
+/*
+ * Copyright (c) 2006-2018, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2018-05-10 zhuangwei first version
+ */
+
+#include <rtthread.h>
+
+int main(int argc, char** argv)
+{
+
+ return 0;
+}
diff --git a/bsp/ls1bdev/applications/startup.c b/bsp/ls1bdev/applications/startup.c
deleted file mode 100644
index deedf962f6..0000000000
--- a/bsp/ls1bdev/applications/startup.c
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * File : startup.c
- * This file is part of RT-Thread RTOS
- * COPYRIGHT (C) 2006-2012, RT-Thread Develop Team
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rt-thread.org/license/LICENSE
- *
- * Change Logs:
- * Date Author Notes
- * 2010-06-25 Bernard first version
- * 2011-08-08 lgnq modified for Loongson LS1B
- */
-
-#include <rthw.h>
-#include <rtthread.h>
-
-#include "board.h"
-#define A_K0BASE 0x80000000
-
-/**
- * @addtogroup Loongson LS1B
- */
-
-/*@{*/
-
-extern unsigned char __bss_end;
-
-extern int rt_application_init(void);
-
-extern void tlb_refill_exception(void);
-extern void general_exception(void);
-extern void irq_exception(void);
-extern void rt_hw_cache_init(void);
-extern void invalidate_writeback_dcache_all(void);
-extern void invalidate_icache_all(void);
-
-/**
- * This function will startup RT-Thread RTOS.
- */
-void rtthread_startup(void)
-{
- /* disable interrupt first */
- rt_hw_interrupt_disable();
-
- /* init cache */
- rt_hw_cache_init();
- /* init hardware interrupt */
- rt_hw_interrupt_init();
-
- /* copy vector */
- rt_memcpy((void *)A_K0BASE, tlb_refill_exception, 0x20);
- rt_memcpy((void *)(A_K0BASE + 0x180), general_exception, 0x20);
- rt_memcpy((void *)(A_K0BASE + 0x200), irq_exception, 0x20);
-
- invalidate_writeback_dcache_all();
- invalidate_icache_all();
-
- /* init board */
- rt_hw_board_init();
-
- /* show version */
- rt_show_version();
-
-#ifdef RT_USING_HEAP
- rt_system_heap_init((void*)&__bss_end, (void*)RT_HW_HEAP_END);
-#endif
-
- /* init scheduler system */
- rt_system_scheduler_init();
-
- /* initialize timer */
- rt_system_timer_init();
-
- /* initialize timer thread */
- rt_system_timer_thread_init();
-
- /* init idle thread */
- rt_thread_idle_init();
-
- /* init application */
- rt_application_init();
-
- /* start scheduler */
- rt_system_scheduler_start();
-
- /* never reach here */
- return;
-}
-
-/*@}*/
diff --git a/bsp/ls1bdev/drivers/board.c b/bsp/ls1bdev/drivers/board.c
index 307d8d28b0..a3f907f664 100644
--- a/bsp/ls1bdev/drivers/board.c
+++ b/bsp/ls1bdev/drivers/board.c
@@ -11,15 +11,25 @@
* Date Author Notes
* 2010-06-25 Bernard first version
* 2011-08-08 lgnq modified for Loongson LS1B
+ * 2019-12-04 Jiaxun Yang Adapt new MIPS generic code
*/
#include <rtthread.h>
#include <rthw.h>
+#include <mips_fpu.h>
#include "board.h"
#include "uart.h"
#include "ls1b.h"
+#ifdef RT_USING_RTGUI
+#include <rtgui/rtgui.h>
+rt_device_t dc;
+extern void rt_hw_dc_init(void);
+#endif
+
+extern unsigned char __bss_end;
+
/**
* @addtogroup Loongson LS1B
*/
@@ -27,85 +37,53 @@
/*@{*/
/**
- * This is the timer interrupt service routine.
- */
-void rt_hw_timer_handler(void)
-{
- unsigned int count;
-
- count = read_c0_compare();
- write_c0_compare(count);
- write_c0_count(0);
-
- /* increase a OS tick */
- rt_tick_increase();
-}
-
-/**
- * This function will initial OS timer
- */
-void rt_hw_timer_init(void)
-{
- write_c0_compare(CPU_HZ/2/RT_TICK_PER_SECOND);
- write_c0_count(0);
-}
-
-/**
* This function will initial sam7s64 board.
*/
void rt_hw_board_init(void)
{
-#ifdef RT_USING_UART
- /* init hardware UART device */
- rt_hw_uart_init();
+ /* init hardware interrupt */
+ rt_hw_exception_init();
+
+ /* init hardware interrupt */
+ rt_hw_interrupt_init();
+
+#ifdef RT_USING_HEAP
+ rt_system_heap_init((void*)&__bss_end, (void*)RT_HW_HEAP_END);
+#endif
+
+#ifdef RT_USING_SERIAL
+ /* init hardware UART device */
+ rt_hw_uart_init();
#endif
#ifdef RT_USING_CONSOLE
- /* set console device */
- rt_console_set_device("uart0");
+ /* set console device */
+ rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
#endif
+ /* init operating system timer */
+ rt_hw_timer_init();
- /* init operating system timer */
- rt_hw_timer_init();
+#ifdef RT_USING_FPU
+ /* init hardware fpu */
+ rt_hw_fpu_init();
+#endif
- rt_kprintf("current sr: 0x%08x\n", read_c0_status());
-}
+#ifdef RT_USING_RTGUI
+ rt_device_t dc;
-#define __raw_out_put(unr) \
- while (*ptr) \
- { \
- if (*ptr == '\n') \
- { \
- /* FIFO status, contain valid data */ \
- while (!(UART_LSR(UART##unr##_BASE) & (UARTLSR_TE | UARTLSR_TFE))); \
- /* write data */ \
- UART_DAT(UART##unr##_BASE) = '\r'; \
- } \
- /* FIFO status, contain valid data */ \
- while (!(UART_LSR(UART##unr##_BASE) & (UARTLSR_TE | UARTLSR_TFE))); \
- /* write data */ \
- UART_DAT(UART##unr##_BASE) = *ptr; \
- ptr ++; \
- }
+ /* init Display Controller */
+ rt_hw_dc_init();
-/* UART line status register value */
-#define UARTLSR_ERROR (1 << 7)
-#define UARTLSR_TE (1 << 6)
-#define UARTLSR_TFE (1 << 5)
-#define UARTLSR_BI (1 << 4)
-#define UARTLSR_FE (1 << 3)
-#define UARTLSR_PE (1 << 2)
-#define UARTLSR_OE (1 << 1)
-#define UARTLSR_DR (1 << 0)
-void rt_hw_console_output(const char *ptr)
-{
-#if defined(RT_USING_UART0)
- __raw_out_put(0);
-#elif defined(RT_USING_UART1)
- __raw_out_put(1);
-#elif defined(RT_USING_UART3)
- __raw_out_put(3);
+ /* find Display Controller device */
+ dc = rt_device_find("dc");
+
+ /* set Display Controller device as rtgui graphic driver */
+ rtgui_graphic_set_device(dc);
#endif
-}
+#ifdef RT_USING_COMPONENTS_INIT
+ rt_components_board_init();
+#endif
+
+}
/*@}*/
diff --git a/bsp/ls1bdev/drivers/uart.c b/bsp/ls1bdev/drivers/uart.c
index c4ddb581e6..e920d33057 100644
--- a/bsp/ls1bdev/drivers/uart.c
+++ b/bsp/ls1bdev/drivers/uart.c
@@ -23,257 +23,257 @@
/*@{*/
-#if defined(RT_USING_UART) && defined(RT_USING_DEVICE)
+#if defined(RT_USING_DEVICE)
struct rt_uart_ls1b
{
- struct rt_device parent;
+ struct rt_device parent;
- rt_uint32_t hw_base;
- rt_uint32_t irq;
+ rt_uint32_t hw_base;
+ rt_uint32_t irq;
- /* buffer for reception */
- rt_uint8_t read_index, save_index;
- rt_uint8_t rx_buffer[RT_UART_RX_BUFFER_SIZE];
+ /* buffer for reception */
+ rt_uint8_t read_index, save_index;
+ rt_uint8_t rx_buffer[RT_UART_RX_BUFFER_SIZE];
}uart_device;
static void rt_uart_irqhandler(int irqno, void *param)
{
- rt_ubase_t level;
- rt_uint8_t isr;
- struct rt_uart_ls1b *uart = &uart_device;
+ rt_ubase_t level;
+ rt_uint8_t isr;
+ struct rt_uart_ls1b *uart = &uart_device;
- /* read interrupt status and clear it */
- isr = UART_IIR(uart->hw_base);
- isr = (isr >> 1) & 0x3;
+ /* read interrupt status and clear it */
+ isr = UART_IIR(uart->hw_base);
+ isr = (isr >> 1) & 0x3;
- /* receive data available */
- if (isr & 0x02)
- {
- /* Receive Data Available */
- while (UART_LSR(uart->hw_base) & UARTLSR_DR)
- {
- uart->rx_buffer[uart->save_index] = UART_DAT(uart->hw_base);
+ /* receive data available */
+ if (isr & 0x02)
+ {
+ /* Receive Data Available */
+ while (UART_LSR(uart->hw_base) & UARTLSR_DR)
+ {
+ uart->rx_buffer[uart->save_index] = UART_DAT(uart->hw_base);
- level = rt_hw_interrupt_disable();
- uart->save_index ++;
- if (uart->save_index >= RT_UART_RX_BUFFER_SIZE)
- uart->save_index = 0;
- rt_hw_interrupt_enable(level);
- }
+ level = rt_hw_interrupt_disable();
+ uart->save_index ++;
+ if (uart->save_index >= RT_UART_RX_BUFFER_SIZE)
+ uart->save_index = 0;
+ rt_hw_interrupt_enable(level);
+ }
- /* invoke callback */
- if (uart->parent.rx_indicate != RT_NULL)
- {
- rt_size_t length;
- if (uart->read_index > uart->save_index)
- length = RT_UART_RX_BUFFER_SIZE - uart->read_index + uart->save_index;
- else
- length = uart->save_index - uart->read_index;
+ /* invoke callback */
+ if (uart->parent.rx_indicate != RT_NULL)
+ {
+ rt_size_t length;
+ if (uart->read_index > uart->save_index)
+ length = RT_UART_RX_BUFFER_SIZE - uart->read_index + uart->save_index;
+ else
+ length = uart->save_index - uart->read_index;
- uart->parent.rx_indicate(&uart->parent, length);
- }
- }
+ uart->parent.rx_indicate(&uart->parent, length);
+ }
+ }
- return;
+ return;
}
static rt_err_t rt_uart_init(rt_device_t dev)
{
- rt_uint32_t baud_div;
- struct rt_uart_ls1b *uart = (struct rt_uart_ls1b *)dev;
+ rt_uint32_t baud_div;
+ struct rt_uart_ls1b *uart = (struct rt_uart_ls1b *)dev;
- RT_ASSERT(uart != RT_NULL);
+ RT_ASSERT(uart != RT_NULL);
#if 0
- /* init UART Hardware */
- UART_IER(uart->hw_base) = 0; /* clear interrupt */
- UART_FCR(uart->hw_base) = 0x60; /* reset UART Rx/Tx */
+ /* init UART Hardware */
+ UART_IER(uart->hw_base) = 0; /* clear interrupt */
+ UART_FCR(uart->hw_base) = 0x60; /* reset UART Rx/Tx */
- /* enable UART clock */
- /* set databits, stopbits and parity. (8-bit data, 1 stopbit, no parity) */
- UART_LCR(uart->hw_base) = 0x3;
+ /* enable UART clock */
+ /* set databits, stopbits and parity. (8-bit data, 1 stopbit, no parity) */
+ UART_LCR(uart->hw_base) = 0x3;
- /* set baudrate */
- baud_div = DEV_CLK / 16 / UART_BAUDRATE;
- UART_LCR(uart->hw_base) |= UARTLCR_DLAB;
+ /* set baudrate */
+ baud_div = DEV_CLK / 16 / UART_BAUDRATE;
+ UART_LCR(uart->hw_base) |= UARTLCR_DLAB;
- UART_MSB(uart->hw_base) = (baud_div >> 8) & 0xff;
- UART_LSB(uart->hw_base) = baud_div & 0xff;
+ UART_MSB(uart->hw_base) = (baud_div >> 8) & 0xff;
+ UART_LSB(uart->hw_base) = baud_div & 0xff;
- UART_LCR(uart->hw_base) &= ~UARTLCR_DLAB;
+ UART_LCR(uart->hw_base) &= ~UARTLCR_DLAB;
- /* Enable UART unit, enable and clear FIFO */
- UART_FCR(uart->hw_base) = UARTFCR_UUE | UARTFCR_FE | UARTFCR_TFLS | UARTFCR_RFLS;
+ /* Enable UART unit, enable and clear FIFO */
+ UART_FCR(uart->hw_base) = UARTFCR_UUE | UARTFCR_FE | UARTFCR_TFLS | UARTFCR_RFLS;
#endif
- return RT_EOK;
+ return RT_EOK;
}
static rt_err_t rt_uart_open(rt_device_t dev, rt_uint16_t oflag)
{
- struct rt_uart_ls1b *uart = (struct rt_uart_ls1b *)dev;
+ struct rt_uart_ls1b *uart = (struct rt_uart_ls1b *)dev;
- RT_ASSERT(uart != RT_NULL);
- if (dev->flag & RT_DEVICE_FLAG_INT_RX)
- {
- /* Enable the UART Interrupt */
- UART_IER(uart->hw_base) |= UARTIER_IRXE;
+ RT_ASSERT(uart != RT_NULL);
+ if (dev->flag & RT_DEVICE_FLAG_INT_RX)
+ {
+ /* Enable the UART Interrupt */
+ UART_IER(uart->hw_base) |= UARTIER_IRXE;
- /* install interrupt */
- rt_hw_interrupt_install(uart->irq, rt_uart_irqhandler, RT_NULL, "UART");
- rt_hw_interrupt_umask(uart->irq);
- }
- return RT_EOK;
+ /* install interrupt */
+ rt_hw_interrupt_install(uart->irq, rt_uart_irqhandler, RT_NULL, "UART");
+ rt_hw_interrupt_umask(uart->irq);
+ }
+ return RT_EOK;
}
static rt_err_t rt_uart_close(rt_device_t dev)
{
- struct rt_uart_ls1b *uart = (struct rt_uart_ls1b *)dev;
+ struct rt_uart_ls1b *uart = (struct rt_uart_ls1b *)dev;
- RT_ASSERT(uart != RT_NULL);
- if (dev->flag & RT_DEVICE_FLAG_INT_RX)
- {
- /* Disable the UART Interrupt */
- UART_IER(uart->hw_base) &= ~(UARTIER_IRXE);
- }
+ RT_ASSERT(uart != RT_NULL);
+ if (dev->flag & RT_DEVICE_FLAG_INT_RX)
+ {
+ /* Disable the UART Interrupt */
+ UART_IER(uart->hw_base) &= ~(UARTIER_IRXE);
+ }
- return RT_EOK;
+ return RT_EOK;
}
static rt_size_t rt_uart_read(rt_device_t dev, rt_off_t pos, void *buffer, rt_size_t size)
{
- rt_uint8_t *ptr;
- struct rt_uart_ls1b *uart = (struct rt_uart_ls1b *)dev;
+ rt_uint8_t *ptr;
+ struct rt_uart_ls1b *uart = (struct rt_uart_ls1b *)dev;
- RT_ASSERT(uart != RT_NULL);
+ RT_ASSERT(uart != RT_NULL);
- /* point to buffer */
- ptr = (rt_uint8_t *)buffer;
- if (dev->flag & RT_DEVICE_FLAG_INT_RX)
- {
- while (size)
- {
- /* interrupt receive */
- rt_base_t level;
+ /* point to buffer */
+ ptr = (rt_uint8_t *)buffer;
+ if (dev->flag & RT_DEVICE_FLAG_INT_RX)
+ {
+ while (size)
+ {
+ /* interrupt receive */
+ rt_base_t level;
- /* disable interrupt */
- level = rt_hw_interrupt_disable();
- if (uart->read_index != uart->save_index)
- {
- *ptr = uart->rx_buffer[uart->read_index];
+ /* disable interrupt */
+ level = rt_hw_interrupt_disable();
+ if (uart->read_index != uart->save_index)
+ {
+ *ptr = uart->rx_buffer[uart->read_index];
- uart->read_index ++;
- if (uart->read_index >= RT_UART_RX_BUFFER_SIZE)
- uart->read_index = 0;
- }
- else
- {
- /* no data in rx buffer */
+ uart->read_index ++;
+ if (uart->read_index >= RT_UART_RX_BUFFER_SIZE)
+ uart->read_index = 0;
+ }
+ else
+ {
+ /* no data in rx buffer */
- /* enable interrupt */
- rt_hw_interrupt_enable(level);
- break;
- }
+ /* enable interrupt */
+ rt_hw_interrupt_enable(level);
+ break;
+ }
- /* enable interrupt */
- rt_hw_interrupt_enable(level);
+ /* enable interrupt */
+ rt_hw_interrupt_enable(level);
- ptr ++;
- size --;
- }
+ ptr ++;
+ size --;
+ }
- return (rt_uint32_t)ptr - (rt_uint32_t)buffer;
- }
+ return (rt_uint32_t)ptr - (rt_uint32_t)buffer;
+ }
- return 0;
+ return 0;
}
static rt_size_t rt_uart_write(rt_device_t dev, rt_off_t pos, const void *buffer, rt_size_t size)
{
- char *ptr;
- struct rt_uart_ls1b *uart = (struct rt_uart_ls1b *)dev;
+ char *ptr;
+ struct rt_uart_ls1b *uart = (struct rt_uart_ls1b *)dev;
- RT_ASSERT(uart != RT_NULL);
+ RT_ASSERT(uart != RT_NULL);
- ptr = (char *)buffer;
+ ptr = (char *)buffer;
- if (dev->flag & RT_DEVICE_FLAG_STREAM)
- {
- /* stream mode */
- while (size)
- {
- if (*ptr == '\n')
- {
- /* FIFO status, contain valid data */
- while (!(UART_LSR(uart->hw_base) & (UARTLSR_TE | UARTLSR_TFE)));
- /* write data */
- UART_DAT(uart->hw_base) = '\r';
- }
+ if (dev->flag & RT_DEVICE_FLAG_STREAM)
+ {
+ /* stream mode */
+ while (size)
+ {
+ if (*ptr == '\n')
+ {
+ /* FIFO status, contain valid data */
+ while (!(UART_LSR(uart->hw_base) & (UARTLSR_TE | UARTLSR_TFE)));
+ /* write data */
+ UART_DAT(uart->hw_base) = '\r';
+ }
- /* FIFO status, contain valid data */
- while (!(UART_LSR(uart->hw_base) & (UARTLSR_TE | UARTLSR_TFE)));
- /* write data */
- UART_DAT(uart->hw_base) = *ptr;
+ /* FIFO status, contain valid data */
+ while (!(UART_LSR(uart->hw_base) & (UARTLSR_TE | UARTLSR_TFE)));
+ /* write data */
+ UART_DAT(uart->hw_base) = *ptr;
- ptr ++;
- size --;
- }
- }
- else
- {
- while (size != 0)
- {
- /* FIFO status, contain valid data */
- while (!(UART_LSR(uart->hw_base) & (UARTLSR_TE | UARTLSR_TFE)));
+ ptr ++;
+ size --;
+ }
+ }
+ else
+ {
+ while (size != 0)
+ {
+ /* FIFO status, contain valid data */
+ while (!(UART_LSR(uart->hw_base) & (UARTLSR_TE | UARTLSR_TFE)));
- /* write data */
- UART_DAT(uart->hw_base) = *ptr;
+ /* write data */
+ UART_DAT(uart->hw_base) = *ptr;
- ptr++;
- size--;
- }
- }
+ ptr++;
+ size--;
+ }
+ }
- return (rt_size_t)ptr - (rt_size_t)buffer;
+ return (rt_size_t)ptr - (rt_size_t)buffer;
}
void rt_hw_uart_init(void)
{
- struct rt_uart_ls1b *uart;
+ struct rt_uart_ls1b *uart;
- /* get uart device */
- uart = &uart_device;
+ /* get uart device */
+ uart = &uart_device;
- /* device initialization */
- uart->parent.type = RT_Device_Class_Char;
- rt_memset(uart->rx_buffer, 0, sizeof(uart->rx_buffer));
- uart->read_index = uart->save_index = 0;
+ /* device initialization */
+ uart->parent.type = RT_Device_Class_Char;
+ rt_memset(uart->rx_buffer, 0, sizeof(uart->rx_buffer));
+ uart->read_index = uart->save_index = 0;
#if defined(RT_USING_UART0)
- uart->hw_base = UART0_BASE;
- uart->irq = LS1B_UART0_IRQ;
+ uart->hw_base = UART0_BASE;
+ uart->irq = LS1B_UART0_IRQ;
#elif defined(RT_USING_UART1)
- uart->hw_base = UART1_BASE;
- uart->irq = LS1B_UART1_IRQ;
+ uart->hw_base = UART1_BASE;
+ uart->irq = LS1B_UART1_IRQ;
#elif defined(RT_USING_UART3)
- uart->hw_base = UART3_BASE;
- uart->irq = LS1B_UART3_IRQ;
+ uart->hw_base = UART3_BASE;
+ uart->irq = LS1B_UART3_IRQ;
#endif
- /* device interface */
- uart->parent.init = rt_uart_init;
- uart->parent.open = rt_uart_open;
- uart->parent.close = rt_uart_close;
- uart->parent.read = rt_uart_read;
- uart->parent.write = rt_uart_write;
- uart->parent.control = RT_NULL;
- uart->parent.user_data = RT_NULL;
+ /* device interface */
+ uart->parent.init = rt_uart_init;
+ uart->parent.open = rt_uart_open;
+ uart->parent.close = rt_uart_close;
+ uart->parent.read = rt_uart_read;
+ uart->parent.write = rt_uart_write;
+ uart->parent.control = RT_NULL;
+ uart->parent.user_data = RT_NULL;
- rt_device_register(&uart->parent, "uart0",
- RT_DEVICE_FLAG_RDWR |
- RT_DEVICE_FLAG_STREAM |
- RT_DEVICE_FLAG_INT_RX);
+ rt_device_register(&uart->parent, "uart0",
+ RT_DEVICE_FLAG_RDWR |
+ RT_DEVICE_FLAG_STREAM |
+ RT_DEVICE_FLAG_INT_RX);
}
#endif /* end of UART */
diff --git a/bsp/ls1bdev/drivers/uart.h b/bsp/ls1bdev/drivers/uart.h
index 2aae7e9ef5..bec660b740 100644
--- a/bsp/ls1bdev/drivers/uart.h
+++ b/bsp/ls1bdev/drivers/uart.h
@@ -16,8 +16,9 @@
#define __UART_H__
#include "ls1b.h"
+#include <rthw.h>
-#define UART0_BASE 0xBFE40000
+#define UART0_BASE 0xBFE40000
#define UART0_1_BASE 0xBFE41000
#define UART0_2_BASE 0xBFE42000
#define UART0_3_BASE 0xBFE43000
@@ -31,43 +32,43 @@
#define UART5_BASE 0xBFE7C000
/* UART registers */
-#define UART_DAT(base) __REG8(base + 0x00)
-#define UART_IER(base) __REG8(base + 0x01)
-#define UART_IIR(base) __REG8(base + 0x02)
-#define UART_FCR(base) __REG8(base + 0x02)
-#define UART_LCR(base) __REG8(base + 0x03)
-#define UART_MCR(base) __REG8(base + 0x04)
-#define UART_LSR(base) __REG8(base + 0x05)
-#define UART_MSR(base) __REG8(base + 0x06)
+#define UART_DAT(base) HWREG8(base + 0x00)
+#define UART_IER(base) HWREG8(base + 0x01)
+#define UART_IIR(base) HWREG8(base + 0x02)
+#define UART_FCR(base) HWREG8(base + 0x02)
+#define UART_LCR(base) HWREG8(base + 0x03)
+#define UART_MCR(base) HWREG8(base + 0x04)
+#define UART_LSR(base) HWREG8(base + 0x05)
+#define UART_MSR(base) HWREG8(base + 0x06)
-#define UART_LSB(base) __REG8(base + 0x00)
-#define UART_MSB(base) __REG8(base + 0x01)
+#define UART_LSB(base) HWREG8(base + 0x00)
+#define UART_MSB(base) HWREG8(base + 0x01)
/* UART0 registers */
-#define UART0_DAT __REG8(UART0_BASE + 0x00)
-#define UART0_IER __REG8(UART0_BASE + 0x01)
-#define UART0_IIR __REG8(UART0_BASE + 0x02)
-#define UART0_FCR __REG8(UART0_BASE + 0x02)
-#define UART0_LCR __REG8(UART0_BASE + 0x03)
-#define UART0_MCR __REG8(UART0_BASE + 0x04)
-#define UART0_LSR __REG8(UART0_BASE + 0x05)
-#define UART0_MSR __REG8(UART0_BASE + 0x06)
+#define UART0_DAT HWREG8(UART0_BASE + 0x00)
+#define UART0_IER HWREG8(UART0_BASE + 0x01)
+#define UART0_IIR HWREG8(UART0_BASE + 0x02)
+#define UART0_FCR HWREG8(UART0_BASE + 0x02)
+#define UART0_LCR HWREG8(UART0_BASE + 0x03)
+#define UART0_MCR HWREG8(UART0_BASE + 0x04)
+#define UART0_LSR HWREG8(UART0_BASE + 0x05)
+#define UART0_MSR HWREG8(UART0_BASE + 0x06)
-#define UART0_LSB __REG8(UART0_BASE + 0x00)
-#define UART0_MSB __REG8(UART0_BASE + 0x01)
+#define UART0_LSB HWREG8(UART0_BASE + 0x00)
+#define UART0_MSB HWREG8(UART0_BASE + 0x01)
/* UART1 registers */
-#define UART1_DAT __REG8(UART1_BASE + 0x00)
-#define UART1_IER __REG8(UART1_BASE + 0x01)
-#define UART1_IIR __REG8(UART1_BASE + 0x02)
-#define UART1_FCR __REG8(UART1_BASE + 0x02)
-#define UART1_LCR __REG8(UART1_BASE + 0x03)
-#define UART1_MCR __REG8(UART1_BASE + 0x04)
-#define UART1_LSR __REG8(UART1_BASE + 0x05)
-#define UART1_MSR __REG8(UART1_BASE + 0x06)
+#define UART1_DAT HWREG8(UART1_BASE + 0x00)
+#define UART1_IER HWREG8(UART1_BASE + 0x01)
+#define UART1_IIR HWREG8(UART1_BASE + 0x02)
+#define UART1_FCR HWREG8(UART1_BASE + 0x02)
+#define UART1_LCR HWREG8(UART1_BASE + 0x03)
+#define UART1_MCR HWREG8(UART1_BASE + 0x04)
+#define UART1_LSR HWREG8(UART1_BASE + 0x05)
+#define UART1_MSR HWREG8(UART1_BASE + 0x06)
-#define UART1_LSB __REG8(UART1_BASE + 0x00)
-#define UART1_MSB __REG8(UART1_BASE + 0x01)
+#define UART1_LSB HWREG8(UART1_BASE + 0x00)
+#define UART1_MSB HWREG8(UART1_BASE + 0x01)
/* UART interrupt enable register value */
#define UARTIER_IME (1 << 3)
diff --git a/bsp/ls1bdev/ls1b_ram.lds b/bsp/ls1bdev/ls1b_ram.lds
index d453983d7e..872df8ad76 100644
--- a/bsp/ls1bdev/ls1b_ram.lds
+++ b/bsp/ls1bdev/ls1b_ram.lds
@@ -11,6 +11,7 @@
* Date Author Notes
* 2010-05-17 swkyer first version
* 2010-09-04 bernard move the beginning entry to 0x80200000
+ * 2019-12-04 Jiaxun Yang Adapt new memory layout
*/
OUTPUT_ARCH(mips)
@@ -19,16 +20,19 @@ GROUP(-lgcc -lc)
ENTRY(_start)
SECTIONS
{
- . = 0x80200000 ;
-
- .start :
- {
- *(.start);
- }
-
- . = ALIGN(4);
+ . = 0x80200000;
.text :
{
+ start = ABSOLUTE(.);
+ *(.selfboot);
+ *(.selfboot_data);
+ . = ALIGN(4);
+ __selfboot_end = .;
+ . = ALIGN(0x1000);
+ __ebase_entry = .;
+ KEEP(*(.exc_vectors))
+ __ebase_end = .;
+ *(.start);
*(.text)
*(.text.*)
*(.rodata)
@@ -76,6 +80,15 @@ SECTIONS
*(.sdata)
*(.sdata.*)
}
+ _edata = .;
+
+ .stack :
+ {
+ . = ALIGN(8);
+ _system_stack_start = .;
+ . = . + 0x400; /* 1kb system stack */
+ _system_stack = .;
+ }
.sbss :
{
diff --git a/bsp/ls1bdev/readme.txt b/bsp/ls1bdev/readme.md
index 1b7944c636..b47004ecc8 100644
--- a/bsp/ls1bdev/readme.txt
+++ b/bsp/ls1bdev/readme.md
@@ -1,4 +1,4 @@
-this bsp is based on LS1G DEMO BOARD V1.1
+This bsp is based on LS1B DEMO BOARD V1.1
# download script for RT-Thread
ifaddr syn0 192.168.1.100;load tftp://192.168.1.5/rtthread.elf;g \ No newline at end of file
diff --git a/bsp/ls1bdev/rtconfig.h b/bsp/ls1bdev/rtconfig.h
index 67bba7fc68..882d74b4d7 100644
--- a/bsp/ls1bdev/rtconfig.h
+++ b/bsp/ls1bdev/rtconfig.h
@@ -1,222 +1,163 @@
-#ifndef __RTTHREAD_CFG_H__
-#define __RTTHREAD_CFG_H__
+#ifndef RT_CONFIG_H__
+#define RT_CONFIG_H__
-// <RDTConfigurator URL="http://www.rt-thread.com/eclipse">
+/* Automatically generated file; DO NOT EDIT. */
+/* RT-Thread Configuration */
-// <integer name="RT_NAME_MAX" description="Maximal size of kernel object name length" default="6" />
-#define RT_NAME_MAX 10
-// <integer name="RT_ALIGN_SIZE" description="Alignment size for CPU architecture data access" default="4" />
-#define RT_ALIGN_SIZE 4
-// <integer name="RT_THREAD_PRIORITY_MAX" description="Maximal level of thread priority" default="32">
-// <item description="8">8</item>
-// <item description="32">32</item>
-// <item description="256">256</item>
-// </integer>
-#define RT_THREAD_PRIORITY_MAX 32
-// <integer name="RT_TICK_PER_SECOND" description="OS tick per second" default="100" />
-#define RT_TICK_PER_SECOND 100
-// <section name="RT_DEBUG" description="Kernel Debug Configuration" default="true" >
-#define RT_DEBUG
-// <bool name="RT_THREAD_DEBUG" description="Thread debug enable" default="false" />
-// #define RT_THREAD_DEBUG
-// <bool name="RT_USING_OVERFLOW_CHECK" description="Thread stack over flow detect" default="true" />
-#define RT_USING_OVERFLOW_CHECK
-// <bool name="RT_USING_INTERRUPT_INFO" description="Show more interrupt description" default="true" />
-#define RT_USING_INTERRUPT_INFO
-// </section>
+/* RT-Thread Kernel */
-// <bool name="RT_USING_HOOK" description="Using hook functions" default="true" />
+#define RT_NAME_MAX 8
+#define RT_ALIGN_SIZE 4
+#define RT_THREAD_PRIORITY_32
+#define RT_THREAD_PRIORITY_MAX 32
+#define RT_TICK_PER_SECOND 100
+#define RT_USING_OVERFLOW_CHECK
#define RT_USING_HOOK
-// <section name="RT_USING_TIMER_SOFT" description="Using software timer which will start a thread to handle soft-timer" default="true" >
-// #define RT_USING_TIMER_SOFT
-// <integer name="RT_TIMER_THREAD_PRIO" description="The priority level of timer thread" default="4" />
-#define RT_TIMER_THREAD_PRIO 4
-// <integer name="RT_TIMER_THREAD_STACK_SIZE" description="The stack size of timer thread" default="512" />
-#define RT_TIMER_THREAD_STACK_SIZE 512
-// <integer name="RT_TIMER_TICK_PER_SECOND" description="The soft-timer tick per second" default="10" />
-#define RT_TIMER_TICK_PER_SECOND 10
-// </section>
+#define RT_USING_IDLE_HOOK
+#define RT_IDLE_HOOK_LIST_SIZE 4
+#define IDLE_THREAD_STACK_SIZE 256
+#define RT_USING_TIMER_SOFT
+#define RT_TIMER_THREAD_PRIO 4
+#define RT_TIMER_THREAD_STACK_SIZE 512
+#define RT_DEBUG
+
+/* Inter-Thread communication */
-// <section name="IPC" description="Inter-Thread communication" default="always" >
-// <bool name="RT_USING_SEMAPHORE" description="Using semaphore in the system" default="true" />
#define RT_USING_SEMAPHORE
-// <bool name="RT_USING_MUTEX" description="Using mutex in the system" default="true" />
#define RT_USING_MUTEX
-// <bool name="RT_USING_EVENT" description="Using event group in the system" default="true" />
#define RT_USING_EVENT
-// <bool name="RT_USING_MAILBOX" description="Using mailbox in the system" default="true" />
#define RT_USING_MAILBOX
-// <bool name="RT_USING_MESSAGEQUEUE" description="Using message queue in the system" default="true" />
#define RT_USING_MESSAGEQUEUE
-// </section>
-// <section name="MM" description="Memory Management" default="always" >
-// <bool name="RT_USING_MEMPOOL" description="Using Memory Pool Management in the system" default="true" />
+/* Memory Management */
+
#define RT_USING_MEMPOOL
-// <bool name="RT_USING_MEMHEAP" description="Using Memory Heap Object in the system" default="true" />
-#define RT_USING_MEMHEAP
-// <bool name="RT_USING_HEAP" description="Using Dynamic Heap Management in the system" default="true" />
-#define RT_USING_HEAP
-// <bool name="RT_USING_SMALL_MEM" description="Optimizing for small memory" default="false" />
#define RT_USING_SMALL_MEM
-// <bool name="RT_USING_SLAB" description="Using SLAB memory management for large memory" default="false" />
-// #define RT_USING_SLAB
-// </section>
+#define RT_USING_HEAP
-// <section name="RT_USING_DEVICE" description="Using Device Driver Framework" default="true" >
-#define RT_USING_DEVICE
-// <bool name="RT_USING_UART" description="Using UART" default="true" />
-#define RT_USING_UART
-// <bool name="RT_USING_UART0" description="Using UART0" default="true" />
-#define RT_USING_UART0
-// <integer name="RT_UART_RX_BUFFER_SIZE" description="The buffer size for UART reception" default="64" />
-#define RT_UART_RX_BUFFER_SIZE 64
-// </section>
+/* Kernel Device Object */
-// <section name="RT_USING_CONSOLE" description="Using console" default="true" >
+#define RT_USING_DEVICE
#define RT_USING_CONSOLE
-// <integer name="RT_CONSOLEBUF_SIZE" description="The buffer size for console output" default="128" />
-#define RT_CONSOLEBUF_SIZE 128
-// <string name="RT_CONSOLE_DEVICE_NAME" description="The device name for console" default="uart" />
-#define RT_CONSOLE_DEVICE_NAME "uart0"
-// </section>
+#define RT_CONSOLEBUF_SIZE 128
+#define RT_CONSOLE_DEVICE_NAME "uart"
+#define RT_VER_NUM 0x40002
+
+/* RT-Thread Components */
-// <bool name="RT_USING_COMPONENTS_INIT" description="Using RT-Thread components initialization" default="true" />
#define RT_USING_COMPONENTS_INIT
-// <section name="RT_USING_FINSH" description="Using finsh as shell, which is a C-Express shell" default="true" >
+#define RT_USING_USER_MAIN
+#define RT_MAIN_THREAD_STACK_SIZE 2048
+#define RT_MAIN_THREAD_PRIORITY 10
+
+/* C++ features */
+
+
+/* Command shell */
+
#define RT_USING_FINSH
-// <bool name="FINSH_USING_SYMTAB" description="Using symbol table in finsh shell" default="true" />
+#define FINSH_THREAD_NAME "tshell"
+#define FINSH_USING_HISTORY
+#define FINSH_HISTORY_LINES 5
#define FINSH_USING_SYMTAB
-// <bool name="FINSH_USING_DESCRIPTION" description="Keeping description in symbol table" default="true" />
#define FINSH_USING_DESCRIPTION
-// <integer name="FINSH_THREAD_STACK_SIZE" description="The stack size for finsh thread" default="4096" />
-#define FINSH_THREAD_STACK_SIZE 4096
-// </section>
+#define FINSH_THREAD_PRIORITY 20
+#define FINSH_THREAD_STACK_SIZE 4096
+#define FINSH_CMD_SIZE 80
+#define FINSH_USING_MSH
+#define FINSH_USING_MSH_DEFAULT
+#define FINSH_ARG_MAX 10
+
+/* Device virtual file system */
+
+#define RT_USING_DFS
+#define DFS_USING_WORKDIR
+#define DFS_FILESYSTEMS_MAX 2
+#define DFS_FILESYSTEM_TYPES_MAX 2
+#define DFS_FD_MAX 16
+#define RT_USING_DFS_DEVFS
+
+/* Device Drivers */
+
+#define RT_USING_DEVICE_IPC
+#define RT_PIPE_BUFSZ 512
+#define RT_USING_SERIAL
+#define RT_SERIAL_USING_DMA
+#define RT_SERIAL_RB_BUFSZ 64
+#define RT_USING_PIN
+
+/* Using USB */
+
+
+/* POSIX layer and C standard library */
-// <section name="RT_USING_LIBC" description="C Runtime library setting" default="true" >
#define RT_USING_LIBC
-// <bool name="RT_USING_PTHREADS" description="Using POSIX threads library" default="true" />
-#define RT_USING_PTHREADS
-// </section>
+#define RT_USING_POSIX
+
+/* Network */
+
+/* Socket abstraction layer */
+
+
+/* Network interface device */
+
+
+/* light weight TCP/IP stack */
+
-// <section name="RT_USING_DFS" description="Device file system" default="true" >
-// #define RT_USING_DFS
-// <bool name="DFS_USING_WORKDIR" description="Using working directory" default="true" />
-// #define DFS_USING_WORKDIR
-// <integer name="DFS_FILESYSTEMS_MAX" description="The maximal number of mounted file system" default="4" />
-#define DFS_FILESYSTEMS_MAX 2
-// <integer name="DFS_FD_MAX" description="The maximal number of opened files" default="4" />
-#define DFS_FD_MAX 4
-// <bool name="RT_USING_DFS_ELMFAT" description="Using ELM FatFs" default="true" />
-#define RT_USING_DFS_ELMFAT
-// <integer name="RT_DFS_ELM_USE_LFN" description="Support long file name" default="0">
-// <item description="LFN1">1</item>
-// <item description="LFN1">2</item>
-// </integer>
-#define RT_DFS_ELM_USE_LFN 1
-// <integer name="RT_DFS_ELM_MAX_LFN" description="Maximal size of file name length" default="255" />
-#define RT_DFS_ELM_MAX_LFN 64
-// <bool name="RT_USING_DFS_YAFFS2" description="Using YAFFS2" default="false" />
-// #define RT_USING_DFS_YAFFS2
-// <bool name="RT_USING_DFS_UFFS" description="Using UFFS" default="false" />
-// #define RT_USING_DFS_UFFS
-// <bool name="RT_USING_DFS_DEVFS" description="Using devfs for device objects" default="true" />
-// #define RT_USING_DFS_DEVFS
-// <bool name="RT_USING_DFS_NFS" description="Using NFS v3 client file system" default="false" />
-// #define RT_USING_DFS_NFS
-// <string name="RT_NFS_HOST_EXPORT" description="NFSv3 host export" default="192.168.1.5:/" />
-#define RT_NFS_HOST_EXPORT "192.168.1.5:/"
-// </section>
+/* AT commands */
-// <section name="RT_USING_LWIP" description="lwip, a lightweight TCP/IP protocol stack" default="true" >
-// #define RT_USING_LWIP
-// <bool name="RT_LWIP_ICMP" description="Enable ICMP protocol" default="true" />
-#define RT_LWIP_ICMP
-// <bool name="RT_LWIP_IGMP" description="Enable IGMP protocol" default="false" />
-// #define RT_LWIP_IGMP
-// <bool name="RT_LWIP_UDP" description="Enable UDP protocol" default="true" />
-#define RT_LWIP_UDP
-// <bool name="RT_LWIP_TCP" description="Enable TCP protocol" default="true" />
-#define RT_LWIP_TCP
-// <bool name="RT_LWIP_DNS" description="Enable DNS protocol" default="true" />
-#define RT_LWIP_DNS
-// <integer name="RT_LWIP_PBUF_NUM" description="Maximal number of buffers in the pbuf pool" default="4" />
-#define RT_LWIP_PBUF_NUM 4
-// <integer name="RT_LWIP_TCP_PCB_NUM" description="Maximal number of simultaneously active TCP connections" default="5" />
-#define RT_LWIP_TCP_PCB_NUM 3
-// <integer name="RT_LWIP_TCP_SND_BUF" description="TCP sender buffer size" default="8192" />
-#define RT_LWIP_TCP_SND_BUF 2048
-// <integer name="RT_LWIP_TCP_WND" description="TCP receive window" default="8192" />
-#define RT_LWIP_TCP_WND 2048
-// <bool name="RT_LWIP_SNMP" description="Enable SNMP protocol" default="false" />
-// #define RT_LWIP_SNMP
-// <bool name="RT_LWIP_DHCP" description="Enable DHCP client to get IP address" default="false" />
-// #define RT_LWIP_DHCP
-// <integer name="RT_LWIP_TCP_SEG_NUM" description="the number of simultaneously queued TCP" default="4" />
-#define RT_LWIP_TCP_SEG_NUM 4
-// <integer name="RT_LWIP_TCPTHREAD_PRIORITY" description="the thread priority of TCP thread" default="128" />
-#define RT_LWIP_TCPTHREAD_PRIORITY 12
-// <integer name="RT_LWIP_TCPTHREAD_MBOX_SIZE" description="the mail box size of TCP thread to wait for" default="32" />
-#define RT_LWIP_TCPTHREAD_MBOX_SIZE 8
-// <integer name="RT_LWIP_TCPTHREAD_STACKSIZE" description="the thread stack size of TCP thread" default="4096" />
-#define RT_LWIP_TCPTHREAD_STACKSIZE 4096
-// <integer name="RT_LWIP_ETHTHREAD_PRIORITY" description="the thread priority of ethnetif thread" default="144" />
-#define RT_LWIP_ETHTHREAD_PRIORITY 14
-// <integer name="RT_LWIP_ETHTHREAD_MBOX_SIZE" description="the mail box size of ethnetif thread to wait for" default="8" />
-#define RT_LWIP_ETHTHREAD_MBOX_SIZE 8
-// <integer name="RT_LWIP_ETHTHREAD_STACKSIZE" description="the stack size of ethnetif thread" default="512" />
-#define RT_LWIP_ETHTHREAD_STACKSIZE 512
-// <ipaddr name="RT_LWIP_IPADDR" description="IP address of device" default="192.168.1.30" />
-#define RT_LWIP_IPADDR0 192
-#define RT_LWIP_IPADDR1 168
-#define RT_LWIP_IPADDR2 1
-#define RT_LWIP_IPADDR3 30
-// <ipaddr name="RT_LWIP_GWADDR" description="Gateway address of device" default="192.168.1.1" />
-#define RT_LWIP_GWADDR0 192
-#define RT_LWIP_GWADDR1 168
-#define RT_LWIP_GWADDR2 1
-#define RT_LWIP_GWADDR3 1
-// <ipaddr name="RT_LWIP_MSKADDR" description="Mask address of device" default="255.255.255.0" />
-#define RT_LWIP_MSKADDR0 255
-#define RT_LWIP_MSKADDR1 255
-#define RT_LWIP_MSKADDR2 255
-#define RT_LWIP_MSKADDR3 0
-// </section>
-// <section name="RT_USING_MODULE" description="Application module" default="true" >
-// #define RT_USING_MODULE
-// </section>
+/* VBUS(Virtual Software BUS) */
-// <section name="RT_USING_RTGUI" description="RTGUI, a graphic user interface" default="true" >
-// #define RT_USING_RTGUI
-// <integer name="RTGUI_NAME_MAX" description="Maximal size of RTGUI object name length" default="16" />
-#define RTGUI_NAME_MAX 16
-// <bool name="RTGUI_USING_FONT16" description="Support 16 weight font" default="true" />
-#define RTGUI_USING_FONT16
-// <bool name="RTGUI_USING_FONT12" description="Support 12 weight font" default="true" />
-#define RTGUI_USING_FONT12
-// <bool name="RTGUI_USING_FONTHZ" description="Support Chinese font" default="true" />
-#define RTGUI_USING_FONTHZ
-// <bool name="RTGUI_USING_DFS_FILERW" description="Using DFS as file interface " default="true" />
-#define RTGUI_USING_DFS_FILERW
-// <bool name="RTGUI_USING_HZ_FILE" description="Using font file as Chinese font" default="false" />
-// #define RTGUI_USING_HZ_FILE
-// <bool name="RTGUI_USING_HZ_BMP" description="Using Chinese bitmap font" default="true" />
-#define RTGUI_USING_HZ_BMP
-// <bool name="RTGUI_USING_SMALL_SIZE" description="Using small size in RTGUI" default="false" />
-#define RTGUI_USING_SMALL_SIZE
-// <bool name="RTGUI_USING_MOUSE_CURSOR" description="Using mouse cursor in RTGUI" default="false" />
-// #define RTGUI_USING_MOUSE_CURSOR
-// <bool name="RTGUI_IMAGE_XPM" description="Using xpm image in RTGUI" default="true" />
-#define RTGUI_IMAGE_XPM
-// <bool name="RTGUI_IMAGE_JPEG" description="Using jpeg image in RTGUI" default="true" />
-// #define RTGUI_IMAGE_JPEG
-// <bool name="RTGUI_IMAGE_PNG" description="Using png image in RTGUI" default="true" />
-// #define RTGUI_IMAGE_PNG
-// <bool name="RTGUI_IMAGE_BMP" description="Using bmp image in RTGUI" default="true" />
-#define RTGUI_IMAGE_BMP
-// </section>
-// </RDTConfigurator>
+/* Utilities */
+
+
+/* RT-Thread MIPS CPU */
+
+
+/* RT-Thread online packages */
+
+/* IoT - internet of things */
+
+
+/* Wi-Fi */
+
+/* Marvell WiFi */
+
+
+/* Wiced WiFi */
+
+
+/* IoT Cloud */
+
+
+/* security packages */
+
+
+/* language packages */
+
+
+/* multimedia packages */
+
+
+/* tools packages */
+
+
+/* system packages */
+
+
+/* peripheral libraries and drivers */
+
+
+/* miscellaneous packages */
+
+
+/* samples: kernel and components samples */
+
+#define SOC_LS1B
+#define RT_USING_UART0
+#define RT_UART_RX_BUFFER_SIZE 64
#endif
diff --git a/bsp/ls1bdev/rtconfig.py b/bsp/ls1bdev/rtconfig.py
index 4dcbf0bd75..a2c78a926a 100644
--- a/bsp/ls1bdev/rtconfig.py
+++ b/bsp/ls1bdev/rtconfig.py
@@ -2,7 +2,7 @@ import os
# CPU options
ARCH='mips'
-CPU ='loongson_1b'
+CPU ='gs232'
# toolchains options
CROSS_TOOL = 'gcc'
@@ -12,7 +12,8 @@ if os.getenv('RTT_CC'):
if CROSS_TOOL == 'gcc':
PLATFORM = 'gcc'
- EXEC_PATH = r'C:\Program Files\CodeSourcery\Sourcery G++ Lite For MIPS ELF\bin'
+ EXEC_PATH = "/opt/mips-2016.05/bin"
+# EXEC_PATH = r'D:\mgc\embedded\codebench\bin'
else:
print('================ERROR============================')
print('Not support %s yet!' % CROSS_TOOL)
@@ -35,9 +36,9 @@ OBJDUMP = PREFIX + 'objdump'
OBJCPY = PREFIX + 'objcopy'
READELF = PREFIX + 'readelf'
-DEVICE = ' -mips32'
+DEVICE = ' -mips32r2'
CFLAGS = DEVICE + ' -EL -G0 -mno-abicalls -fno-pic -fno-builtin -fno-exceptions -ffunction-sections -fomit-frame-pointer'
-AFLAGS = ' -c' + DEVICE + ' -EL -fno-pic -fno-builtin -mno-abicalls -x assembler-with-cpp -DSYSTEM_STACK=0x80003fe8'
+AFLAGS = ' -c' + DEVICE + ' -EL -fno-pic -fno-builtin -mno-abicalls -x assembler-with-cpp'
LFLAGS = DEVICE + ' -nostartfiles -EL -Wl,--gc-sections,-Map=rtthread.map,-cref,-u,Reset_Handler -T ls1b_ram.lds'
CPATH = ''