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后发现值得记录下来 实践中发现的区别 网上找了很多资料,但说的很乱,干脆在自己 ...
随机推荐
- 【Linux】lsof 命令,记一次端口占用查询
3月21日测试时,发现测试服务器启,总是报端口占用情况,察看端口占用情况 1-使用命令 netstat -tunlp |grep 端口号 差看下 这个端口被那个进程占用 我当前使用的 JBOSS 端口 ...
- ECMAScript 6(ES6)有什么新东西
你可能已经听说过ECMAScript 6,JavaScript的下一个版本,它有一些非常棒的新功能.这些功能略微复杂,在简单的脚本和复杂的应用中都可以使用.在这篇文章中,我们将挑选一些ES6的功能进行 ...
- [IOS] 利用@IBInspectable
某些uiview中设置 这个关键字 IBInspectable 可以让其设置的属性,在右侧的属性栏目里面进行直接设置, 这是最近看了一下wwdc的一个视频学习到的,可以方便的进行 UI的测试,
- 【python】安装python第三方库lxml时,遇到问题:[ERROR: 'xslt-config' 不是内部或外部命令,也不是可运行的程序]
一.概述 lxml介绍http://lxml.de/ 二.问题 ERROR: 'xslt-config' 不是内部或外部命令,也不是可运行的程序 三.解决方法 Scrapy在Windows上的安装笔记 ...
- VerifyCodeUtil.java
package com.vcredit.framework.utils; import java.awt.Color;import java.awt.Font;import java.awt.Grap ...
- JAVA 对象调用理解图
- Codeforces 209 C. Trails and Glades
Vasya went for a walk in the park. The park has n glades, numbered from 1 to n. There are m trails b ...
- 深入理解ANGULARUI路由_UI-ROUTER
最近在用 ionic写个webapp 看到几个demo中路由有好几种,搞的有点晕,查下资料研究下,做个笔记,其中大部分为摘抄别人的,做个说明免得被人吐槽. Angularjs ui-router - ...
- C++ 利用 libxl 将 Excel 文件转化为 Xml 文件
在游戏开发工作中,策划和运营一般会用Excel来编写配置文件,但是程序读取配置,最方便的还是xml文件.所以最好约定一个格式,然后在二者之间做一个转化. 本文利用libxl来读取Excel文件,利用 ...
- c语言文法简化版文法
<源程序>→<外部声明>|<外部声明><函数体> <外部申明>→<头文件><函数声明>|其他声明 <函数体&g ...