Skip to content

Commit 255f8b7

Browse files
committed
[BSP] Add BSP for Ingenic X1000 CPU
1 parent bef87f8 commit 255f8b7

36 files changed

+6224
-0
lines changed

bsp/x1000/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# RT-Thread for Ingenic X1000 porting.

bsp/x1000/SConscript

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# for module compiling
2+
import os
3+
from building import *
4+
5+
cwd = GetCurrentDir()
6+
objs = []
7+
list = os.listdir(cwd)
8+
9+
for d in list:
10+
path = os.path.join(cwd, d)
11+
if os.path.isfile(os.path.join(path, 'SConscript')):
12+
objs = objs + SConscript(os.path.join(d, 'SConscript'))
13+
14+
Return('objs')

bsp/x1000/SConstruct

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import os
2+
import sys
3+
import rtconfig
4+
from rtconfig import RTT_ROOT
5+
6+
sys.path = sys.path + [os.path.join(RTT_ROOT, 'tools')]
7+
from building import *
8+
9+
TARGET = 'rtthread-x1000.' + rtconfig.TARGET_EXT
10+
11+
env = Environment(tools = ['mingw'],
12+
AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
13+
CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS,
14+
CXX = rtconfig.CC, CXXFLAGS = rtconfig.CXXFLAGS,
15+
AR = rtconfig.AR, ARFLAGS = '-rc',
16+
LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
17+
env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
18+
19+
Export('RTT_ROOT')
20+
Export('rtconfig')
21+
22+
# prepare building environment
23+
objs = PrepareBuilding(env, RTT_ROOT)
24+
25+
# make a building
26+
DoBuilding(TARGET, objs)

bsp/x1000/applications/SConscript

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
from building import *
2+
3+
cwd = GetCurrentDir()
4+
src = Glob('*.c')
5+
6+
CPPPATH = [cwd, str(Dir('#'))]
7+
8+
if not GetDepend("RT_USING_DFS_ROMFS"):
9+
SrcRemove(src, "romfs.c")
10+
11+
group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH)
12+
13+
Return('group')

bsp/x1000/applications/main.c

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
* File : _main.c
3+
* This file is part of RT-Thread RTOS
4+
* COPYRIGHT (C) 2008 - 2012, RT-Thread Development Team
5+
*
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.
10+
*
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.
19+
*
20+
* Change Logs:
21+
* Date Author Notes
22+
* 2015-11-19 Urey the first version
23+
*/
24+
#include <stdio.h>
25+
#include <stdlib.h>
26+
27+
int main(int argc, char** argv)
28+
{
29+
printf("Hello RT-Thread!\n");
30+
31+
return 0;
32+
}

bsp/x1000/applications/mnt.c

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/*
2+
* File : mnt.c
3+
* This file is part of RT-Thread RTOS
4+
* COPYRIGHT (C) 2008 - 2016, RT-Thread Development Team
5+
*
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.
10+
*
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.
19+
*
20+
* Change Logs:
21+
* Date Author Notes
22+
* 2015-11-19 Urey the first version
23+
*/
24+
25+
#include <rtthread.h>
26+
#include <rtdevice.h>
27+
28+
#include <dfs_fs.h>
29+
30+
int mnt_init(void)
31+
{
32+
#ifdef RT_USING_SDIO
33+
rt_mmcsd_core_init();
34+
rt_mmcsd_blk_init();
35+
36+
jz47xx_sdio_init();
37+
rt_thread_delay(RT_TICK_PER_SECOND * 1);
38+
39+
/* mount sd card fat partition 1 as root directory */
40+
if (dfs_mount("sd0", "/", "elm", 0, 0) == 0)
41+
{
42+
rt_kprintf("File System initialized!\n");
43+
}
44+
else
45+
{
46+
rt_kprintf("File System initialzation failed!\n");
47+
}
48+
#endif
49+
}
50+
INIT_ENV_EXPORT(mnt_init);

