<div dir="ltr">This patch adds a BSP variant for the Raspberry Pi 2. <div>--enable-rtemsbsp="raspberrypi2 raspberrypi"</div><div><br></div><div>For the current BSP, the only change was the peripheral register base address and the compiler options. </div><div>The raspberrypi/make/custom rules were re-factored:</div><div>raspberrypi.inc -- Common rules</div><div>raspberrypi.cfg - Raspberry Pi 1 specific rule/optons</div><div>raspberrypi2.cfg -- Raspberry Pi 2 specific rule/options</div><div><br></div><div>I tested hello, ticker, unlimited, and paranoia on both the Pi ( Model A+ ) and Pi 2. </div><div><br></div><div>Alan</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Mar 15, 2015 at 12:04 PM, Alan Cudmore <span dir="ltr"><<a href="mailto:alan.cudmore@gmail.com" target="_blank">alan.cudmore@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">---<br>
c/src/lib/libbsp/arm/raspberrypi/<a href="http://configure.ac" target="_blank">configure.ac</a> | 8 +++++++<br>
.../libbsp/arm/raspberrypi/include/raspberrypi.h | 26 +++++++++++++++++-----<br>
.../arm/raspberrypi/make/custom/raspberrypi.cfg | 15 +------------<br>
.../arm/raspberrypi/make/custom/raspberrypi.inc | 18 +++++++++++++++<br>
.../arm/raspberrypi/make/custom/raspberrypi2.cfg | 7 ++++++<br>
.../arm/raspberrypi/startup/mm_config_table.c | 5 +++--<br>
6 files changed, 57 insertions(+), 22 deletions(-)<br>
create mode 100644 c/src/lib/libbsp/arm/raspberrypi/make/custom/raspberrypi.inc<br>
create mode 100644 c/src/lib/libbsp/arm/raspberrypi/make/custom/raspberrypi2.cfg<br>
<br>
diff --git a/c/src/lib/libbsp/arm/raspberrypi/<a href="http://configure.ac" target="_blank">configure.ac</a> b/c/src/lib/libbsp/arm/raspberrypi/<a href="http://configure.ac" target="_blank">configure.ac</a><br>
index 42be4e9..27abe6c 100644<br>
--- a/c/src/lib/libbsp/arm/raspberrypi/<a href="http://configure.ac" target="_blank">configure.ac</a><br>
+++ b/c/src/lib/libbsp/arm/raspberrypi/<a href="http://configure.ac" target="_blank">configure.ac</a><br>
@@ -24,6 +24,14 @@ AM_CONDITIONAL(HAS_NETWORKING,test "$HAS_NETWORKING" = "yes")<br>
RTEMS_BSPOPTS_SET([BSP_START_RESET_VECTOR],[*],[])<br>
RTEMS_BSPOPTS_HELP([BSP_START_RESET_VECTOR],[reset vector address for BSP start])<br>
<br>
+# Is this a Raspberry Pi 2?<br>
+RTEMS_BSPOPTS_SET([BSP_IS_RPI2],[raspberrypi2],[1])<br>
+RTEMS_BSPOPTS_SET([BSP_IS_RPI2],[*],[0])<br>
+RTEMS_BSPOPTS_HELP([BSP_IS_RPI2],[Set if the BSP variant is Raspberry Pi 2.])<br>
+AM_CONDITIONAL(RTEMS_RPI2,[test "$BSP_IS_RPI2" = "1"])<br>
+<br>
+<br>
+<br>
RTEMS_BSP_CLEANUP_OPTIONS(0, 0)<br>
RTEMS_BSP_LINKCMDS<br>
<br>
diff --git a/c/src/lib/libbsp/arm/raspberrypi/include/raspberrypi.h b/c/src/lib/libbsp/arm/raspberrypi/include/raspberrypi.h<br>
index 4cc7eec..e3c4d76 100644<br>
--- a/c/src/lib/libbsp/arm/raspberrypi/include/raspberrypi.h<br>
+++ b/c/src/lib/libbsp/arm/raspberrypi/include/raspberrypi.h<br>
@@ -45,6 +45,20 @@<br>
/** @} */<br>
<br>
/**<br>
+ * @name Peripheral Base Register Address<br>
+ *<br>
+ * @{<br>
+ */<br>
+<br>
+#if (BSP_IS_RPI2 == 1)<br>
+ #define RPI_PERIPHERAL_BASE 0x3F000000<br>
+#else<br>
+ #define RPI_PERIPHERAL_BASE 0x20000000<br>
+#endif<br>
+<br>
+#define RPI_PERIPHERAL_SIZE 0x01000000<br>
+<br>
+/**<br>
* @name Internal ARM Timer Registers<br>
*<br>
* @{<br>
@@ -52,7 +66,7 @@<br>
<br>
#define BCM2835_CLOCK_FREQ 250000000<br>
<br>
-#define BCM2835_TIMER_BASE (0x2000B400)<br>
+#define BCM2835_TIMER_BASE (RPI_PERIPHERAL_BASE + 0xB400)<br>
<br>
#define BCM2835_TIMER_LOD (BCM2835_TIMER_BASE+0x00)<br>
#define BCM2835_TIMER_VAL (BCM2835_TIMER_BASE+0x04)<br>
@@ -74,7 +88,7 @@<br>
* @{<br>
*/<br>
<br>
-#define BCM2835_GPIO_REGS_BASE (0x20200000)<br>
+#define BCM2835_GPIO_REGS_BASE (RPI_PERIPHERAL_BASE + 0x200000)<br>
<br>
#define BCM2835_GPIO_GPFSEL1 (BCM2835_GPIO_REGS_BASE+0x04)<br>
#define BCM2835_GPIO_GPSET0 (BCM2835_GPIO_REGS_BASE+0x1C)<br>
@@ -90,7 +104,7 @@<br>
* @{<br>
*/<br>
<br>
-#define BCM2835_AUX_BASE (0x20215000)<br>
+#define BCM2835_AUX_BASE (RPI_PERIPHERAL_BASE + 0x215000)<br>
<br>
#define AUX_ENABLES (BCM2835_AUX_BASE+0x04)<br>
#define AUX_MU_IO_REG (BCM2835_AUX_BASE+0x40)<br>
@@ -115,7 +129,7 @@<br>
*/<br>
<br>
<br>
-#define BCM2835_UART0_BASE (0x20201000)<br>
+#define BCM2835_UART0_BASE (RPI_PERIPHERAL_BASE + 0x201000)<br>
<br>
#define BCM2835_UART0_DR (BCM2835_UART0_BASE+0x00)<br>
#define BCM2835_UART0_RSRECR (BCM2835_UART0_BASE+0x04)<br>
@@ -155,7 +169,7 @@<br>
* @{<br>
*/<br>
<br>
-#define BCM2835_BASE_INTC (0x2000B200)<br>
+#define BCM2835_BASE_INTC (RPI_PERIPHERAL_BASE + 0xB200)<br>
<br>
#define BCM2835_IRQ_BASIC (BCM2835_BASE_INTC + 0x00)<br>
#define BCM2835_IRQ_PENDING1 (BCM2835_BASE_INTC + 0x04)<br>
@@ -182,7 +196,7 @@<br>
* it's own RTOS. 1 and 3 are available for use in<br>
* RTEMS.<br>
*/<br>
-#define BCM2835_GPU_TIMER_BASE (0x20003000)<br>
+#define BCM2835_GPU_TIMER_BASE (RPI_PERIPHERAL_BASE + 0x3000)<br>
<br>
#define BCM2835_GPU_TIMER_CS (BCM2835_TIMER_BASE+0x00)<br>
#define BCM2835_GPU_TIMER_CLO (BCM2835_TIMER_BASE+0x04)<br>
diff --git a/c/src/lib/libbsp/arm/raspberrypi/make/custom/raspberrypi.cfg b/c/src/lib/libbsp/arm/raspberrypi/make/custom/raspberrypi.cfg<br>
index 48ac0f8..759b79d 100644<br>
--- a/c/src/lib/libbsp/arm/raspberrypi/make/custom/raspberrypi.cfg<br>
+++ b/c/src/lib/libbsp/arm/raspberrypi/make/custom/raspberrypi.cfg<br>
@@ -1,20 +1,7 @@<br>
#<br>
# Config file for RASPBERRYPI<br>
#<br>
-<br>
-include $(RTEMS_ROOT)/make/custom/default.cfg<br>
-<br>
-RTEMS_CPU = arm<br>
+include $(RTEMS_ROOT)/make/custom/raspberrypi.inc<br>
<br>
CPU_CFLAGS = -mcpu=arm1176jzf-s<br>
<br>
-CFLAGS_OPTIMIZE_V = -O2 -g<br>
-<br>
-# This defines the operations performed on the linked executable.<br>
-# is currently required.<br>
-define bsp-post-link<br>
- $(OBJCOPY) -O binary --strip-all \<br>
- $(basename $@)$(EXEEXT) $(basename $@)$(DOWNEXT)<br>
- $(SIZE) $(basename $@)$(EXEEXT)<br>
-endef<br>
-<br>
diff --git a/c/src/lib/libbsp/arm/raspberrypi/make/custom/raspberrypi.inc b/c/src/lib/libbsp/arm/raspberrypi/make/custom/raspberrypi.inc<br>
new file mode 100644<br>
index 0000000..8a756cd<br>
--- /dev/null<br>
+++ b/c/src/lib/libbsp/arm/raspberrypi/make/custom/raspberrypi.inc<br>
@@ -0,0 +1,18 @@<br>
+#<br>
+# Config file for Raspberry Pi variants.<br>
+#<br>
+<br>
+include $(RTEMS_ROOT)/make/custom/default.cfg<br>
+<br>
+RTEMS_CPU = arm<br>
+<br>
+CFLAGS_OPTIMIZE_V ?= -O2 -g<br>
+<br>
+# This defines the operations performed on the linked executable.<br>
+# is currently required.<br>
+define bsp-post-link<br>
+ $(OBJCOPY) -O binary --strip-all \<br>
+ $(basename $@)$(EXEEXT) $(basename $@)$(DOWNEXT)<br>
+ $(SIZE) $(basename $@)$(EXEEXT)<br>
+endef<br>
+<br>
diff --git a/c/src/lib/libbsp/arm/raspberrypi/make/custom/raspberrypi2.cfg b/c/src/lib/libbsp/arm/raspberrypi/make/custom/raspberrypi2.cfg<br>
new file mode 100644<br>
index 0000000..f480c68<br>
--- /dev/null<br>
+++ b/c/src/lib/libbsp/arm/raspberrypi/make/custom/raspberrypi2.cfg<br>
@@ -0,0 +1,7 @@<br>
+#<br>
+# Config file for RASPBERRYPI 2<br>
+#<br>
+include $(RTEMS_ROOT)/make/custom/raspberrypi.inc<br>
+<br>
+CPU_CFLAGS = -march=armv7-a -mtune=cortex-a7<br>
+<br>
diff --git a/c/src/lib/libbsp/arm/raspberrypi/startup/mm_config_table.c b/c/src/lib/libbsp/arm/raspberrypi/startup/mm_config_table.c<br>
index 398ba98..36c6eed 100644<br>
--- a/c/src/lib/libbsp/arm/raspberrypi/startup/mm_config_table.c<br>
+++ b/c/src/lib/libbsp/arm/raspberrypi/startup/mm_config_table.c<br>
@@ -20,6 +20,7 @@<br>
* <a href="http://www.rtems.org/license/LICENSE" target="_blank">http://www.rtems.org/license/LICENSE</a>.<br>
*/<br>
<br>
+#include <bsp.h><br>
#include <bsp/arm-cp15-start.h><br>
<br>
const arm_cp15_start_section_config arm_cp15_start_mmu_config_table[] = {<br>
@@ -64,8 +65,8 @@ const arm_cp15_start_section_config arm_cp15_start_mmu_config_table[] = {<br>
.end = (uint32_t) bsp_section_stack_end,<br>
.flags = ARMV7_MMU_DATA_READ_WRITE_CACHED<br>
}, {<br>
- .begin = 0x20000000,<br>
- .end = 0x21000000,<br>
+ .begin = RPI_PERIPHERAL_BASE,<br>
+ .end = RPI_PERIPHERAL_BASE + RPI_PERIPHERAL_SIZE,<br>
.flags = ARMV7_MMU_DEVICE<br>
}<br>
};<br>
<span class="HOEnZb"><font color="#888888">--<br>
1.9.1<br>
<br>
</font></span></blockquote></div><br></div>