星空网 > 软件开发 > 操作系统

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:

  1. kernel.img : for Raspberry Pi 1, BCM2835
  2. 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

关键词:

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

fba美国海派:https://www.goluckyvip.com/tag/19755.html
fba美国海外仓:https://www.goluckyvip.com/tag/19756.html
fba美国海运:https://www.goluckyvip.com/tag/19757.html
fba美国海运价格:https://www.goluckyvip.com/tag/19758.html
fba美国海运头程:https://www.goluckyvip.com/tag/19759.html
fba美国海运专线:https://www.goluckyvip.com/tag/19760.html
TikTok 将推出先买后付服务 :https://www.goluckyvip.com/news/188219.html
深圳有没有比较好玩的景点 深圳有没有比较好玩的景点推荐一下:https://www.vstour.cn/a/366175.html
相关文章
我的浏览记录
最新相关资讯
海外公司注册 | 跨境电商服务平台 | 深圳旅行社 | 东南亚物流