[bsp] add v2m-msp2 board support

This commit is contained in:
liang yongxiang committed 2018-03-01 23:24:41 +08:00
1 parent 44def114fb
commit 311f4c96dd
19 files changed
+3609

No files matched your search

File diff suppressed because it is too large. Load diff
+17
View File
@@ -0,0 +1,17 @@
/*----------------------------------------------------------------------------
* Name: Dbg_MPS2.ini
* Purpose: MPS2 Debug Initialization File
* Note(s):
*----------------------------------------------------------------------------
* This file is part of the uVision/ARM development tools.
* This software may only be used under the terms of a valid, current,
* end user licence from KEIL for a compatible version of KEIL software
* development tools. Nothing else gives you the right to use this software.
*
* This software is supplied "AS IS" without warranties of any kind.
*
* Copyright (c) 2013 Keil - An ARM Company. All rights reserved.
*----------------------------------------------------------------------------*/
_WDWORD(0x4001F000, 0x00000001); // Remap on
+35
View File
@@ -0,0 +1,35 @@
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 "$PKGS_DIR/Kconfig"
config SOC_V2M_MPS2
bool
select ARCH_ARM_CORTEX_M7
default y
config RT_USING_UART
bool "Using RT_USING_UART"
default y
if RT_USING_UART
config RT_USING_UART0
bool "Using RT_USING_UART0"
default y
endif
+84
View File
@@ -0,0 +1,84 @@
# V2M-MPS2
标签: 板级支持包文档
## 1. 简介
[说明硬件平台的基本情况,包括芯片情况,频率,RAM空间,Flash空间等,最好也提供一份照片图。资源介绍覆盖bsp相关的以及板子亮点情况就可以了,不需要完整]
[V2M-MPS2](https://www.keil.com/boards2/arm/v2m_mps2/)是MDK提供的开发板,配合**Fast Models Debugger**,就可以不依赖任何硬件,在Cortexm-M平台调试代码。板载主要资源如下:
| 硬件 | 描述 |
| -- | -- |
|CPU| 可选Cortex-M0/M0 plus/M3/M4/M7/M23/M33 |
|主频| 50MHz |
|SRAM| 4MB |
|Flash| 4MB |
## 2. 编译说明
V2M-MPS2板级包支持MDK5(已测试MDK5.23~MDK5.25可以)
## 3. 烧写及执行
### 3.1 配置和仿真
因为Fast Models Debugger的串口功能是通过telnet实现的,所以首先需要打开Windows的telnet功能:
- [Windows 7: Enabling Telnet Client](https://social.technet.microsoft.com/wiki/contents/articles/910.windows-7-enabling-telnet-client.aspx)
- [Windows 10: Enabling Telnet Client](https://social.technet.microsoft.com/wiki/contents/articles/38433.windows-10-enabling-telnet-client.aspx)
打开project.uvprojx,编译,点击Debug->Start/Stop Seccion就可以进入仿真了。
### 3.2 如何选择其他内核
Fast Models Debugger支持Cortex M全系列内核。如果想切换成其他内核,需要完成一些配置,下面以Cortex M4为例:
- 修改bsp\v2m-mps2\rtconfig.py里的 CPU="cortex-m7"为CPU="cortex-m4"
- 点击Project->Option for Target 'RT-Thread V2M-MPS2':
- 在Device里选择ARM选项下需要的内核CMSDK_CM4
- 在Debug里选择Models Cortex-M Debugger,点击Settings:
- 在Command里选择Cortex-M4的exe:FVP_MPS2_Cortex-M4_MDK.exe
- 在Target里选择armcortexm4ct
### 3.2 运行结果
进入仿真后全速运行,会在telnet窗口上看到RT-Thread的启动logo信息:
```bash
\ | /
- RT - Thread Operating System
/ | \ 3.0.3 build Feb 28 2018
2006 - 2017 Copyright by rt-thread team
finsh />
```
## 4. 驱动支持情况及计划
[片内外设可以说,片外的说重点不要求完整]
| 驱动 | 支持情况 | 备注 |
| ------ | ---- | :------: |
| UART | 支持 | UART0/1/2/3 |
| GPIO | 未支持 | |
| LED | 未支持 | |
| BUTTOM | 未支持 | |
| LCD | 未支持 | 需要完成LCD驱动和TOUCH驱动 |
### 4.1 IO在板级支持包中的映射情况(需补充)
| IO号 | 板级包中的定义 |
| -- | -- |
| | LED0 |
## 5. 联系人信息
维护人:[tanek](https://github.com/TanekLiang)
## 6. 参考
* [V2M-MPS2](https://www.keil.com/boards2/arm/v2m_mps2/)
* [Fast Models Debugger](http://www.keil.com/support/man/docs/fstmdls/default.htm)
+14
View File
@@ -0,0 +1,14 @@
# for module compiling
import os
Import('RTT_ROOT')
cwd = str(Dir('#'))
objs = []
list = os.listdir(cwd)
for d in list:
path = os.path.join(cwd, d)
if os.path.isfile(os.path.join(path, 'SConscript')):
objs = objs + SConscript(os.path.join(d, 'SConscript'))
Return('objs')
+47
View File
@@ -0,0 +1,47 @@
import os
import sys
import rtconfig
if os.getenv('RTT_ROOT'):
RTT_ROOT = os.getenv('RTT_ROOT')
else:
RTT_ROOT = os.path.normpath(os.getcwd() + '/../..')
sys.path = sys.path + [os.path.join(RTT_ROOT, 'tools')]
from building import *
TARGET = 'rtthread-v2m-mps2.' + rtconfig.TARGET_EXT
if rtconfig.PLATFORM == 'armcc':
env = Environment(tools = ['mingw'],
AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS,
CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS,
AR = rtconfig.AR, ARFLAGS = '-rc',
LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS,
# overwrite cflags, because cflags has '--C99'
CXXCOM = '$CXX -o $TARGET --cpp -c $CXXFLAGS $_CCCOMCOM $SOURCES')
else:
env = Environment(tools = ['mingw'],
AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS,
CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS,
AR = rtconfig.AR, ARFLAGS = '-rc',
LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS,
CXXCOM = '$CXX -o $TARGET -c $CXXFLAGS $_CCCOMCOM $SOURCES')
env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
if rtconfig.PLATFORM == 'iar':
env.Replace(CCCOM = ['$CC $CCFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -o $TARGET $SOURCES'])
env.Replace(ARFLAGS = [''])
env.Replace(LINKCOM = ['$LINK $SOURCES $LINKFLAGS -o $TARGET --map project.map'])
Export('RTT_ROOT')
Export('rtconfig')
# prepare building environment
objs = PrepareBuilding(env, RTT_ROOT, has_libcpu=False)
# make a building
DoBuilding(TARGET, objs)
+17
View File
@@ -0,0 +1,17 @@
Import('RTT_ROOT')
Import('rtconfig')
from building import *
cwd = os.path.join(str(Dir('#')), 'applications')
src = Glob('*.c')
CPPPATH = [cwd, str(Dir('#'))]
# add for startup script
if rtconfig.CROSS_TOOL == 'gcc':
CPPDEFINES = ['__START=entry']
else:
CPPDEFINES = []
group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH, CPPDEFINES=CPPDEFINES)
Return('group')
+32
View File
@@ -0,0 +1,32 @@
/*
* File : main.c
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2012, 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
* 2018-03-01 Tanek the first version
*/
#include <stdio.h>
#include <rtthread.h>
int main(void)
{
return 0;
}
+16
View File
@@ -0,0 +1,16 @@
from building import *
cwd = GetCurrentDir()
# add the general drivers.
src = Split("""
board.c
drv_uart.c
""")
CPPPATH = [cwd]
CPPDEFINES = []
group = DefineGroup('Drivers', src, depend = [''], CPPPATH = CPPPATH, CPPDEFINES=CPPDEFINES)
Return('group')
+71
View File
@@ -0,0 +1,71 @@
/*
* File : board.c
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2012, 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
* 2018-03-01 Tanek the first version
*/
#include <rthw.h>
#include <rtthread.h>
#include "Device.h" // Keil::Board Support:V2M-MPS2:Common
static void *rt_heap_begin_get(void)
{
extern int Image$$RTT_HEAP$$Base;
return &Image$$RTT_HEAP$$Base;
}
static void *rt_heap_end_get(void)
{
extern int Image$$RTT_HEAP$$ZI$$Limit;
return &Image$$RTT_HEAP$$ZI$$Limit;
}
/**
* This function will initial STM32 board.
*/
void rt_hw_board_init()
{
SystemCoreClockUpdate();
SysTick_Config(SystemCoreClock / RT_TICK_PER_SECOND); /* Generate interrupt each 10 ms */
/* Call components board initial (use INIT_BOARD_EXPORT()) */
#ifdef RT_USING_COMPONENTS_INIT
rt_components_board_init();
#endif
#if defined(RT_USING_CONSOLE) && defined(RT_USING_DEVICE)
rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
#endif
#if defined(RT_USING_USER_MAIN) && defined(RT_USING_HEAP)
rt_system_heap_init(rt_heap_begin_get(), rt_heap_end_get());
#endif
}
void SysTick_Handler (void)
{
rt_interrupt_enter();
rt_tick_increase();
rt_interrupt_leave();
}
+33
View File
@@ -0,0 +1,33 @@
/*
* File : board.h
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2012, 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
* 2018-03-01 Tanek the first version
*/
// <<< Use Configuration Wizard in Context Menu >>>
#ifndef __BOARD_H__
#define __BOARD_H__
void rt_hw_board_init(void);
#endif
//*** <<< end of configuration section >>> ***
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+54
View File
@@ -0,0 +1,54 @@
import os
# toolchains options
ARCH='arm'
CPU='cortex-m7'
CROSS_TOOL='keil'
if os.getenv('RTT_CC'):
CROSS_TOOL = os.getenv('RTT_CC')
if CROSS_TOOL == 'keil':
PLATFORM = 'armcc'
EXEC_PATH = 'C:/Keil_v5'
if os.getenv('RTT_EXEC_PATH'):
EXEC_PATH = os.getenv('RTT_EXEC_PATH')
#BUILD = 'debug'
BUILD = 'release'
if PLATFORM == 'armcc':
# toolchains
CC = 'armcc'
CXX = 'armcc'
AS = 'armasm'
AR = 'armar'
LINK = 'armlink'
TARGET_EXT = 'axf'
DEVICE = ' --cpu Cortex-M7.fp.sp'
CFLAGS = DEVICE + ' --apcs=interwork'
AFLAGS = DEVICE
LFLAGS = DEVICE + ' --info sizes --info totals --info unused --info veneers --list rtthread-v2m-mps2.map '
CFLAGS += ' --diag_suppress=66,1296,186'
CFLAGS += ' -I' + EXEC_PATH + '/ARM/RV31/INC'
LFLAGS += ' --libpath ' + EXEC_PATH + '/ARM/RV31/LIB'
EXEC_PATH += '/arm/bin40/'
if BUILD == 'debug':
CFLAGS += ' -g -O0'
AFLAGS += ' -g'
else:
CFLAGS += ' -O2'
CXXFLAGS = CFLAGS
CFLAGS += ' --c99'
POST_ACTION = 'fromelf -z $TARGET'
# POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET'
else:
print("only support armcc in this bsp")
exit(-1)
+26
View File
@@ -0,0 +1,26 @@
#! armcc -E
; *************************************************************
; *** Scatter-Loading Description File generated by uVision ***
; *************************************************************
#define ROM_START 0x00000000
#define ROM_SIZE 0x00400000
#define RAM1_START 0x20000000
#define RAM1_SIZE 0x00400000
#define RTT_HEAP_SIZE \
(RAM1_SIZE - ImageLength(RW_IRAM1))
LR_IROM1 ROM_START ROM_SIZE { ; load region size_region
ER_IROM1 ROM_START ROM_SIZE { ; load address = execution address
*.o (RESET, +First)
*(InRoot$$Sections)
.ANY (+RO)
}
RW_IRAM1 RAM1_START RAM1_SIZE { ; RW data
.ANY (+RW +ZI)
}
RTT_HEAP +0 EMPTY RTT_HEAP_SIZE {
}
}
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff