Merge branch 'experiments/unaligned_load' into feature/mbedtls_notworking
This commit is contained in:
commit
fc9d9ff89c
2 changed files with 544 additions and 473 deletions
File diff suppressed because it is too large
Load diff
|
@ -207,8 +207,9 @@ void test_string(const char *string, char *label, bool evict_cache)
|
|||
run_test(string, test_l16si, "load as l16si", nullvalue, evict_cache);
|
||||
}
|
||||
|
||||
static void test_doubleexception();
|
||||
static void test_isr();
|
||||
static void test_sign_extension();
|
||||
static void test_system_interaction();
|
||||
void sanity_tests(void);
|
||||
|
||||
void user_init(void)
|
||||
|
@ -225,8 +226,11 @@ void user_init(void)
|
|||
test_string(iromtest, "Cached flash", 0);
|
||||
test_string(iromtest, "'Uncached' flash", 1);
|
||||
|
||||
test_doubleexception();
|
||||
test_isr();
|
||||
test_sign_extension();
|
||||
|
||||
xTaskHandle taskHandle;
|
||||
xTaskCreate(test_system_interaction, (signed char *)"interactionTask", 256, &taskHandle, 2, NULL);
|
||||
}
|
||||
|
||||
static volatile bool frc1_ran;
|
||||
|
@ -241,9 +245,9 @@ static void frc1_interrupt_handler(void)
|
|||
frc1_finished = true;
|
||||
}
|
||||
|
||||
static void test_doubleexception()
|
||||
static void test_isr()
|
||||
{
|
||||
printf("Testing DoubleException behaviour...\r\n");
|
||||
printf("Testing behaviour inside ISRs...\r\n");
|
||||
timer_set_interrupts(FRC1, false);
|
||||
timer_set_run(FRC1, false);
|
||||
_xt_isr_attach(INUM_TIMER_FRC1, frc1_interrupt_handler);
|
||||
|
@ -270,12 +274,40 @@ static void test_sign_extension()
|
|||
int16_t *shorts_p = (int16_t *)unsigned_shorts;
|
||||
if(shorts_p[0] == -3 && shorts_p[1] == -4 && shorts_p[2] == -5 && shorts_p[3] == -32767 && shorts_p[4] == 44)
|
||||
{
|
||||
printf("l16si sign extension worked as expected.\r\n");
|
||||
printf("l16si sign extension PASSED.\r\n");
|
||||
} else {
|
||||
printf("l16si sign extension failed. Got values %d %d %d %d %d\r\n", shorts_p[0], shorts_p[1], shorts_p[2], shorts_p[3], shorts_p[4]);
|
||||
printf("ERROR: l16si sign extension failed. Got values %d %d %d %d %d\r\n", shorts_p[0], shorts_p[1], shorts_p[2], shorts_p[3], shorts_p[4]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* test that running unaligned loads in a running FreeRTOS system doesn't break things
|
||||
|
||||
The following tests run inside a FreeRTOS task, after everything else.
|
||||
*/
|
||||
static void test_system_interaction()
|
||||
{
|
||||
uint32_t start = xTaskGetTickCount();
|
||||
printf("Starting system/timer interaction test (takes approx 30 seconds)...\n");
|
||||
for(int i = 0; i < 200*1000; i++) {
|
||||
test_naive_strcpy_a0(iromtest);
|
||||
test_naive_strcpy_a2(iromtest);
|
||||
test_naive_strcpy_a3(iromtest);
|
||||
test_naive_strcpy_a4(iromtest);
|
||||
test_naive_strcpy_a5(iromtest);
|
||||
test_naive_strcpy_a6(iromtest);
|
||||
/*
|
||||
const volatile char *string = iromtest;
|
||||
volatile char *to = dest;
|
||||
while((*to++ = *string++))
|
||||
;
|
||||
*/
|
||||
}
|
||||
uint32_t ticks = xTaskGetTickCount() - start;
|
||||
printf("Timer interaction test PASSED after %dms.\n", ticks*portTICK_RATE_MS);
|
||||
while(1) {}
|
||||
}
|
||||
|
||||
/* The following "sanity tests" are designed to try to execute every code path
|
||||
* of the LoadStoreError handler, with a variety of offsets and data values
|
||||
* designed to catch any mask/shift errors, sign-extension bugs, etc */
|
||||
|
|
Loading…
Reference in a new issue