[bsp][raspi2] change README.md and configs

This commit is contained in:
shaojinchun
2018-08-24 09:49:06 +08:00
parent e0b04166e8
commit e5f0b628f2
9 changed files with 286 additions and 166 deletions
+52 -36
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -15,8 +15,8 @@ config $PKGS_DIR
option env="PKGS_ROOT"
default "packages"
source "$RTT_DIR/KConfig"
source "$PKGS_DIR/KConfig"
source "$RTT_DIR/Kconfig"
source "$PKGS_DIR/Kconfig"
config BCM2836_SOC
bool
+108 -2
View File
@@ -1,2 +1,108 @@
# raspi2
RT-Thread for Raspberry Pi 2B
|# Raspberry A7板级支持包说明
## 1. 简介
树莓派由注册于英国的慈善组织“Raspberry Pi 基金会”开发,莓派2采用4核Broadcom BCM2836 (ARMv7-A)芯片、双核VideoCore IV GPU和1GB内存。
这份RT-Thread BSP是针对 Raspberry Pi 2B 的一份移植,树莓派价格便宜, 使用者甚众,是研究和运行RT-Thread的可选平台之一。
当前Raspberry Pi 2B对应的硬件特性:
| 硬件 | 描述 |
|------- | ------------------------------- |
| CPU | ARM Cortex-A7(4核心) |
| 主频 | 900M |
| Memory | 1GB (0x0000000 - 0x40000000) |
| | 其中0x3f000000 - 0x40000000为peripheral |
## 2. 编译说明
Windows环境下推荐使用[env工具][1]
Linux下推荐使用gcc工具 [gcc-arm-none-eabi-4_8-2014q1_linux][2],如果还没有编译工具,下载后,解开文件。
```
tar vxf gcc-arm-none-eabi-4_8-2014q1_linux.tar.bz2
```
Linux环境可能需要修改编译器目录设置,修改bsp/raspi2/rtconfig.py中的
```
EXEC_PATH = r'/opt/gcc-arm-none-eabi-4_8-2014q1_gri/bin'
```
为编译工具的实际所在目录,这里注意要加上后缀 /bin
进入到`bsp/raspi2`目录中,运行以下命令:
```
scons
```
来编译这个板级支持包。如果编译正确无误,会产生kernel.elf、kernel.img文件。
kernel.img即是要cp到raspberry SD卡中根目录的文件
## 3. 执行
### 3.1 下载[raspbian镜像][3],生成可以运行的raspbian SD卡
Windows下,去[etcher.io][4]下载etcher,这是个可以烧写img的工具
解开下载的镜像文件, linux下使用如下的命令
```
unzip 2018-06-27-raspbian-stretch-lite.zip
```
准备一张空SD卡,linux环境下,插入电脑并执行
```
sudo dd if=2018-06-27-raspbian-stretch-lite.img of=/dev/xxx bs=32M conv=fsync
```
**注意: /dev/xxx 要换成真实环境中的SD卡所在设置,千万不要弄错。**
Windows环境下,执行etcher选择解压后的2018-06-27-raspbian-stretch-lite.img文件和SD卡就可以开始烧写了。
最后把kernel7.img放入SD boot分区,覆盖原来的文件。
### 3.2 准备好串口线
目前版本是使用raspi2的 GPIO 14, GPIO 15来作路口输出。
串口参数: 115200 8N1 ,硬件和软件流控为关。
按上面的方法做好SD卡后,插入树莓派2B,通电。
输出到串口的信息应该是这样的:
```text
heap: 0x00020b20 - 0x00400000
\ | /
- RT - Thread Operating System
/ | \ 3.1.0 build Aug 23 2018
2006 - 2018 Copyright by rt-thread team
Hello RT-Thread!
msh >
```
## 4. 支持情况
| 驱动 | 支持情况 | 备注 |
| ------ | ---- | :------: |
| UART | 支持 | UART0|
## 5. 联系人信息
维护人:[bernard][5]
[1]: https://www.rt-thread.org/page/download.html
[2]: https://launchpad.net/gcc-arm-embedded/4.8/4.8-2014-q1-update/+download/gcc-arm-none-eabi-4_8-2014q1-20140314-linux.tar.bz2
[3]: https://downloads.raspberrypi.org/raspbian_lite_latest
[4]: https://etcher.io
[5:] https://github.com/BernardXiong
-76
View File
@@ -1,76 +0,0 @@
/*
* File : drv_gpio.c
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2017, 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
*/
#include <rtdevice.h>
#include <rtthread.h>
#include "drv_gpio.h"
static void hw_pin_mode(struct rt_device *device, rt_base_t pin, rt_base_t mode)
{
return ;
}
static void hw_pin_write(struct rt_device *device, rt_base_t pin, rt_base_t value)
{
return ;
}
static int hw_pin_read(struct rt_device *device, rt_base_t pin)
{
return 0;
}
static rt_err_t hw_pin_attach_irq(struct rt_device *device, rt_int32_t pin,
rt_uint32_t mode, void (*hdr)(void *args), void *args)
{
return RT_EOK;
}
static rt_err_t hw_pin_detach_irq(struct rt_device *device, rt_int32_t pin)
{
return RT_EOK;
}
static rt_err_t hw_pin_irq_enable(struct rt_device *device, rt_base_t pin, rt_uint32_t enabled)
{
return RT_EOK;
}
struct rt_pin_ops _hw_pin_ops =
{
hw_pin_mode,
hw_pin_write,
hw_pin_read,
hw_pin_attach_irq,
hw_pin_detach_irq,
hw_pin_irq_enable
};
int hw_gpio_init(void)
{
rt_device_pin_register("gpio", &_hw_pin_ops , RT_NULL);
return 0;
}
INIT_BOARD_EXPORT(hw_gpio_init);
-29
View File
@@ -1,29 +0,0 @@
/*
* File : drv_gpio.h
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2017, 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
*/
#ifndef DRV_GPIO_H__
#define DRV_GPIO_H__
int hw_gpio_init(void);
#endif
-1
View File
@@ -1 +0,0 @@
qemu-system-arm -M raspi2 --kernel rtthread.elf -serial vc -serial stdio -S -s
-1
View File
@@ -1 +0,0 @@
qemu-system-arm -M raspi2 --kernel rtthread.elf -serial vc -serial stdio
+123 -18
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -8,7 +8,7 @@ CROSS_TOOL ='gcc'
if os.getenv('RTT_ROOT'):
RTT_ROOT = os.getenv('RTT_ROOT')
else:
RTT_ROOT = r'rt-thread'
RTT_ROOT = r'../..'
if os.getenv('RTT_CC'):
CROSS_TOOL = os.getenv('RTT_CC')