Skip to content

Commit 85d3c8b

Browse files
committed
Reduce memory footprint of this app
1 parent 3088f23 commit 85d3c8b

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

source/client_a.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,13 @@ static const UvisorBoxAclItem acl[] = {
2929

3030
static void client_a_main(const void *);
3131

32-
/* Box configuration */
32+
/* Box configuration
33+
* This box has a smaller interrupt and main thread stack sizes as we do nothing
34+
* special in them. */
3335
UVISOR_BOX_NAMESPACE("client_a");
34-
UVISOR_BOX_HEAPSIZE(8192);
35-
UVISOR_BOX_MAIN(client_a_main, osPriorityNormal, UVISOR_BOX_STACK_SIZE);
36-
UVISOR_BOX_CONFIG(secure_number_client_a, acl, UVISOR_BOX_STACK_SIZE, box_context);
36+
UVISOR_BOX_HEAPSIZE(3072);
37+
UVISOR_BOX_MAIN(client_a_main, osPriorityNormal, 512);
38+
UVISOR_BOX_CONFIG(secure_number_client_a, acl, 512, box_context);
3739

3840
static uint32_t get_a_number()
3941
{

source/client_b.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,13 @@ static const UvisorBoxAclItem acl[] = {
3030

3131
static void client_b_main(const void *);
3232

33-
/* Box configuration */
33+
/* Box configuration
34+
* This box has a smaller interrupt stack size as we do nothing special in it.
35+
* The main thread uses printf so it needs at least 1kB of stack. */
3436
UVISOR_BOX_NAMESPACE("client_b");
35-
UVISOR_BOX_HEAPSIZE(8192);
36-
UVISOR_BOX_MAIN(client_b_main, osPriorityNormal, UVISOR_BOX_STACK_SIZE);
37-
UVISOR_BOX_CONFIG(secure_number_client_b, acl, UVISOR_BOX_STACK_SIZE, box_context);
37+
UVISOR_BOX_HEAPSIZE(3072);
38+
UVISOR_BOX_MAIN(client_b_main, osPriorityNormal, 1024);
39+
UVISOR_BOX_CONFIG(secure_number_client_b, acl, 512, box_context);
3840

3941
static uint32_t get_a_number()
4042
{

source/secure_number.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ static int set_number(uint32_t number);
3535

3636
/* Box configuration */
3737
UVISOR_BOX_NAMESPACE(NULL);
38-
UVISOR_BOX_HEAPSIZE(8192);
38+
UVISOR_BOX_HEAPSIZE(3072);
3939
UVISOR_BOX_MAIN(number_store_main, osPriorityNormal, UVISOR_BOX_STACK_SIZE);
4040
UVISOR_BOX_CONFIG(box_number_store, acl, UVISOR_BOX_STACK_SIZE, box_context);
4141

0 commit comments

Comments
 (0)