File tree Expand file tree Collapse file tree 4 files changed +38
-11
lines changed
Expand file tree Collapse file tree 4 files changed +38
-11
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ Microcontroller products. It currently supports the following SoCs:
88- Intel® Quark™ D2000 Microcontroller
99- Intel® Quark™ SE Microcontroller
1010
11- The current version supported in Zephyr is QMSI 1.4 Release Candidate 3 .
11+ The current version supported in Zephyr is QMSI 1.4 Release Candidate 4 .
1212See:
1313
1414 https://github.com/quark-mcu/qmsi/releases
Original file line number Diff line number Diff line change @@ -1340,13 +1340,13 @@ qm_mpr_reg_t test_mpr;
13401340
13411341#endif
13421342
1343- #define QM_MPR_RD_EN_OFFSET (20)
1344- #define QM_MPR_RD_EN_MASK 0x700000
1345- #define QM_MPR_WR_EN_OFFSET (24)
1346- #define QM_MPR_WR_EN_MASK 0x7000000
1343+ #define QM_MPR_UP_BOUND_OFFSET (10)
1344+ #define QM_MPR_WR_EN_OFFSET (20)
1345+ #define QM_MPR_WR_EN_MASK 0x700000
1346+ #define QM_MPR_RD_EN_OFFSET (24)
1347+ #define QM_MPR_RD_EN_MASK 0x7000000
13471348#define QM_MPR_EN_LOCK_OFFSET (30)
13481349#define QM_MPR_EN_LOCK_MASK 0xC0000000
1349- #define QM_MPR_UP_BOUND_OFFSET (10)
13501350#define QM_MPR_VSTS_VALID BIT(31)
13511351
13521352/** @} */
Original file line number Diff line number Diff line change 2828 */
2929
3030#include "ss_init.h"
31+ #include "qm_mpr.h"
3132
3233/* Sensor Subsystem application's pointer to the entry point (Flash0) */
3334#define SS_APP_PTR_ADDR (0x40000000)
@@ -38,6 +39,26 @@ uint32_t __sensor_reset_vector[1];
3839extern uint32_t __sensor_reset_vector [];
3940#endif
4041
42+ /* Set-up an MPR to protect ARC IVT (only ARC will have access to it). */
43+ static void sensor_vectors_protect (void )
44+ {
45+ /*
46+ * MPR config:
47+ * - Enable and lock MPR
48+ * - Allow R/W access to ARC only
49+ * - Protect first kB of SRAM (i.e., where ARC IVT is located)
50+ */
51+ static const qm_mpr_config_t cfg = {
52+ .en_lock_mask =
53+ QM_SRAM_MPR_EN_MASK_ENABLE | QM_SRAM_MPR_EN_MASK_LOCK ,
54+ .agent_read_en_mask = QM_SRAM_MPR_AGENT_MASK_SS ,
55+ .agent_write_en_mask = QM_SRAM_MPR_AGENT_MASK_SS ,
56+ .up_bound = 0 ,
57+ .low_bound = 0 ,
58+ };
59+ qm_mpr_set_config (QM_MPR_1 , & cfg );
60+ }
61+
4162void sensor_activation (void )
4263{
4364 /* Write the ARC reset vector.
@@ -53,6 +74,9 @@ void sensor_activation(void)
5374
5475 * ss_reset_vector = * sensor_startup ;
5576
77+ /* Set up an MPR to protect ARC IVT from other agents. */
78+ sensor_vectors_protect ();
79+
5680 /* Request ARC Run */
5781 QM_SCSS_SS -> ss_cfg |= QM_SS_CFG_ARC_RUN_REQ_A ;
5882}
Original file line number Diff line number Diff line change @@ -518,6 +518,9 @@ qm_scss_peripheral_reg_t test_scss_peripheral;
518518#define QM_SCSS_PERIPHERAL ((qm_scss_peripheral_reg_t *)QM_SCSS_PERIPHERAL_BASE)
519519#endif
520520
521+ /* SS code protection region Lock bit. */
522+ #define QM_SCSS_CFG_LOCK_PROT_RANGE_LOCK BIT(10)
523+
521524/** @} */
522525
523526/**
@@ -1667,13 +1670,13 @@ qm_mpr_reg_t test_mpr;
16671670
16681671#endif
16691672
1670- #define QM_MPR_RD_EN_OFFSET (20)
1671- #define QM_MPR_RD_EN_MASK 0x700000
1672- #define QM_MPR_WR_EN_OFFSET (24)
1673- #define QM_MPR_WR_EN_MASK 0x7000000
1673+ #define QM_MPR_UP_BOUND_OFFSET (10)
1674+ #define QM_MPR_WR_EN_OFFSET (20)
1675+ #define QM_MPR_WR_EN_MASK 0x700000
1676+ #define QM_MPR_RD_EN_OFFSET (24)
1677+ #define QM_MPR_RD_EN_MASK 0x7000000
16741678#define QM_MPR_EN_LOCK_OFFSET (30)
16751679#define QM_MPR_EN_LOCK_MASK 0xC0000000
1676- #define QM_MPR_UP_BOUND_OFFSET (10)
16771680#define QM_MPR_VSTS_VALID BIT(31)
16781681/** @} */
16791682
You can’t perform that action at this time.
0 commit comments