Bare Medal on BCM2835 and BCM2836
A few days ago, I have tried to write bare medal program but failed. Now I find that the main mistake is that I have mistake the address of GPIO of BCM 2835(Raspberry Pi 1 for which the sample code is desined ) and BCM2836(Raspberry Pi 2 which I am using).
Refrence: dwelch67
Firstly, the base address of GPIO is changed.
Address of RPi BCM2835: 0x20000000
Address of RPi BCM2836: 0x3f000000
Let us make it more easier
Create two file BCM2835.h and BCM2836.h to recode the macro define.
BCM2835.h
#define PBASE 0x20000000
BCM2836.h
#define PBASE 0x3f000000
Then in the code which control your used to control the peripheral, like periph.c, add the following code:
#ifdef RPI2
#include "BCM2836.h" //Raspberry Pi 2
#else
#include "BCM2835.h" //Raspberry Pi 1
#endif
//Ther other macro looks like this:
#define ARM_TIMER_CTL (PBASE + 0x0000B408)
At last, we could modify our Makefile to generate two kernel image:
- kernel.img : for Raspberry Pi 1, BCM2835
- Kernel7.img : for Raspberry Pi 2, BCM2836
To do this, you could add -DRpi2 in your compile cmd to add the macro define
$(ARMGNU)-gcc $(COPS) -c periph.c -o periph7.o -DRPI2
And this is why your /boot/ directory has both kernel.img and kernel7.img.
The official has already consider the two situations.
Bare Medal on BCM2835 and BCM2836的更多相关文章
- Device trees, Overlays and Parameters of Raspberry Pi
Raspberry Pi's latest kernels and firmware, including Raspbian and NOOBS releases, now by default us ...
- git init和git init -bare区别
1 Git init 和 git init –bare 的区别 用"git init"初始化的版本库用户也可以在该目录下执行所有git方面的操作.但别的用户在将更新push上来的 ...
- [译]bare repository
git init --bare 使用--bare创建的repository没有工作目录, 在这个repository中不能修改文件和commit. 中心repository必须是bare reposi ...
- git init 与 git init --bare 的区别
git init 和 git init –bare 的区别 使用命令"git init --bare"(bare汉语意思是:裸,裸的)初始化的版本库(暂且称为bare repos ...
- 把普通的git库变成bare库
$ cd your_repo $ mv .git .. && rm -fr * $ mv ../.git . $ mv .git/* . $ rmdir .git $ git conf ...
- git config and options core.bare hard
In Lynda course Building a Web Interface with React.js 003 Using the exercises > git clone --bare ...
- Why provision Bare Metal
Here are a few use-cases for bare metal (physical server) provisioning in cloud; there are doubtless ...
- Bare metal APIs with ASP.NET Core MVC(转)
ASP.NET Core MVC now provides a true "one asp.net" framework that can be used for building ...
- git init 与 git init --bare 区别
git init 与 git init --bare 区别 发现问题 最早是在公司的wiki上发现了这个命令,google后发现值得记录下来 实践中发现的区别 网上找了很多资料,但说的很乱,干脆在自己 ...
随机推荐
- JSON字符串语法
JSON 语法是 JavaScript 对象表示语法的子集. 数据在键/值对中展示, 多个数据由逗号分隔, 花括号保存一个对象, 方括号保存一个数组 JSON具有以下形式: 1. 对象(object) ...
- Sass和compass 安装 和配合grunt实时显示 [Sass和compass学习笔记]
demo 下载http://vdisk.weibo.com/s/DOlfkrAWjkF/1401192855 为什么要学习Sass和compass ?提高站独立和代码产品化的绝密武器,尤其是程序化cs ...
- Shader实例:2D流光
准备: 1.一张背景图 2.一张流光图 3.一张过滤图 like this: 效果: 代码: Shader "Custom/2d_flow" { Properties { _Mai ...
- a 标签 启用或禁用点击事件
<a href="#" id="btnAuthCode" class="authCode_btn">获取验证码</a> ...
- VS2010+64+OSG3.2.1之五Plugins dae编译
VS2010+64+OSG3.2.1之五Plugins dae编译 转自:http://blog.csdn.net/nuaaqsm0915/article/details/38978971 Plugi ...
- postcss-px2rem
1.安装 npm install gulp-postcss --save-dev 2.gulp var gulp = require('gulp'); var postcss = require('g ...
- Struts2基础数据校验和框架校验
一:三种校验的方式 1.用validate()方法实现数据校验 2.用execute()方法实现数据校验 3.用validateXxx()方法实现数据校验 1.用validate()方法实现数据校验 ...
- IIS7应用程序池集成和经典的区别
IIS7应用程序池集成和经典的区别 IIS7应用程序池有集成和经典两种模式,根据微软官方的介绍, 集成模式,如果托管应用程序在采用集成模式的应用程序池中运行,服务器将使用 IIS 和 ASP.NET ...
- laravel DB事物
public function store(Request $request, $id) { $externalAccount = ExternalAccounts::find($id); DB::b ...
- css基础知识
CSS 规则由两个主要的部分构成:选择器,以及一条或多条声明.其中选择器通常是您需要改变样式的 HTML 元素(比如p标签),也可以是节点的属性的值(比如id,class):每条声明都是一条字典key ...