From 6a9de3178ed047553921610c5e9c18bc5d88ebe5 Mon Sep 17 00:00:00 2001 From: Oren Cohen Date: Mon, 17 Dec 2018 16:38:13 +0200 Subject: [PATCH 1/3] Fix SPM HAL test When accessing non-secure ram and flash r1 was actually used by the calling function. Change to a callee saved register. --- TESTS/mbed_hal/spm/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TESTS/mbed_hal/spm/main.cpp b/TESTS/mbed_hal/spm/main.cpp index d652335f92..a920b13c3b 100644 --- a/TESTS/mbed_hal/spm/main.cpp +++ b/TESTS/mbed_hal/spm/main.cpp @@ -84,7 +84,7 @@ __attribute__((naked)) void call_mem(uint32_t addr) // since exception will be generated for invalid memory access. // Other instructions are for calling do_nothing function according to AAPCS. __ASM( - "LDR r1, [r0]\n" + "LDR r4, [r0]\n" "BX lr\n" ); } From 9b573acfa40e2e190c964ec0e612d770184991f7 Mon Sep 17 00:00:00 2001 From: Oren Cohen Date: Mon, 17 Dec 2018 16:43:09 +0200 Subject: [PATCH 2/3] Run the non-secure cases first --- TESTS/mbed_hal/spm/main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TESTS/mbed_hal/spm/main.cpp b/TESTS/mbed_hal/spm/main.cpp index a920b13c3b..935a51d408 100644 --- a/TESTS/mbed_hal/spm/main.cpp +++ b/TESTS/mbed_hal/spm/main.cpp @@ -138,10 +138,10 @@ utest::v1::status_t fault_override_teardown(const Case *const source, const size } Case cases[] = { - Case("SPM - Access secure RAM", fault_override_setup, secure_ram_fault_test, fault_override_teardown), - Case("SPM - Access secure Flash", fault_override_setup, secure_flash_fault_test, fault_override_teardown), Case("SPM - Access non-secure RAM", fault_override_setup, non_secure_ram_fault_test, fault_override_teardown), Case("SPM - Access non-secure Flash", fault_override_setup, non_secure_flash_fault_test, fault_override_teardown), + Case("SPM - Access secure RAM", fault_override_setup, secure_ram_fault_test, fault_override_teardown), + Case("SPM - Access secure Flash", fault_override_setup, secure_flash_fault_test, fault_override_teardown) }; utest::v1::status_t greentea_test_setup(const size_t number_of_cases) From b4092678833746cc7e691bd5e52b20e6409c5a8b Mon Sep 17 00:00:00 2001 From: Alexander Zilberkant Date: Sun, 23 Dec 2018 11:37:29 +0200 Subject: [PATCH 3/3] Update TESTS/mbed_hal/spm/main.cpp Use r3 instead of r4 Co-Authored-By: orenc17 --- TESTS/mbed_hal/spm/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TESTS/mbed_hal/spm/main.cpp b/TESTS/mbed_hal/spm/main.cpp index 935a51d408..4863b2e6a6 100644 --- a/TESTS/mbed_hal/spm/main.cpp +++ b/TESTS/mbed_hal/spm/main.cpp @@ -84,7 +84,7 @@ __attribute__((naked)) void call_mem(uint32_t addr) // since exception will be generated for invalid memory access. // Other instructions are for calling do_nothing function according to AAPCS. __ASM( - "LDR r4, [r0]\n" + "LDR r3, [r0]\n" "BX lr\n" ); }