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后发现值得记录下来 实践中发现的区别 网上找了很多资料,但说的很乱,干脆在自己 ...
随机推荐
- [NOIP2011]观光公交 题解
题目大意: 就省了吧 思路: 应该算是贪心. 不难发现,加速只对所有在使用加速器之后连续的一段下车时不用等人的站点下车的人有用.这非常重要. 先算出不加速时的和,并预处理出每个站点最迟到的人的时间.每 ...
- 自己写的AutoMapper
using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using Sy ...
- 对Ajax连接的认识~为毛不能上传文件!!!
最近做毕设的时候需要用到上传图片的功能,但是我的毕设全部的传输都是基于ajax的请求,百度了一圈发现TMD居然说ajax不能上传文件!!当时我就不乐意了啊,那难道其他人都用的是黑科技吗?!又来网上的大 ...
- 【贪心】POJ 1065
头一次接触POJ,然后写了自己比较擅长的贪心. 解题思路大概就是从小排(这个很重要,然后用cmp随便长度或者重量的排序,选择最小的开始) 直到所有比他weight大的,没有符合条件的了.就代表要再加一 ...
- System memory,AGP memory和video memory【转】
system memory就是电脑的内存条上的,一般都很大.显卡不能访问 . video memory就是显示卡上的显存,一般是32,64,128M这样,速度最快,显卡可直接访问 .用来描述电脑上一 ...
- ubuntu实现ramdisk
1. linux内核提供了16个ramdisk供使用者使用,只需格式化,并挂在便可以使用.查看 ls /dev/ram* 2. 修改配置文件: sudo gedit /etc/default/grub ...
- IOS基础学习-2: UIButton
IOS基础学习-2: UIButton UIButton是一个标准的UIControl控件,UIKit提供了一组控件:UISwitch开关.UIButton按钮.UISegmentedContro ...
- Thinking in Java——笔记(14)
Type Information The need for RTTI Because it is a dynamically bound method, the proper behavior wil ...
- 使用配置文件来配置JDBC连接数据库
1.管理数据库连接的Class 代码如下: package jdbcTest;import java.sql.Connection;import java.sql.DriverManager;impo ...
- java synchronized详解
Java语言的关键字,当它用来修饰一个方法或者一个代码块的时候,能够保证在同一时刻最多只有一个线程执行该段代码. 一.当两个并发线程访问同一个对象object中的这个synchronized(this ...