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后发现值得记录下来 实践中发现的区别 网上找了很多资料,但说的很乱,干脆在自己 ...
随机推荐
- Leetcode Valid Sudoku
Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules. The Sudoku board could be ...
- python 之sqlalchemy many to many
# -*- coding: utf-8 -*- """ @author: zengchunyun """ from sqlalchemy i ...
- T4学习资料
网址:http://www.olegsych.com/2007/12/text-template-transformation-toolkit/
- 来看看css3中的box-shadow
不谈IE,只谈谈box-shadow的具体使用方法 语法: E {box-shadow: <length> <length> <length>?<length ...
- jquery mobile系列问题汇总整理(传播知识,利己利人)
我在用jquery mobile做项目时,遇到jm在下拉框等组件里不能正常动态更新内容,查找了相关资料,在这里抛砖引玉,先提供一个解决下拉框内容写入更新的解决方法: jm解决下拉框内容写入的方法可以这 ...
- Oracel EBS - Search Report by Response & Group
- Oracle Function
Oracle Sql 中常用函数 小写字母转大写字母:upper(); 大写字母转小写字母:lower(); 字符串截取函数:substr(str,a,b); a,b为整数,str为字符串, 截取字符 ...
- NFA转DFA - json数字识别
json的主页上,提供了number类型的符号识别过程,如下: 图片引用:http://www.json.org/json-zh.html 实际上这张图片表示的是一个状态机,只是状态没有标出来.因为这 ...
- Ubuntu apt-get "Hash Sum mismatch" 问题解决方法
参考:ubuntu: apt-get update的时候遇到"Hash Sum mismatch"错误 在安装Mininet的时候,apt-get update的时候遇到了这个问题 ...
- Blog 公用部分结构与class定义
/*博客文章公用部分class与结构 common*/ /* 1.title-block //标题块 ├── border-danger //危险红 ├── border-info //普通蓝 └── ...