Fixed regression in the demo.

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@15626 27425a3e-05d8-49a3-a47f-9c15f0e5edd8
This commit is contained in:
Giovanni Di Sirio 2022-05-16 08:33:48 +00:00
parent c696466411
commit 3b2615a8e6
2 changed files with 48 additions and 4 deletions

View File

@ -65,10 +65,12 @@ static const sb_config_t sb_config1 = {
.regions = { .regions = {
[0] = { [0] = {
.area = {STARTUP_FLASH1_BASE, STARTUP_FLASH1_SIZE}, .area = {STARTUP_FLASH1_BASE, STARTUP_FLASH1_SIZE},
.used = true,
.writeable = false .writeable = false
}, },
[1] = { [1] = {
.area = {STARTUP_RAM1_BASE, STARTUP_RAM1_SIZE}, .area = {STARTUP_RAM1_BASE, STARTUP_RAM1_SIZE},
.used = true,
.writeable = true .writeable = true
} }
}, },
@ -95,10 +97,12 @@ static const sb_config_t sb_config2 = {
.regions = { .regions = {
[0] = { [0] = {
.area = {STARTUP_FLASH2_BASE, STARTUP_FLASH2_SIZE}, .area = {STARTUP_FLASH2_BASE, STARTUP_FLASH2_SIZE},
.used = true,
.writeable = false .writeable = false
}, },
[1] = { [1] = {
.area = {STARTUP_RAM2_BASE, STARTUP_RAM2_SIZE}, .area = {STARTUP_RAM2_BASE, STARTUP_RAM2_SIZE},
.used = true,
.writeable = true .writeable = true
} }
}, },
@ -118,6 +122,24 @@ static const sb_config_t sb_config2 = {
}, },
}; };
static const char *sbx1_argv[] = {
"sbx1",
NULL
};
static const char *sbx1_envp[] = {
NULL
};
static const char *sbx2_argv[] = {
"sbx2",
NULL
};
static const char *sbx2_envp[] = {
NULL
};
/* Sandbox objects.*/ /* Sandbox objects.*/
sb_class_t sbx1, sbx2; sb_class_t sbx1, sbx2;
@ -215,7 +237,7 @@ int main(void) {
/* Starting sandboxed thread 1.*/ /* Starting sandboxed thread 1.*/
utp1 = sbStartThread(&sbx1, "sbx1", utp1 = sbStartThread(&sbx1, "sbx1",
waUnprivileged1, sizeof (waUnprivileged1), waUnprivileged1, sizeof (waUnprivileged1),
NORMALPRIO - 1, NULL, NULL); NORMALPRIO - 1, sbx1_argv, sbx1_envp);
if (utp1 == NULL) { if (utp1 == NULL) {
chSysHalt("sbx1 failed"); chSysHalt("sbx1 failed");
} }
@ -223,7 +245,7 @@ int main(void) {
/* Starting sandboxed thread 2.*/ /* Starting sandboxed thread 2.*/
utp2 = sbStartThread(&sbx2, "sbx2", utp2 = sbStartThread(&sbx2, "sbx2",
waUnprivileged2, sizeof (waUnprivileged2), waUnprivileged2, sizeof (waUnprivileged2),
NORMALPRIO - 1, NULL, NULL); NORMALPRIO - 1, sbx2_argv, sbx2_envp);
if (utp1 == NULL) { if (utp1 == NULL) {
chSysHalt("sbx2 failed"); chSysHalt("sbx2 failed");
} }

View File

@ -65,10 +65,12 @@ static const sb_config_t sb_config1 = {
.regions = { .regions = {
[0] = { [0] = {
.area = {STARTUP_FLASH1_BASE, STARTUP_FLASH1_SIZE}, .area = {STARTUP_FLASH1_BASE, STARTUP_FLASH1_SIZE},
.used = true,
.writeable = false .writeable = false
}, },
[1] = { [1] = {
.area = {STARTUP_RAM1_BASE, STARTUP_RAM1_SIZE}, .area = {STARTUP_RAM1_BASE, STARTUP_RAM1_SIZE},
.used = true,
.writeable = true .writeable = true
} }
}, },
@ -82,16 +84,36 @@ static const sb_config_t sb_config2 = {
.regions = { .regions = {
[0] = { [0] = {
.area = {STARTUP_FLASH2_BASE, STARTUP_FLASH2_SIZE}, .area = {STARTUP_FLASH2_BASE, STARTUP_FLASH2_SIZE},
.used = true,
.writeable = false .writeable = false
}, },
[1] = { [1] = {
.area = {STARTUP_RAM2_BASE, STARTUP_RAM2_SIZE}, .area = {STARTUP_RAM2_BASE, STARTUP_RAM2_SIZE},
.used = true,
.writeable = true .writeable = true
} }
}, },
// .vfs_driver = (vfs_driver_c *)&root_overlay_driver // .vfs_driver = (vfs_driver_c *)&root_overlay_driver
}; };
static const char *sbx1_argv[] = {
"sbx1",
NULL
};
static const char *sbx1_envp[] = {
NULL
};
static const char *sbx2_argv[] = {
"sbx2",
NULL
};
static const char *sbx2_envp[] = {
NULL
};
/* Sandbox objects.*/ /* Sandbox objects.*/
sb_class_t sbx1, sbx2; sb_class_t sbx1, sbx2;
@ -207,7 +229,7 @@ int main(void) {
/* Starting sandboxed thread 1.*/ /* Starting sandboxed thread 1.*/
utp1 = sbStartThread(&sbx1, "sbx1", utp1 = sbStartThread(&sbx1, "sbx1",
waUnprivileged1, sizeof (waUnprivileged1), waUnprivileged1, sizeof (waUnprivileged1),
NORMALPRIO - 1, NULL, NULL); NORMALPRIO - 1, sbx1_argv, sbx1_envp);
if (utp1 == NULL) { if (utp1 == NULL) {
chSysHalt("sbx1 failed"); chSysHalt("sbx1 failed");
} }
@ -215,7 +237,7 @@ int main(void) {
/* Starting sandboxed thread 2.*/ /* Starting sandboxed thread 2.*/
utp2 = sbStartThread(&sbx2, "sbx2", utp2 = sbStartThread(&sbx2, "sbx2",
waUnprivileged2, sizeof (waUnprivileged2), waUnprivileged2, sizeof (waUnprivileged2),
NORMALPRIO - 1, NULL, NULL); NORMALPRIO - 1, sbx2_argv, sbx2_envp);
if (utp1 == NULL) { if (utp1 == NULL) {
chSysHalt("sbx2 failed"); chSysHalt("sbx2 failed");
} }