update demos

This commit is contained in:
Alwin Berger 2024-11-04 16:27:59 +01:00
parent 42889f6dc2
commit 25d1e590fc
7 changed files with 46 additions and 12 deletions

View File

@ -178,8 +178,11 @@ endif
endif
endif
ifeq ($(INTERRUPT_ACTIVATION), 1)
CFLAGS += -D INTERRUPT_ACTIVATION=1
ifeq ($(FUZZ_BYTES), 1)
CFLAGS += -D FUZZ_BYTES=1
endif
ifeq ($(FUZZ_INT_ACTIVATION), 1)
CFLAGS += -D FUZZ_INT_ACTIVATION=1
endif
ifeq ($(PARTITION_INPUT), 1)
CFLAGS += -D PARTITION_INPUT=1

View File

@ -46,8 +46,13 @@ static unsigned char next(int tasknum) {
// #define SHORT_CALC 50
// #define LONG_CALC 200
#ifdef FUZZ_BYTES
#define SHORT_CALC (25+next(task_id)%25)
#define LONG_CALC (150+next(task_id)%100)
#else
#define SHORT_CALC (50)
#define LONG_CALC (250)
#endif
#define HYPER_PERIOD 9
#define SIMULATE_PERIODS 4
@ -272,9 +277,17 @@ static void prv_MavlinkSendTask(void *pvParameters) {
static void prv_CopterControlTask(void *pvParameters) {
const int task_id = 9;
#ifndef FUZZ_INT_ACTIVATION
TickType_t xLastWakeTime = initial_release_time;
const TickType_t xFrequency = 5 / portTICK_PERIOD_MS;
#endif
trigger_job_done();
do {
#ifdef FUZZ_INT_ACTIVATION
ulTaskNotifyTake(pdTRUE, portMAX_DELAY);
#else
xTaskDelayUntil( &xLastWakeTime, xFrequency );
#endif
WASTE_USEC(LONG_CALC);
vTaskSuspendAll();
WASTE_USEC(SHORT_CALC);

View File

@ -57,7 +57,12 @@ SemaphoreHandle_t l_sem;
#define DO_TIME(X, Y) WASTE_USEC((X))
// #define DO_TIME(X, Y) PRINT_USEC((X), Y)
#define WCET_CLAMP(X, LB, UB, LABEL) DO_TIME((CLAMP(X,LB,UB)),LABEL)
// #define WCET_CLAMP(X, LB, UB, LABEL) DO_TIME(UB,LABEL)
#ifndef FUZZ_BYTES
// Produce the worst case, ignore input
#undef WCET_CLAMP
#define WCET_CLAMP(X, LB, UB, LABEL) DO_TIME(UB,LABEL)
#endif
__attribute__((noinline)) static void trigger_Qemu_break( void )
{
@ -97,7 +102,7 @@ void h_task(void *params) {
TickType_t xLastWakeTime = initial_release_time;
const TickType_t xFrequency = 1 / portTICK_PERIOD_MS;
while (1) {
#ifdef INTERRUPT_ACTIVATION
#ifdef FUZZ_INT_ACTIVATION
ulTaskNotifyTake(pdTRUE,portMAX_DELAY);
#else
xTaskDelayUntil( &xLastWakeTime, xFrequency );

View File

@ -355,7 +355,7 @@ static void prvC3T1( void * pvParameters ) {
xTaskNotify(xC3T2, DEBUG_VAL(x & 0x1, 0), eSetValueWithOverwrite);
// 3 different activation strategies -------------
// activate sporadically from interrupts
#ifdef INTERRUPT_ACTIVATION
#ifdef FUZZ_INT_ACTIVATION
ulTaskNotifyTake(pdTRUE,portMAX_DELAY);
#else
// activate with worst possible frequency (700us, but tick resolution is too low)

View File

@ -66,9 +66,14 @@ __attribute__((noinline)) static void trigger_job_done( void )
#define DO_TIME(X, Y) WASTE_USEC((X))
#ifndef FUZZ_BYTES
// Produce the worst case, ignore input
#define DEBUG_WCET(A) {A}
#endif
#ifdef DEBUG_WCET
#define DEBUG_VAL(X,D) (D)
#define WCET_CLAMP(X, LB, UB, LABEL) WASTE_NSEC(CLAMP(X,LB,UB),LABEL)
#define WCET_CLAMP(X, LB, UB, LABEL) DO_TIME(UB,LABEL)
#else
#define DEBUG_VAL(X,D) (X)
#define WCET_CLAMP(X, LB, UB, LABEL) DO_TIME(CLAMP(X,LB,UB),LABEL)
@ -308,8 +313,8 @@ static void prvTask5( void * pvParameters ) {
int y = ulTaskNotifyTake(pdTRUE, portMAX_DELAY); // sporadic
int succ = xSemaphoreTake(xMutex, 0); // try to take the mutex
if (succ == pdTRUE) {
// volatile uint16_t x = fuzz_short_next();
uint16_t x = 2000;
volatile uint16_t x = fuzz_short_next();
// uint16_t x = 2000;
int torun = 0;
torun = CLAMP(x, 0, 2000);
DO_TIME(torun, TASK_5_MESSAGE)

View File

@ -65,9 +65,14 @@ __attribute__((noinline)) static void trigger_job_done( void )
#define DO_TIME(X, Y) WASTE_NSEC((X))
#ifndef FUZZ_BYTES
// Produce the worst case, ignore input
#define DEBUG_WCET(A) {A}
#endif
#ifdef DEBUG_WCET
#define DEBUG_VAL(X,D) (D)
#define WCET_CLAMP(X, LB, UB, LABEL) WASTE_NSEC(CLAMP(X,LB,UB),LABEL)
#define WCET_CLAMP(X, LB, UB, LABEL) DO_TIME(UB,LABEL)
#else
#define DEBUG_VAL(X,D) (X)
#define WCET_CLAMP(X, LB, UB, LABEL) DO_TIME(CLAMP(X,LB,UB),LABEL)
@ -82,6 +87,9 @@ volatile int INPUT_POINTERS[NUM_TASKS] = {};
volatile uint32_t FUZZ_LENGTH = MAX_INPUT_BYTES;// ignored
// Read the Byte of Input, if the Input is exausted trigger the breakpoint instead
static unsigned char fuzz_char_next(int tasknum) {
#ifndef FUZZ_BYTES
return 255;
#endif
#ifdef PARTITION_INPUT
if (INPUT_POINTERS[tasknum] == 0) {
INPUT_POINTERS[tasknum] = tasknum * (MAX_INPUT_BYTES / NUM_TASKS);
@ -398,7 +406,7 @@ static void prvTask397( void * pvParameters ) {
// 3 different activation strategies -------------
// activate sporadically from interrupts
trigger_job_done();
#ifdef INTERRUPT_ACTIVATION
#ifdef FUZZ_INT_ACTIVATION
ulTaskNotifyTake(pdTRUE,portMAX_DELAY);
#else
// activate with worst possible frequency (700us, but tick resolution is too low)

View File

@ -75,7 +75,7 @@ __attribute__((noinline)) static void trigger_job_done( void )
#define DEBUG_WCET(A)
#endif
// #define INTERRUPT_ACTIVATION 1
// #define FUZZ_INT_ACTIVATION 1
// Begin Input Stuff
#define NUM_TASKS 10
@ -406,7 +406,7 @@ static void prvTask397( void * pvParameters ) {
// 3 different activation strategies -------------
// activate sporadically from interrupts
trigger_job_done();
#ifdef INTERRUPT_ACTIVATION
#ifdef FUZZ_INT_ACTIVATION
ulTaskNotifyTake(pdTRUE,portMAX_DELAY);
#else
// activate with worst possible frequency (700us, but tick resolution is too low)