summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathaniel Graff <nathaniel.graff@sifive.com>2019-01-30 19:37:59 +0000
committerGitHub <noreply@github.com>2019-01-30 19:37:59 +0000
commit89d973abd94faf74d7486a6c5e044935f5d63e9d (patch)
treec7188e2bfad20a2750a4155ff623a16541abfb74
parentb629a19514606cb5dd19e0cd433b60922343f6a8 (diff)
parentc615e937538d438c46efd46f9254a2a74b591205 (diff)
Merge pull request #157 from sifive/mee-pmp-no-vtable
Add PMP example
-rw-r--r--.gitmodules3
-rw-r--r--README.md2
-rw-r--r--bsp/coreip-e31-arty/design.dts4
-rw-r--r--bsp/coreip-e31-arty/mee.h11
-rw-r--r--bsp/coreip-e31/design.dts4
-rw-r--r--bsp/coreip-e31/mee.h11
-rw-r--r--bsp/coreip-s51-arty/design.dts4
-rw-r--r--bsp/coreip-s51-arty/mee.h11
-rw-r--r--bsp/coreip-s51/design.dts4
-rw-r--r--bsp/coreip-s51/mee.h11
m---------software/example-pmp0
m---------software/hello0
12 files changed, 65 insertions, 0 deletions
diff --git a/.gitmodules b/.gitmodules
index b92428d..ec643f0 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -25,3 +25,6 @@
[submodule "software/return-pass"]
path = software/return-pass
url = https://github.com/sifive/example-return-pass.git
+[submodule "software/example-pmp"]
+ path = software/example-pmp
+ url = https://github.com/sifive/example-pmp.git
diff --git a/README.md b/README.md
index 4a3e7c6..37b837a 100644
--- a/README.md
+++ b/README.md
@@ -75,6 +75,8 @@ of Freedom E SDK.
- Demonstrates how to register a handler for and trigger a timer interrupt
- local-interrupt
- Demonstrates how to register a handler for and trigger a local interrupt
+ - example-pmp
+ - Demonstrates how to configure a Physical Memory Protection (PMP) region
#### (Deprecated) Legacy Freedom E SDK Library ####
diff --git a/bsp/coreip-e31-arty/design.dts b/bsp/coreip-e31-arty/design.dts
index 3e12f77..96698e9 100644
--- a/bsp/coreip-e31-arty/design.dts
+++ b/bsp/coreip-e31-arty/design.dts
@@ -45,6 +45,10 @@
compatible = "fixed-clock";
clock-frequency = <32500000>;
};
+ pmp: pmp@0 {
+ compatible = "riscv,pmp";
+ regions = <8>;
+ };
L1: clint@2000000 {
compatible = "riscv,clint0";
interrupts-extended = <&L3 3 &L3 7>;
diff --git a/bsp/coreip-e31-arty/mee.h b/bsp/coreip-e31-arty/mee.h
index 87d8b7a..80c7822 100644
--- a/bsp/coreip-e31-arty/mee.h
+++ b/bsp/coreip-e31-arty/mee.h
@@ -27,6 +27,7 @@
#include <mee/drivers/fixed-clock.h>
#include <mee/drivers/sifive,gpio0.h>
#include <mee/drivers/sifive,uart0.h>
+#include <mee/pmp.h>
#include <mee/drivers/sifive,local-external-interrupts0.h>
#include <mee/drivers/sifive,global-external-interrupts0.h>
#include <mee/drivers/sifive,gpio-leds.h>
@@ -69,6 +70,9 @@ struct __mee_driver_sifive_gpio0 __mee_dt_gpio_20002000;
asm (".weak __mee_dt_serial_20000000");
struct __mee_driver_sifive_uart0 __mee_dt_serial_20000000;
+asm (".weak __mee_dt_pmp_0");
+struct mee_pmp __mee_dt_pmp_0;
+
/* From led@0red */
asm (".weak __mee_dt_led_0red");
struct __mee_driver_sifive_gpio_led __mee_dt_led_0red;
@@ -401,6 +405,13 @@ struct __mee_driver_sifive_gpio_switch __mee_dt_switch_3 = {
.label = "SW3",
};
+/* From pmp@0 */
+struct mee_pmp __mee_dt_pmp_0 = {
+ .num_regions = 8UL,
+};
+
+#define __MEE_DT_PMP_HANDLE (&__mee_dt_pmp_0)
+
/* From teststatus@4000 */
struct __mee_driver_sifive_test0 __mee_dt_teststatus_4000 = {
.vtable = &__mee_driver_vtable_sifive_test0,
diff --git a/bsp/coreip-e31/design.dts b/bsp/coreip-e31/design.dts
index 3411ccf..f7e9868 100644
--- a/bsp/coreip-e31/design.dts
+++ b/bsp/coreip-e31/design.dts
@@ -33,6 +33,10 @@
#size-cells = <1>;
compatible = "SiFive,FE310G-soc", "fe310-soc", "sifive-soc", "simple-bus";
ranges;
+ pmp: pmp@0 {
+ compatible = "riscv,pmp";
+ regions = <8>;
+ };
L12: ahb-periph-port@20000000 {
#address-cells = <1>;
#size-cells = <1>;
diff --git a/bsp/coreip-e31/mee.h b/bsp/coreip-e31/mee.h
index a520854..068af63 100644
--- a/bsp/coreip-e31/mee.h
+++ b/bsp/coreip-e31/mee.h
@@ -18,6 +18,7 @@
#include <mee/drivers/riscv,cpu.h>
#include <mee/drivers/riscv,clint0.h>
#include <mee/drivers/riscv,plic0.h>
+#include <mee/pmp.h>
#include <mee/drivers/sifive,local-external-interrupts0.h>
#include <mee/drivers/sifive,global-external-interrupts0.h>
#include <mee/drivers/sifive,test0.h>
@@ -45,6 +46,9 @@ struct __mee_driver_sifive_local_external_interrupts0 __mee_dt_local_external_in
asm (".weak __mee_dt_global_external_interrupts");
struct __mee_driver_sifive_global_external_interrupts0 __mee_dt_global_external_interrupts;
+asm (".weak __mee_dt_pmp_0");
+struct mee_pmp __mee_dt_pmp_0;
+
/* From teststatus@4000 */
asm (".weak __mee_dt_teststatus_4000");
struct __mee_driver_sifive_test0 __mee_dt_teststatus_4000;
@@ -286,6 +290,13 @@ struct __mee_driver_sifive_global_external_interrupts0 __mee_dt_global_external_
#define __MEE_DT_GLOBAL_EXTERNAL_INTERRUPTS_HANDLE (&__mee_dt_global_external_interrupts.irc)
+/* From pmp@0 */
+struct mee_pmp __mee_dt_pmp_0 = {
+ .num_regions = 8UL,
+};
+
+#define __MEE_DT_PMP_HANDLE (&__mee_dt_pmp_0)
+
/* From teststatus@4000 */
struct __mee_driver_sifive_test0 __mee_dt_teststatus_4000 = {
.vtable = &__mee_driver_vtable_sifive_test0,
diff --git a/bsp/coreip-s51-arty/design.dts b/bsp/coreip-s51-arty/design.dts
index 71b9ea6..ea349bb 100644
--- a/bsp/coreip-s51-arty/design.dts
+++ b/bsp/coreip-s51-arty/design.dts
@@ -45,6 +45,10 @@
compatible = "fixed-clock";
clock-frequency = <32500000>;
};
+ pmp: pmp@0 {
+ compatible = "riscv,pmp";
+ regions = <8>;
+ };
L1: clint@2000000 {
compatible = "riscv,clint0";
interrupts-extended = <&L3 3 &L3 7>;
diff --git a/bsp/coreip-s51-arty/mee.h b/bsp/coreip-s51-arty/mee.h
index 0e9cc9c..d8a3ebb 100644
--- a/bsp/coreip-s51-arty/mee.h
+++ b/bsp/coreip-s51-arty/mee.h
@@ -27,6 +27,7 @@
#include <mee/drivers/fixed-clock.h>
#include <mee/drivers/sifive,gpio0.h>
#include <mee/drivers/sifive,uart0.h>
+#include <mee/pmp.h>
#include <mee/drivers/sifive,local-external-interrupts0.h>
#include <mee/drivers/sifive,global-external-interrupts0.h>
#include <mee/drivers/sifive,gpio-leds.h>
@@ -69,6 +70,9 @@ struct __mee_driver_sifive_gpio0 __mee_dt_gpio_20002000;
asm (".weak __mee_dt_serial_20000000");
struct __mee_driver_sifive_uart0 __mee_dt_serial_20000000;
+asm (".weak __mee_dt_pmp_0");
+struct mee_pmp __mee_dt_pmp_0;
+
/* From led@0red */
asm (".weak __mee_dt_led_0red");
struct __mee_driver_sifive_gpio_led __mee_dt_led_0red;
@@ -401,6 +405,13 @@ struct __mee_driver_sifive_gpio_switch __mee_dt_switch_3 = {
.label = "SW3",
};
+/* From pmp@0 */
+struct mee_pmp __mee_dt_pmp_0 = {
+ .num_regions = 8UL,
+};
+
+#define __MEE_DT_PMP_HANDLE (&__mee_dt_pmp_0)
+
/* From teststatus@4000 */
struct __mee_driver_sifive_test0 __mee_dt_teststatus_4000 = {
.vtable = &__mee_driver_vtable_sifive_test0,
diff --git a/bsp/coreip-s51/design.dts b/bsp/coreip-s51/design.dts
index 000ff94..a1cb9fc 100644
--- a/bsp/coreip-s51/design.dts
+++ b/bsp/coreip-s51/design.dts
@@ -33,6 +33,10 @@
#size-cells = <2>;
compatible = "SiFive,FE510G-soc", "fe510-soc", "sifive-soc", "simple-bus";
ranges;
+ pmp: pmp@0 {
+ compatible = "riscv,pmp";
+ regions = <8>;
+ };
L12: axi4-periph-port@20000000 {
#address-cells = <2>;
#size-cells = <2>;
diff --git a/bsp/coreip-s51/mee.h b/bsp/coreip-s51/mee.h
index e73d681..a6d3add 100644
--- a/bsp/coreip-s51/mee.h
+++ b/bsp/coreip-s51/mee.h
@@ -18,6 +18,7 @@
#include <mee/drivers/riscv,cpu.h>
#include <mee/drivers/riscv,clint0.h>
#include <mee/drivers/riscv,plic0.h>
+#include <mee/pmp.h>
#include <mee/drivers/sifive,local-external-interrupts0.h>
#include <mee/drivers/sifive,global-external-interrupts0.h>
#include <mee/drivers/sifive,test0.h>
@@ -45,6 +46,9 @@ struct __mee_driver_sifive_local_external_interrupts0 __mee_dt_local_external_in
asm (".weak __mee_dt_global_external_interrupts");
struct __mee_driver_sifive_global_external_interrupts0 __mee_dt_global_external_interrupts;
+asm (".weak __mee_dt_pmp_0");
+struct mee_pmp __mee_dt_pmp_0;
+
/* From teststatus@4000 */
asm (".weak __mee_dt_teststatus_4000");
struct __mee_driver_sifive_test0 __mee_dt_teststatus_4000;
@@ -414,6 +418,13 @@ struct __mee_driver_sifive_global_external_interrupts0 __mee_dt_global_external_
#define __MEE_DT_GLOBAL_EXTERNAL_INTERRUPTS_HANDLE (&__mee_dt_global_external_interrupts.irc)
+/* From pmp@0 */
+struct mee_pmp __mee_dt_pmp_0 = {
+ .num_regions = 8UL,
+};
+
+#define __MEE_DT_PMP_HANDLE (&__mee_dt_pmp_0)
+
/* From teststatus@4000 */
struct __mee_driver_sifive_test0 __mee_dt_teststatus_4000 = {
.vtable = &__mee_driver_vtable_sifive_test0,
diff --git a/software/example-pmp b/software/example-pmp
new file mode 160000
+Subproject 1f19359da8ef994230193f3a1ca3bba051a1ec4
diff --git a/software/hello b/software/hello
-Subproject 6c63a15e2fb2d63713a4af91a50f6b087c6db1f
+Subproject a9212fbe78293ae408259b98d05628e38c9071f