cortex demo for fuzzing

This commit is contained in:
Alwin Berger 2022-01-03 16:37:57 +01:00
parent c2c3b56207
commit 6e688a7451
3 changed files with 21 additions and 2 deletions

View File

@ -68,7 +68,7 @@ int main()
#error "Invalid Selection...\nPlease Select a Demo application from the main command" #error "Invalid Selection...\nPlease Select a Demo application from the main command"
} }
#endif /* if ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 ) */ #endif /* if ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 ) */
snprint //snprint
return 0; return 0;
} }

View File

@ -77,6 +77,9 @@ void main_blinky( void )
} }
} }
volatile unsigned char FUZZ_INPUT[4096] = {2};
volatile uint32_t FUZZ_LENGTH = 4096;
static void prvQueueSendTask( void * pvParameters ) static void prvQueueSendTask( void * pvParameters )
{ {
TickType_t xNextWakeTime; TickType_t xNextWakeTime;
@ -101,6 +104,11 @@ static void prvQueueSendTask( void * pvParameters )
} }
} }
__attribute__((noinline)) static void trigger_Qemu_break( void )
{
puts("Trigger");
}
volatile uint32_t ulRxEvents = 0; volatile uint32_t ulRxEvents = 0;
static void prvQueueReceiveTask( void * pvParameters ) static void prvQueueReceiveTask( void * pvParameters )
{ {
@ -121,10 +129,14 @@ static void prvQueueReceiveTask( void * pvParameters )
* is it the expected value? If it is, toggle the LED. */ * is it the expected value? If it is, toggle the LED. */
if( ulReceivedValue == ulExpectedValue ) if( ulReceivedValue == ulExpectedValue )
{ {
printf( "%s\n", "blinking" ); printf( "%s %u -> %u\n", "blinking", ulRxEvents, FUZZ_INPUT[0]);
vTaskDelay( 1000 ); vTaskDelay( 1000 );
ulReceivedValue = 0U; ulReceivedValue = 0U;
ulRxEvents++; ulRxEvents++;
if (ulRxEvents%4096 == FUZZ_INPUT[0])
{
trigger_Qemu_break();
}
} }
} }
} }

View File

@ -0,0 +1,7 @@
let pkgs = import <nixpkgs> {
#crossSystem = (import <nixpkgs/lib>).systems.examples.arm-embedded;
};
in
pkgs.mkShell {
nativeBuildInputs = [pkgs.gcc-arm-embedded];
}