Skip to content

Commit

Permalink
Sw: Add test for stack pointer corruption
Browse files Browse the repository at this point in the history
  • Loading branch information
sermazz committed Oct 8, 2024
1 parent d1090d3 commit a91fe71
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions sw/tests/testSp.c
Original file line number Diff line number Diff line change
@@ -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 <smazzola@iis.ee.ethz.ch>

// Test stack pointer corruption

#include <soc_addr_map.h>
#include <stdint.h>

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;
}
}

0 comments on commit a91fe71

Please sign in to comment.