bsp/x1000/driver/SConscript

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# RT-Thread building script for component
2+
3+
from building import *
4+
5+
cwd = GetCurrentDir()
6+
src = Glob('*.c')
7+
CPPPATH = [cwd, str(Dir('#'))]
8+
9+
group = DefineGroup('Drivers', src, depend = [''], CPPPATH = CPPPATH)
10+
11+
Return('group')

bsp/x1000/driver/board.c

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/*
2+
* File : board.c
3+
* This file is part of RT-Thread RTOS
4+
* COPYRIGHT (C) 2008 - 2012, RT-Thread Development Team
5+
*
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.
10+
*
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.
19+
*
20+
* Change Logs:
21+
* Date Author Notes
22+
* 2015-11-19 Urey the first version
23+
*/
24+
25+
#include <rthw.h>
26+
#include <rtthread.h>
27+
28+
#include "board.h"
29+
#include "drv_clock.h"
30+
#include "drv_uart.h"
31+
#include "drv_ost.h"
32+
33+
extern void rt_hw_cache_init(void);
34+
35+
void rt_hw_board_init(void)
36+
{
37+
rt_hw_cache_init();
38+
/* init hardware interrupt */
39+
rt_hw_interrupt_init();
40+
rt_hw_uart_init();
41+
#ifdef RT_USING_CONSOLE
42+
/* set console device */
43+
rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
44+
#endif /* RT_USING_CONSOLE */
45+
46+
#ifdef RT_USING_HEAP
47+
/* init memory system */
48+
rt_system_heap_init(RT_HW_HEAP_BEGIN, RT_HW_HEAP_END);
49+
#endif
50+
51+
#ifdef RT_USING_COMPONENTS_INIT
52+
rt_components_board_init();
53+
#endif
54+
55+
rt_hw_ost_init();
56+
}

bsp/x1000/driver/board.h

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
/*
2+
* File : board.h
3+
* This file is part of RT-Thread RTOS
4+
* COPYRIGHT (C) 2008 - 2012, RT-Thread Development Team
5+
*
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.
10+
*
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.
19+
*
20+
* Change Logs:
21+
* Date Author Notes
22+
* 2015-11-19 Urey the first version
23+
*/
24+
25+
#ifndef _BOARD_H_
26+
#define _BOARD_H_
27+
28+
#include <stdint.h>
29+
30+
#include "x1000.h"
31+
32+
#define RT_USING_JZ_X1000
33+
34+
// #define BOARD_PHOENIX
35+
// #define BOARD_CANNA
36+
37+
#ifdef BOARD_PHOENIX
38+
#define RT_USING_EMAC
39+
#endif
40+
41+
/*********************************************************************************************************
42+
** Clock for Board
43+
*********************************************************************************************************/
44+
#define BOARD_EXTAL_CLK 24000000
45+
#define BOARD_RTC_CLK 32768
46+
#define BOARD_CPU_CLK (1008 * 1000 * 1000UL)
47+
48+
49+
/*********************************************************************************************************
50+
** HEAP Setting
51+
*********************************************************************************************************/
52+
extern unsigned char __bss_start;
53+
extern unsigned char __bss_end;
54+
55+
#define RT_HW_HEAP_BEGIN (void*)&__bss_end
56+
#define RT_HW_HEAP_END (void*)(0x80000000 + 32 * 1024 * 1024)
57+
58+
/*********************************************************************************************************
59+
** UART Setting
60+
*********************************************************************************************************/
61+
#define RT_USING_UART2
62+
63+
#endif

bsp/x1000/driver/board_io.c

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
* File : board_io.c
3+
* This file is part of RT-Thread RTOS
4+
* COPYRIGHT (C) 2008 - 2012, RT-Thread Development Team
5+
*
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.
10+
*
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.
19+
*
20+
* Change Logs:
21+
* Date Author Notes
22+
* 2015-11-19 Urey the first version
23+
*/
24+
#include <board.h>
25+
#include <rtthread.h>
26+
27+
#include "drv_gpio.h"

0 commit comments

Comments
 (0)