aboutsummaryrefslogtreecommitdiffstats
path: root/demos/ATSAMA5D2
diff options
context:
space:
mode:
authorisiora <none@example.com>2018-01-24 20:51:18 +0000
committerisiora <none@example.com>2018-01-24 20:51:18 +0000
commit4697714fdcac6e1fff100b4bc54ff463e3e5994c (patch)
tree784e0de293d7f95b0a53a6849108a28b495ed648 /demos/ATSAMA5D2
parent3c45a0fd986a522bba49e5a614791713bbc39297 (diff)
downloadChibiOS-4697714fdcac6e1fff100b4bc54ff463e3e5994c.tar.gz
ChibiOS-4697714fdcac6e1fff100b4bc54ff463e3e5994c.tar.bz2
ChibiOS-4697714fdcac6e1fff100b4bc54ff463e3e5994c.zip
Stack resize.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@11404 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'demos/ATSAMA5D2')
-rwxr-xr-xdemos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-SEC/Makefile6
-rwxr-xr-xdemos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-SEC/main.c35
2 files changed, 17 insertions, 24 deletions
diff --git a/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-SEC/Makefile b/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-SEC/Makefile
index 7d9752479..570dfbd1f 100755
--- a/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-SEC/Makefile
+++ b/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-SEC/Makefile
@@ -60,19 +60,19 @@ endif
# Stack size to be allocated to the ARM System/User stack. This
# stack is the stack used by the main() thread.
ifeq ($(USE_SYSTEM_STACKSIZE),)
- USE_SYSTEM_STACKSIZE = 0x400
+ USE_SYSTEM_STACKSIZE = 0x800
endif
# Stack size to the allocated to the ARM IRQ stack. This
# stack is used for processing interrupts and exceptions.
ifeq ($(USE_EXCEPTIONS_STACKSIZE),)
- USE_IRQ_STACKSIZE = 0x400
+ USE_IRQ_STACKSIZE = 0x800
endif
# Stack size to the allocated to the ARM FIQ stack. This
# stack is used for processing interrupts and exceptions.
ifeq ($(USE_FIQ_STACKSIZE),)
- USE_FIQ_STACKSIZE = 0x400
+ USE_FIQ_STACKSIZE = 0x800
endif
# Stack size to the allocated to the ARM Supervisor stack. This
diff --git a/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-SEC/main.c b/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-SEC/main.c
index 4815ba90c..25218594f 100755
--- a/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-SEC/main.c
+++ b/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-SEC/main.c
@@ -21,7 +21,6 @@
#include "chprintf.h"
#include "chsmc.h"
-static thread_reference_t main_t;
/*
* LED blinker thread, times are in milliseconds.
*/
@@ -57,17 +56,18 @@ static const SerialConfig sdcfg = {
* Dummy trust service thread.
*/
static THD_WORKING_AREA(waDummyTrustedService, 512);
-static THD_FUNCTION(DummyTrustedService, eventMask) {
+static THD_FUNCTION(DummyTrustedService, arg) {
+ (void) arg;
- msg_t m;
+ msg_t msg;
smc_service_t *svcp;
chRegSetThreadName("DTS");
/*
* Register the trust service
*/
- registered_object_t *smc_hdl = smcRegisterMeAsService("DummyTrustedService");
- if (smc_hdl == NULL) {
+ svcp = smcRegisterMeAsService("DummyTrustedService");
+ if (svcp == NULL) {
/*
* Error: the service is already registered
* or memory is exhausted.
@@ -77,23 +77,18 @@ static THD_FUNCTION(DummyTrustedService, eventMask) {
/*
* Wait and process requests
*/
- svcp = (smc_service_t *)smc_hdl->objp;
- svcp->svct = NULL;
while (true) {
- chSysLock();
- chEvtSignalI(main_t, (eventmask_t) eventMask);
- m = smcServiceWaitRequestS(svcp);
- chSysUnlock();
- if (m == MSG_OK && svcp->svc_datalen > 0) {
+ msg = smcServiceWaitRequest(svcp, MSG_OK);
+ if (msg == MSG_OK && svcp->svc_datalen > 0) {
*((char *)svcp->svc_data + svcp->svc_datalen - 1) = '\0';
-#if 0
+#if 1
chprintf((BaseSequentialStream*)&SD1,
"My non secure 'alter ego' has a request.\r\n");
chprintf((BaseSequentialStream*)&SD1,
"She tells: '");
#endif
chprintf((BaseSequentialStream*)&SD1, (char *)svcp->svc_data);
- chprintf((BaseSequentialStream*)&SD1, "\r\n");
+ chprintf((BaseSequentialStream*)&SD1, "'\r\n");
}
chThdSleepMilliseconds(500);
}
@@ -104,8 +99,7 @@ static THD_FUNCTION(DummyTrustedService, eventMask) {
*/
int main(void) {
- eventmask_t eventMask = 1;
- eventmask_t eventMaskAll = 0;
+ uint32_t n;
/*
* System initializations.
@@ -119,7 +113,6 @@ int main(void) {
chSysInit();
smcInit();
- main_t = chThdGetSelfX();
/*
* Activates the serial driver 0 using the driver default configuration.
*/
@@ -135,10 +128,10 @@ int main(void) {
/*
* Creates the dummy service thread.
*/
+ n = 0;
chThdCreateStatic(waDummyTrustedService, sizeof(waDummyTrustedService), NORMALPRIO-32,
- DummyTrustedService, (void *)eventMask);
- eventMaskAll |= eventMask;
- eventMask <<= 1;
+ DummyTrustedService, (void *)n);
+ ++n;
/*
* The DDR memory is divided in 4 regions. Each region is 2MB large.
@@ -186,7 +179,7 @@ int main(void) {
/*
* Wait that all services are initialized
*/
- chEvtWaitAll(eventMaskAll);
+ smcWaitServicesStarted(n);
/*
* Jump in the NON SECURE world
* This 'main' thread become the non secure environment as view by