-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sw: Add test for stack pointer corruption
- Loading branch information
Showing
1 changed file
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |