diff --git a/bsp/sep6200/application/application.c b/bsp/sep6200/application/application.c index 2fbb1b803e3d6be35c31252abc5cfb556d406835..cbc4cd4d473682028339f327fad39180fdf8fdf2 100644 --- a/bsp/sep6200/application/application.c +++ b/bsp/sep6200/application/application.c @@ -1,17 +1,25 @@ /* * File : application.c * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team + * COPYRIGHT (C) 2006 - 2013, RT-Thread Development 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 + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * Change Logs: * Date Author Notes - * 2007-11-20 Yi.Qiu add rtgui application - * 2008-6-28 Bernard no rtgui init - * 2013-7-14 Peng Fan modified from mini4020 + * 2013-7-14 Peng Fan Simple application */ /** @@ -23,18 +31,6 @@ #include "board.h" #include -#ifdef RT_USING_DFS -#include -#include -#include -#include -#endif - -#ifdef RT_USING_RTGUI -#include -extern void radio_rtgui_init(void); -#endif - #define RT_INIT_THREAD_STACK_SIZE (2*1024) void rt_init_thread_entry(void *parameter) diff --git a/bsp/sep6200/application/startup.c b/bsp/sep6200/application/startup.c index 6302c62512cdfc95e44b94ad1c4c74442286da4e..6c9d390fa2956ed0a4d856e2b8dd1153425d12e4 100644 --- a/bsp/sep6200/application/startup.c +++ b/bsp/sep6200/application/startup.c @@ -1,11 +1,21 @@ /* - * File : application.c + * File : startup.c * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2009 - 2012, RT-Thread Development Team + * COPYRIGHT (C) 2006 - 2013, RT-Thread Development 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 + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * Change Logs: * Date Author Notes @@ -71,12 +81,11 @@ void rtthread_startup() #ifdef RT_USING_DEVICE #ifdef RT_USING_DFS - rt_hw_sdcard_init(); + /* Not implemented */ #endif #ifdef RT_USING_LWIP - eth_system_device_init(); - rt_hw_dm9000_init(); + /* Not implemented */ #endif /*init all registed devices */ @@ -106,16 +115,3 @@ void rtthread_startup() return ; } - -int main() -{ - rt_uint32_t UNUSED level; - - /* disable interrupt first */ - level = rt_hw_interrupt_disable(); - - /* startup RT-Thread RTOS */ - rtthread_startup(); - - return 0; -} diff --git a/bsp/sep6200/board.h b/bsp/sep6200/board.h index deaf15d16fb2cc334f0291f54b0a0fd61dd7a596..91b745b516b8be3786672fc9adf1027430f0739b 100644 --- a/bsp/sep6200/board.h +++ b/bsp/sep6200/board.h @@ -1,11 +1,21 @@ /* * File : board.h * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2009 - 2012, RT-Thread Development Team + * COPYRIGHT (C) 2006 - 2013, RT-Thread Development 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 + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * Change Logs: * Date Author Notes @@ -20,6 +30,5 @@ #include void rt_hw_board_init(void); -void rt_hw_sdcard_init(void); #endif diff --git a/bsp/sep6200/drivers/board.c b/bsp/sep6200/drivers/board.c index e71449809c059f1c862c2ffa8cd75d76c7faa1bf..bc8756c9a1ff5b8dcb2741afa269ff4c9d5a227a 100644 --- a/bsp/sep6200/drivers/board.c +++ b/bsp/sep6200/drivers/board.c @@ -1,17 +1,32 @@ /* * File : board.c * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006 - 2012 RT-Thread Develop Team + * COPYRIGHT (C) 2006 - 2013, RT-Thread Development Team * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://openlab.rt-thread.com/license/LICENSE + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * Change Logs: * Date Author Notes * 2013-7-14 Peng Fan sep6200 implementation */ +/** + * @addtogroup sep6200 + */ + +/*@{*/ #include #include @@ -49,7 +64,6 @@ void rt_timer_handler(int vector, void *param) /* * This function will handle serial interrupt */ -#if 1 void rt_serial_handler(int vector, void *param) { rt_uint32_t num; @@ -76,12 +90,10 @@ void rt_serial_handler(int vector, void *param) break; } } -#endif /* * This function will init timer2 for system ticks */ - #define BUS4_FREQ 320000000UL #define TIMER_CLK BUS4_FREQ #define HZ 100 @@ -147,19 +159,6 @@ void rt_hw_serial_putc(const char c) *(RP)(SEP6200_UART0_TXFIFO) = c; } -void printhex(unsigned int data) -{ - int i = 0,a = 0; - for (i = 0; i < 8; i++) { - a = (data>>(32-(i+1)*4))&0xf; - if (((a<=9)&&(a>=0))) - rt_hw_serial_putc(a + 0x30); - else if ((a <= 0xf) && (a >= 0xa)) - rt_hw_serial_putc(a-0xa+0x61); - } - rt_hw_serial_putc('\n'); -} - /** * This function is used by rt_kprintf to display a string on console. * @@ -171,3 +170,5 @@ void rt_hw_console_output(const char *str) rt_hw_serial_putc(*str++); } } + +/*@}*/ diff --git a/bsp/sep6200/rtconfig.h b/bsp/sep6200/rtconfig.h index b3f260531b303e25c31ec4ebcf958d62a405b30d..e2ca52cc5c14c95766a86970ea4ecb04ff7aecee 100644 --- a/bsp/sep6200/rtconfig.h +++ b/bsp/sep6200/rtconfig.h @@ -3,16 +3,16 @@ #define __RTTHREAD_CFG_H__ #define RT_DEBUG -//#define RT_DEBUG_IRQ 1 -//#define RT_DEBUG_TIMER 1 +/* #define RT_DEBUG_IRQ 1 */ +/* #define RT_DEBUG_TIMER 1 */ -//#define RT_DEBUG_MEM 1 -//#define RT_DEBUG_MEMHEAP 1 -//#define RT_DEBUG_MODULE 1 -//#define RT_DEBUG_SCHEDULER 1 -//#define RT_DEBUG_SLAB 1 -//#define RT_DEBUG_THREAD 1 -//#define RT_DEBUG_IPC 1 +/* #define RT_DEBUG_MEM 1 */ +/* #define RT_DEBUG_MEMHEAP 1 */ +/* #define RT_DEBUG_MODULE 1 */ +/* #define RT_DEBUG_SCHEDULER 1 */ +/* #define RT_DEBUG_SLAB 1 */ +/* #define RT_DEBUG_THREAD 1 */ +/* #define RT_DEBUG_IPC 1 */ /* RT_NAME_MAX*/ #define RT_NAME_MAX 8 @@ -37,7 +37,7 @@ #define RT_USING_HOOK /* Using Software Timer */ -//#define RT_USING_TIMER_SOFT +#define RT_USING_TIMER_SOFT #define RT_TIMER_THREAD_PRIO 8 #define RT_TIMER_THREAD_STACK_SIZE 512 #define RT_TIMER_TICK_PER_SECOND 10 @@ -98,8 +98,8 @@ /* SECTION: Device filesystem support */ /* using DFS support */ -//#define RT_USING_DFS //fanpeng -//#define RT_USING_DFS_ELMFAT //fanpeng +/* #define RT_USING_DFS */ +/* #define RT_USING_DFS_ELMFAT */ /* #define RT_USING_DFS_YAFFS2 */ /* #define DFS_USING_WORKDIR */ @@ -113,8 +113,8 @@ /* SECTION: lwip, a lighwight TCP/IP protocol stack */ /* Using lighweight TCP/IP protocol stack */ -//#define RT_USING_LWIP -//#define RT_LWIP_DNS +/* #define RT_USING_LWIP */ +/* #define RT_LWIP_DNS */ /* Trace LwIP protocol */ /* #define RT_LWIP_DEBUG */ diff --git a/bsp/sep6200/rtconfig.py b/bsp/sep6200/rtconfig.py index f2e4a3afdc9a9180add494fc87b15bd13a61e177..58b05417ade67e05656c241f9c5a66a40d867cae 100644 --- a/bsp/sep6200/rtconfig.py +++ b/bsp/sep6200/rtconfig.py @@ -3,7 +3,7 @@ import os # toolchains options ARCH = 'unicore32' CPU = 'sep6200' -TextBase = '0x00000000' +TextBase = '0x40000000' CROSS_TOOL = 'gcc' @@ -13,10 +13,7 @@ if os.getenv('RTT_CC'): if CROSS_TOOL == 'gcc': PLATFORM = 'gcc' EXEC_PATH = '/usr/unicore/gnu-toolchain-unicore/uc4-1.0-beta-hard-RHELAS5/bin/' -elif CROSS_TOOL == 'keil': - PLATFORM = 'armcc' - EXEC_PATH = 'C:/Keil' -elif CROSS_TOOL == 'iar': +else : print '================ERROR============================' print 'Not support yet!' print '=================================================' @@ -43,7 +40,7 @@ if PLATFORM == 'gcc': DEVICE = ' ' CFLAGS = DEVICE AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp' + ' -DTEXT_BASE=' + TextBase - LFLAGS = DEVICE + ' -Bstatic --gc-sections -Map=rtthread_sep6200.map -cref -u _start -Ttext 0x40000000 -T sep6200.ld -L/usr/unicore/gnu-toolchain-unicore/uc4-1.0-beta-hard-RHELAS5/lib/gcc/unicore32-linux/4.4.2 -lgcc' + ' -Ttext ' + TextBase + LFLAGS = DEVICE + ' -Bstatic --gc-sections -Map=rtthread_sep6200.map -cref -u _start -T sep6200.ld -L/usr/unicore/gnu-toolchain-unicore/uc4-1.0-beta-hard-RHELAS5/lib/gcc/unicore32-linux/4.4.2 -lgcc' + ' -Ttext ' + TextBase CPATH = '' LPATH = '' diff --git a/libcpu/unicore32/sep6200/clk.c b/libcpu/unicore32/sep6200/clk.c deleted file mode 100644 index f31bd6b6949b2f4953691b25120a04b4a0bd1e6b..0000000000000000000000000000000000000000 --- a/libcpu/unicore32/sep6200/clk.c +++ /dev/null @@ -1,164 +0,0 @@ -/* - * File : clock.c - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006, RT-Thread Development Team - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://openlab.rt-thread.com/license/LICENSE - * - * Change Logs: - * Date Author Notes - * 2013-7-16 Peng Fan Just put the file here, should be implemented in - * future - */ - -#include -#include - -#define PLL_CFG(_f, _r) {.f = _f, .r = _r} /*f(frequency, MHz); r(config register value)*/ -#define MHz 1000000UL -/* -*SEP0611_CLOCK -*├── APLL -*│   └── CPU -*├── DPLL -*│   └── DDR -*└── MPLL -* └── BUS1 -* ├── BUS2 -* │   ├── DMAC1 -* │   ├── ESRAM -* │   ├── LCDC -* │   ├── NAND -* │   ├── NOR -* │   ├── SDIO1 -* │   ├── SDIO2 -* │   └── VPU -* ├── BUS3 -* │   ├── BUS5 -* │   │   ├── I2C1 -* │   │   ├── I2C2 -* │   │   ├── I2C3 -* │   │   ├── I2S -* │   │   ├── SPI1 -* │   │   ├── SPI2 -* │   │   ├── SPI3 -* │   │   ├── UART1 -* │   │   ├── UART2 -* │   │   ├── UART3 -* │   │   └── UART4 -* │   ├── DMAC2 -* │   ├── GPU -* │   └── USB -* ├── BUS4 -* │   ├── GPIO -* │   ├── GPSCTRL -* │   ├── PWM -* │   ├── RTC -* │   ├── SYSCTRL -* │   ├── TIMER -* │   └── VIC -* ├── DS1_2 -* ├── DS1_3 -* └── GPS -*/ - -enum sep0611_clk_gate{ - DDRC = 0, BUS1, BUS2, BUS3, DS1_2, - DS1_3, USBC, DMAC1, NAND, DMAC2, - ESRAM, SDIO1, SDIO2, GPU, VPU, - BUS4, BUS5, VIC_, SYSCTRL, PRTC, - TIMER, GPSCTRL, GPIO, LCDC2HDMI, DDRPHY, - UART1, UART2, UART3, UART4, SPI1, - SPI2, SPI3, - - I2C1 = 32, I2C2, I2C3, I2S, PWM, - H2X, LCDC, NOR, GPSHCLK, GPS, -}; - -typedef struct { - unsigned long f; - unsigned long r; -}pll_t; - -static pll_t apll_tab[] = { - PLL_CFG(800*MHz, 0x00010810), -}; - -static pll_t mpll_tab[] = { - PLL_CFG(480*MHz, 0x00013C12), // 480MHz -}; - -static pll_t dpll_tab[] = { - PLL_CFG(400*MHz, 0x00010812), // 402MHz -}; - -static void rt_hw_set_system_clock(void) -{ - /*apll, mpll, dpll is set in uboot when system boots up*/ -} - -static void rt_hw_set_usb_clock(void) -{ - -} - -static void rt_hw_set_peripheral_clock(void) -{ - -} -/** - * @brief System Clock Configuration - */ -/* apll mpll dpll should be set in u-boot, Here just set clock - * of the pherial - */ -void rt_hw_set_apll_clock(void) -{ - -} -void rt_hw_set_mpll_clock(void) -{ - -} -void rt_hw_set_dpll_clock(void) -{ - -} -void rt_hw_clock_init(void) -{ - /* set system clock */ - rt_hw_set_system_clock(); -} - -/** - * @brief Get system clock - */ -rt_uint32_t rt_hw_get_clock(void) -{ -} - -/** - * @brief Enable module clock - */ -void rt_hw_enable_module_clock(rt_uint8_t module) -{ - if (module >= 32) { - write_reg(SEP6200_PMU_CLK_GT_CFG2, (1 << (module - 32)) | read_reg(SEP6200_PMU_CLK_GT_CFG2)); - } else { - write_reg(SEP6200_PMU_CLK_GT_CFG1, (1 << module) | read_reg(SEP6200_PMU_CLK_GT_CFG1)); - } -} - -/** - * @brief Disable module clock - */ -void rt_hw_disable_module_clock(rt_uint8_t module) -{ - if (module >= 32) { - write_reg(SEP6200_PMU_CLK_GT_CFG2, ~(1 << (module - 32)) & read_reg(SEP6200_PMU_CLK_GT_CFG2)); - } else { - write_reg(SEP6200_PMU_CLK_GT_CFG1, ~(1 << module) & read_reg(SEP6200_PMU_CLK_GT_CFG1)); - } -} diff --git a/libcpu/unicore32/sep6200/context_gcc.S b/libcpu/unicore32/sep6200/context_gcc.S index dd75084061077a295b3f0bb6bdaaf5a3b97ee224..6b958e7f93866b6ac1ec8fafbb0d16f64b14bf4a 100644 --- a/libcpu/unicore32/sep6200/context_gcc.S +++ b/libcpu/unicore32/sep6200/context_gcc.S @@ -1,20 +1,31 @@ /* - * File : context.S + * File : context_gcc.S * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006, RT-Thread Development Team + * COPYRIGHT (C) 2006 - 2013, RT-Thread Development Team * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://openlab.rt-thread.com/license/LICENSE + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * Change Logs: * Date Author Notes - * 2013-7-14 Peng Fan First implementation + * 2013-7-14 Peng Fan sep6200 implementation */ -/*! +/** * \addtogroup sep6200 */ + /*@{*/ #define NOINT 0xc0 diff --git a/libcpu/unicore32/sep6200/cpu.c b/libcpu/unicore32/sep6200/cpu.c index 969a8041699d4046dda1fdc0966b490f93884f73..ebea8750e1ba46da455f1e4b55ca152301901fb9 100644 --- a/libcpu/unicore32/sep6200/cpu.c +++ b/libcpu/unicore32/sep6200/cpu.c @@ -1,15 +1,25 @@ /* * File : cpu.c * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006, RT-Thread Develop Team + * COPYRIGHT (C) 2006 - 2013, RT-Thread Development Team * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://openlab.rt-thread.com/license/LICENSE + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * Change Logs: * Date Author Notes - * 2013-7-14 Peng Fan first implementation + * 2013-7-14 Peng Fan sep6200 implementation */ #include diff --git a/libcpu/unicore32/sep6200/interrupt.c b/libcpu/unicore32/sep6200/interrupt.c index dbfd52978693809f0af746d37160033a68ed18c0..5d088f788aa6aef394584ba66362af08a24331c4 100644 --- a/libcpu/unicore32/sep6200/interrupt.c +++ b/libcpu/unicore32/sep6200/interrupt.c @@ -1,15 +1,25 @@ /* * File : interrupt.c * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006, RT-Thread Development Team + * COPYRIGHT (C) 2006 - 2013, RT-Thread Development Team * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://openlab.rt-thread.com/license/LICENSE + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * Change Logs: * Date Author Notes - * 2013-7-14 Peng Fan First implementation + * 2013-7-14 Peng Fan sep6200 implementation */ #include diff --git a/libcpu/unicore32/sep6200/sep6200.h b/libcpu/unicore32/sep6200/sep6200.h index 01c6b8b5480c9ab1ec742192bba2d7ff0ed1b67b..c09823740b09a7e5c0f080b520d98c7db1e25893 100644 --- a/libcpu/unicore32/sep6200/sep6200.h +++ b/libcpu/unicore32/sep6200/sep6200.h @@ -1,3 +1,27 @@ +/* + * File : sep6200.h + * This file is part of RT-Thread RTOS + * COPYRIGHT (C) 2006 - 2013, RT-Thread Development Team + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Change Logs: + * Date Author Notes + * 2013-7-17 Peng Fan sep6200 implementation + */ + #ifndef __SEP6200_H #define __SEP6200_H diff --git a/libcpu/unicore32/sep6200/serial.c b/libcpu/unicore32/sep6200/serial.c index aeb9d6949078eea358f574e3e9ff1922970d5a0d..4be71127de3b2e8eebdff57d26c2c2c48e028a0c 100644 --- a/libcpu/unicore32/sep6200/serial.c +++ b/libcpu/unicore32/sep6200/serial.c @@ -1,11 +1,21 @@ /* * File : serial.c * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006, RT-Thread Development Team + * COPYRIGHT (C) 2006 - 2013, RT-Thread Development Team * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://openlab.rt-thread.com/license/LICENSE + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * Change Logs: * Date Author Notes @@ -16,7 +26,7 @@ #include "serial.h" /** - * @addtogroup SEP6200 + * @addtogroup sep6200 */ /*@{*/ diff --git a/libcpu/unicore32/sep6200/serial.h b/libcpu/unicore32/sep6200/serial.h index 7d06741a563e455769da8edc63b001f3fd9b8798..e626f5e20fff05bbf61c1e18d5527cd590c962b7 100644 --- a/libcpu/unicore32/sep6200/serial.h +++ b/libcpu/unicore32/sep6200/serial.h @@ -1,11 +1,21 @@ /* - * File : serial.c + * File : serial.h * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006, RT-Thread Development Team + * COPYRIGHT (C) 2006 - 2013, RT-Thread Development Team * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://openlab.rt-thread.com/license/LICENSE + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * Change Logs: * Date Author Notes diff --git a/libcpu/unicore32/sep6200/stack.c b/libcpu/unicore32/sep6200/stack.c index f6e639967465f4d8c1f3199b408a76e2575c4ae5..722f40835e82190f68b0455b6bdf81e857e39f0b 100644 --- a/libcpu/unicore32/sep6200/stack.c +++ b/libcpu/unicore32/sep6200/stack.c @@ -1,15 +1,25 @@ /* * File : stack.c * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006, RT-Thread Development Team + * COPYRIGHT (C) 2006 - 2013, RT-Thread Development Team * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://openlab.rt-thread.com/license/LICENSE + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * Change Logs: * Date Author Notes - * 2013-7-14 Peng Fan Modifiled from sep4020 + * 2013-7-14 Peng Fan sep6200 implementation */ #include diff --git a/libcpu/unicore32/sep6200/start_gcc.S b/libcpu/unicore32/sep6200/start_gcc.S index c7aeaa135a1f833dce3344f78f4fba804e91d429..4dd17aa387cc323cab0fa42c5dbe134fd618eaee 100644 --- a/libcpu/unicore32/sep6200/start_gcc.S +++ b/libcpu/unicore32/sep6200/start_gcc.S @@ -1,11 +1,21 @@ /* * File : start.S * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006, RT-Thread Development Team + * COPYRIGHT (C) 2006 - 2013, RT-Thread Development Team * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http:/*openlab.rt-thread.com/license/LICENSE + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * Change Logs: * Date Author Notes @@ -61,10 +71,6 @@ .equ MODEMASK, 0x1f .equ NOINT, 0xc0 -.equ RAM_BASE, 0x00000000 /*Start address of RAM */ - - - /* ************************************************************************* * @@ -127,13 +133,12 @@ _bss_end: .globl IRQ_STACK_START IRQ_STACK_START: - .word _irq_stack_start + 10240 - 4 + .word _irq_stack_start + 1024 .globl FIQ_STACK_START FIQ_STACK_START: .word _fiq_stack_start +1024 -/*peng not sure*/ .globl UNDEFINED_STACK_START UNDEFINED_STACK_START: .word _undefined_stack_start + CONFIG_STACKSIZE @@ -144,7 +149,7 @@ ABORT_STACK_START: .globl _STACK_START _STACK_START: - .word _priv_stack_start + 40960 - 4 + .word _priv_stack_start + 4096 .equ SEP6200_VIC_BASE, 0xb0000000 .equ SEP6200_SYSCTL_BASE, 0xb0008000 @@ -176,6 +181,7 @@ reset: /* setup stack */ b.l stack_setup + /* copy the vector code to address 0 */ ldw r12, =0x100 ldw r0, = 0x40000000 ldw r1, = 0x00000000 @@ -220,7 +226,7 @@ ctor_end: andn r1, r0, #NOINT mov.a asr, r1 - /* start RT-Thread Kernel */ + /* start RT-Thread Kernel */ ldw pc, _rtthread_startup _rtthread_startup: @@ -235,18 +241,18 @@ _rtthread_startup: */ /* exception handlers */ -/*Just simple implementation here peng*/ +/*Just simple implementation here */ .align 5 extend_handle: - b extend_handle + b rt_hw_trap_extn swi_handle: - b swi_handle + b rt_hw_trap_swi iabort_handle: - b iabort_handle + b rt_hw_trap_pabt dabort_handle: - b dabort_handle + b rt_hw_trap_dabt reserve_handle: - b reserve_handle + b rt_hw_trap_resv .globl rt_interrupt_enter .globl rt_interrupt_leave @@ -276,9 +282,7 @@ IRQ_handle: .align 5 FIQ_handle: - mov r0, #0x44 - b.l printhex - mov pc, lr + b rt_hw_trap_fiq _interrupt_thread_switch: @@ -290,21 +294,12 @@ _interrupt_thread_switch: ldm.w (r16 - r28), [sp]+ ldm.w (lr), [sp]+ - stm.w (r0-r3), [sp-] /*save r0-r3*/ + stm.w (r0 - r3), [sp-] /*save r0-r3*/ mov r1, sp add sp, sp, #16 /* restore sp */ mov r2, lr /* save old task's pc to r2 */ -#if 0 - mov r3, bsr /* disable interrupt */ - /*or r0, r3, #NOINT*/ - mov.a bsr, r3 - - ldw r0, =.+8 /* switch to interrupted task's stack */ - mov.a pc, r0 /*switch bsr to asr, irq to priv mode*/ - -#endif mov r3, bsr mov r0, #0xd3 /*I:F:0:PRIV*/ mov.a asr, r0 @@ -312,23 +307,24 @@ _interrupt_thread_switch: stm.w (r2), [sp-] /* push old task's pc */ /* push old task's registers */ - stm.w (r16, r17, r18, r19, r20, r21, r22, r23, r24, r25, r26, r27, r28, lr), [sp-] - stm.w (r4, r5, r6, r7, r8, r9, r10, r11, r12, r13, r14, r15), [sp-] + stm.w (lr), [sp-] + stm.w (r16 - r28), [sp-] + stm.w (r4 - r15), [sp-] mov r4, r1 /* Special optimised code below */ - mov r5, r3 /*pengpengpengpeng*/ - ldm.w (r0,r1, r2, r3), [r4]+ - stm.w (r0, r1, r2, r3), [sp-] /*push old task's r3-r0*/ + mov r5, r3 + ldm.w (r0 - r3), [r4]+ + stm.w (r0 - r3), [sp-] /*push old task's r3-r0*/ stm.w (r5), [sp-] /* push old task's asr */ - mov r4, bsr - stm.w (r4), [sp-] /* push old task's bsr I am not sure peng*/ + mov r4, bsr + stm.w (r4), [sp-] /* push old task's bsr*/ ldw r4, =rt_interrupt_from_thread ldw r5, [r4+] - stw sp, [r5+] /* store sp in preempted tasks's TCB*/ + stw sp, [r5+] /* store sp in preempted tasks's TCB*/ ldw r6, =rt_interrupt_to_thread ldw r6, [r6+] - ldw sp, [r6+] /* get new task's stack pointer */ + ldw sp, [r6+] /* get new task's stack pointer */ ldm.w (r4), [sp]+ /* pop new task's spsr */ mov.a bsr, r4 @@ -340,14 +336,7 @@ _interrupt_thread_switch: ldm.w (r0 - r15), [sp]+ ldm.w (r16 - r28), [sp]+ ldm.w (lr), [sp]+ - /*peng*/ ldm.w (pc), [sp]+ -#if 0 - mov r0, lr - b.l printhex - ldm.w (r0), [sp]+ - b.l printhex -#endif stack_setup: /*irq*/ diff --git a/libcpu/unicore32/sep6200/trace.c b/libcpu/unicore32/sep6200/trace.c index b842e5dd5629375207ba6874d823aeacbdc30ce8..8f11a18a17e23308dea2c5973a0ae517c11031f4 100644 --- a/libcpu/unicore32/sep6200/trace.c +++ b/libcpu/unicore32/sep6200/trace.c @@ -1,3 +1,26 @@ +/* + * File : trace.c + * This file is part of RT-Thread RTOS + * COPYRIGHT (C) 2006 - 2013, RT-Thread Development Team + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Change Logs: + * Date Author Notes + * 2017-07-17 Peng Fan sep6200 implementation + */ #include void rt_hw_backtrace(rt_uint32_t *fp, rt_uint32_t thread_entry) diff --git a/libcpu/unicore32/sep6200/trap.c b/libcpu/unicore32/sep6200/trap.c index 22689c42eb4b819d85ac343a548a502418206d70..1e5d02a279df027c5a4df590423d152cad579160 100644 --- a/libcpu/unicore32/sep6200/trap.c +++ b/libcpu/unicore32/sep6200/trap.c @@ -1,11 +1,21 @@ /* * File : trap.c * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006, RT-Thread Development Team + * COPYRIGHT (C) 2006 - 2013, RT-Thread Development Team * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://openlab.rt-thread.com/license/LICENSE + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * Change Logs: * Date Author Notes