Debugging....

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@12993 27425a3e-05d8-49a3-a47f-9c15f0e5edd8
This commit is contained in:
Giovanni Di Sirio 2019-09-15 14:55:04 +00:00
parent d494f3899d
commit 2224bd26a7
5 changed files with 19 additions and 17 deletions

View File

@ -25,19 +25,9 @@
</natures>
<linkedResources>
<link>
<name>board</name>
<name>sb</name>
<type>2</type>
<locationURI>CHIBIOS/os/hal/boards/ST_STM32L476_DISCOVERY</locationURI>
</link>
<link>
<name>os</name>
<type>2</type>
<locationURI>CHIBIOS/os</locationURI>
</link>
<link>
<name>test</name>
<type>2</type>
<locationURI>CHIBIOS/test</locationURI>
<locationURI>CHIBIOS/os/sb</locationURI>
</link>
</linkedResources>
</projectDescription>

View File

@ -16,6 +16,7 @@
#include <stdint.h>
#include <stdbool.h>
#include <stddef.h>
#include "sbuser.h"
@ -39,6 +40,9 @@ int main(void) {
}
#endif
while (true) {
sbSleepMilliseconds(500);
msg_t msg = sbMsgWait();
sbFileWrite(1U, (const uint8_t *)"Hello World!!\r\n", 15U);
sbMsgReply(msg);
// sbSleepMilliseconds(500);
}
}

View File

@ -22,6 +22,9 @@
#include "chprintf.h"
#include "sbhost.h"
/* SandBox object.*/
sb_class_t sbx1;
/*
* LEDs blinker thread, times are in milliseconds.
*/
@ -39,6 +42,7 @@ static THD_FUNCTION(Thread1, arg) {
chThdSleepMilliseconds(50);
palSetLine(LINE_LED_RED);
chThdSleepMilliseconds(200);
(void) sbSendMessage(&sbx1, 0xF00F55AAU);
}
}
@ -58,7 +62,6 @@ static THD_FUNCTION(Unprivileged1, arg) {
.stdout_stream = (SandboxStream *)&SD2,
.stderr_stream = (SandboxStream *)&SD2
};
sb_class_t sbx1;
(void)arg;
chRegSetThreadName("unprivileged");
@ -108,7 +111,7 @@ int main(void) {
sdStart(&SD2, NULL);
/* Creating the blinker thread.*/
chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO,
chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO+10,
Thread1, NULL);
/* Creating the unprivileged thread.*/

View File

@ -56,6 +56,10 @@ typedef void (*port_syscall_t)(struct port_extctx *ectx);
* this subsystem.
*/
struct SandboxStreamVMT {
/**
* @brief Object instance offset.
*/
size_t instance_offset;
/**
* @brief Stream write buffer method.
*/

View File

@ -117,8 +117,9 @@ void sbStart(sb_class_t *sbcp, const sb_config_t *config) {
/* Additional context information.*/
sbcp->config = config;
chThdGetSelfX()->ctx.syscall.p = (const void *)sbcp;
chThdGetSelfX()->ctx.syscall.psp = __get_PSP();
sbcp->tp = chThdGetSelfX();
sbcp->tp->ctx.syscall.p = (const void *)sbcp;
sbcp->tp->ctx.syscall.psp = __get_PSP();
/* Jumping to the unprivileged code.*/
port_unprivileged_jump(pc, psp);