Skip to content

Commit 0775393

Browse files
committed
Reduce memory footprint of this app
This will help supporting more targets.
1 parent 0fe16ff commit 0775393

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

source/led1.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ static void led1_main(const void *);
1818
* We do not need large stacks in either the main nor the interrupt thread, as
1919
* we do not do anything special in them. */
2020
UVISOR_BOX_NAMESPACE(NULL);
21-
UVISOR_BOX_HEAPSIZE(3 * 1024);
21+
UVISOR_BOX_HEAPSIZE(2 * 1024);
2222
UVISOR_BOX_MAIN(led1_main, osPriorityNormal, 512);
2323
UVISOR_BOX_CONFIG(box_led1, acl, 512, box_context);
2424

@@ -39,6 +39,6 @@ static void led1_main(const void *)
3939
led1 = !led1;
4040
++uvisor_ctx->heartbeat;
4141
alloc_fill_wait_verify_free(size, seed, 211);
42-
specific_alloc_fill_wait_verify_free(alloc, 5 * kB, seed, 107);
42+
specific_alloc_fill_wait_verify_free(alloc, 1 * kB, seed, 107);
4343
}
4444
}

source/led2.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ static void led2_main(const void *);
1818
* We do not need large stacks in either the main nor the interrupt thread, as
1919
* we do not do anything special in them. */
2020
UVISOR_BOX_NAMESPACE(NULL);
21-
UVISOR_BOX_HEAPSIZE(3 * 1024);
21+
UVISOR_BOX_HEAPSIZE(2 * 1024);
2222
UVISOR_BOX_MAIN(led2_main, osPriorityNormal, 512);
2323
UVISOR_BOX_CONFIG(box_led2, acl, 512, box_context);
2424

@@ -38,13 +38,13 @@ static void led2_main(const void *)
3838
* page heap!
3939
*/
4040
/* Allocate one page. */
41-
alloc = secure_allocator_create_with_pages(4 * kB, 1 * kB);
41+
alloc = secure_allocator_create_with_pages(2 * kB, 1 * kB);
4242
/* Allocate another page. */
43-
SecureAllocator alloc2 = secure_allocator_create_with_pages(4 * kB, 1 * kB);
43+
SecureAllocator alloc2 = secure_allocator_create_with_pages(8 * kB, 1 * kB);
4444
/* Deallocate alloc1 page, creating a hole. */
4545
secure_allocator_destroy(alloc);
4646
/* Allocate two pages. */
47-
alloc = secure_allocator_create_with_pages(uvisor_get_page_size() + 3 * kB, 6 * kB);
47+
alloc = secure_allocator_create_with_pages(4 * kB, 1 * kB);
4848
/* Deallocate alloc2 page, creating another hole. */
4949
secure_allocator_destroy(alloc2);
5050

@@ -57,9 +57,9 @@ static void led2_main(const void *)
5757
alloc_fill_wait_verify_free(size, seed, 311);
5858

5959
/* Allocate in first page */
60-
specific_alloc_fill_wait_verify_free(alloc, 6 * kB, seed, 0);
60+
specific_alloc_fill_wait_verify_free(alloc, 1 * kB, seed, 0);
6161

6262
/* Allocate in second page */
63-
specific_alloc_fill_wait_verify_free(alloc, 6 * kB, seed, 101);
63+
specific_alloc_fill_wait_verify_free(alloc, 1 * kB, seed, 101);
6464
}
6565
}

source/led3.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ static void led3_main(const void *);
1818
* We need at least 1kB in the main thread as we use printf in it. The interrupt
1919
* stack size can be smaller as we do not do anything special in them. */
2020
UVISOR_BOX_NAMESPACE(NULL);
21-
UVISOR_BOX_HEAPSIZE(3 * 1024);
21+
UVISOR_BOX_HEAPSIZE(2 * 1024);
2222
UVISOR_BOX_MAIN(led3_main, osPriorityNormal, 1024);
2323
UVISOR_BOX_CONFIG(box_led3, acl, 512, box_context);
2424

source/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ MAIN_ACL(g_main_acl);
2525

2626
/* Enable uVisor. */
2727
UVISOR_SET_MODE_ACL(UVISOR_ENABLED, g_main_acl);
28-
UVISOR_SET_PAGE_HEAP(8 * 1024, 5);
28+
UVISOR_SET_PAGE_HEAP(2 * 1024, 8);
2929

3030
static void main_alloc(void)
3131
{
@@ -35,7 +35,7 @@ static void main_alloc(void)
3535

3636
while (1) {
3737
alloc_fill_wait_verify_free(50, seed, 577);
38-
specific_alloc_fill_wait_verify_free(alloc, 5 * kB, seed, 97);
38+
specific_alloc_fill_wait_verify_free(alloc, 1 * kB, seed, 97);
3939
seed++;
4040
}
4141
}

0 commit comments

Comments
 (0)