diff --git a/sw/tests/testSp.c b/sw/tests/testSp.c new file mode 100644 index 0000000..96832a8 --- /dev/null +++ b/sw/tests/testSp.c @@ -0,0 +1,24 @@ +// Copyright 2024 ETH Zurich and University of Bologna. +// Licensed under the Apache License, Version 2.0, see LICENSE for details. +// SPDX-License-Identifier: Apache-2.0 +// +// Sergio Mazzola + +// Test stack pointer corruption + +#include +#include + +int main() { + volatile int32_t a = 0; + + for (volatile int32_t i = 0; i < 5; i++) { + a += i; + } + + if (a == 10) { + return 0x7fffffff; + } else { + return 0xabcdef00; + } +}