tests/fault_handler: Suppress cppcheck errors
This code is supposed to hit the null pointer. tests/fault_handler/main.c:43: error (nullPointer): Null pointer dereference: (volatile unsigned int*)(0x00000000u) tests/fault_handler/main.c:44: error (nullPointer): Null pointer dereference: (volatile unsigned int*)(0x00000000u)
This commit is contained in:
parent
e5d60176e4
commit
46f599c1a9
@ -36,11 +36,14 @@
|
|||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
puts("Fault handler test application");
|
puts("Fault handler test application");
|
||||||
printf("This application will crash by attempting to write to address 0x%08x\n", FORBIDDEN_ADDRESS);
|
printf("This application will crash by attempting to write to address 0x%08x\n",
|
||||||
|
FORBIDDEN_ADDRESS);
|
||||||
puts("Waiting 1 second before crashing...");
|
puts("Waiting 1 second before crashing...");
|
||||||
xtimer_usleep(1000000lu);
|
xtimer_usleep(1000000lu);
|
||||||
puts("Write to forbidden address " PRINT_MACRO(FORBIDDEN_ADDRESS));
|
puts("Write to forbidden address " PRINT_MACRO(FORBIDDEN_ADDRESS));
|
||||||
|
/* cppcheck-suppress nullPointer */
|
||||||
*((volatile unsigned int *) FORBIDDEN_ADDRESS) = 12345u;
|
*((volatile unsigned int *) FORBIDDEN_ADDRESS) = 12345u;
|
||||||
|
/* cppcheck-suppress nullPointer */
|
||||||
unsigned int readback = *((volatile unsigned int *) FORBIDDEN_ADDRESS);
|
unsigned int readback = *((volatile unsigned int *) FORBIDDEN_ADDRESS);
|
||||||
printf("readback: 0x%08x\n", readback);
|
printf("readback: 0x%08x\n", readback);
|
||||||
puts("We did not expect the application to survive the previous write.");
|
puts("We did not expect the application to survive the previous write.");
|
||||||
@ -48,6 +51,6 @@ int main(void)
|
|||||||
puts(PRINT_MACRO(INVALID_INSTRUCTION));
|
puts(PRINT_MACRO(INVALID_INSTRUCTION));
|
||||||
INVALID_INSTRUCTION;
|
INVALID_INSTRUCTION;
|
||||||
puts("Failed to crash the program, hanging...");
|
puts("Failed to crash the program, hanging...");
|
||||||
while(1) {}
|
while (1) {}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user