Trying different scheduling algorithms in erika OS

Forum related to ERIKA Enterprise and RT-Druid version 3

Moderator: paolo.gai

Post Reply
saydam
Newbie
Posts: 3
Joined: Mon Jan 06, 2020 1:55 pm

Trying different scheduling algorithms in erika OS

Post by saydam » Tue Jan 07, 2020 6:50 am

Hello everybody, this is my first post.

I was impressed by the work of Paolo Gai.
I will embed erika to arduino uno, but i want to try different scheduling algorithms(e.g. Round robin, SJF, FCFS).
My purpose is evaluating the performance of scheduling algorithms.
Could i try this ? Is it possible ?

If it is possible, how can i do that, is there a document ? :1huh:

paolo.gai
Administrator
Posts: 872
Joined: Thu Dec 07, 2006 12:11 pm

Re: Trying different scheduling algorithms in erika OS

Post by paolo.gai » Thu Jan 09, 2020 9:37 am

Hi,

Thanks for your compliments, not only to me but to the whole team who is working on ERIKA.

About the support of additional scheduling algorithms: ERIKA3 has the parts related to the scheduler separated in separate files. You can try to change them, but it will not be as easy as it was in Shark (http://shark.sssup.it).

My suggestion would be to start with an existing demo, compile it. then understand where are the functions (search for example for ee_oo_sched*.c), and then modify them. The thing which is lacking in ERIKA3 is a time support like we had in Shark, this was very useful when designing the time handling and the handling of the wake up points....

Ciao,

PJ

saydam
Newbie
Posts: 3
Joined: Mon Jan 06, 2020 1:55 pm

Re: Trying different scheduling algorithms in erika OS

Post by saydam » Thu Mar 26, 2020 10:36 am

Actually, now i think to try time trigger architecture and event trigger architecture on my arduino.
I know erika supports Earliest Deadline First (EDF) as event trigger architecture.

I can call tasks with static schedule table with the aid of alarms.
Then, can we say Erika supports time trigger architecture ?

paolo.gai
Administrator
Posts: 872
Joined: Thu Dec 07, 2006 12:11 pm

Re: Trying different scheduling algorithms in erika OS

Post by paolo.gai » Thu Mar 26, 2020 7:43 pm

Hi,

EDF was supported on ERIKA2, not yet ported to ERIKA3.

For a time triggered implementation, you should try with emulating it with a Schedule table...

PJ

saydam
Newbie
Posts: 3
Joined: Mon Jan 06, 2020 1:55 pm

Re: Trying different scheduling algorithms in erika OS

Post by saydam » Sun Apr 12, 2020 9:14 pm

Hi,

I downloaded VirtualBox for Erika v2 and i rearranged the oil and cpp file according to EDF configuration like https://erika.tuxfamily.org/wiki/index. ... _scheduler.

However i took this error:

Code: Select all

22:11:24 **** Incremental Build of configuration Default for project Event_Trigger_Architecture ****
/home/evidence/workspace/Event_Trigger_Architecture/Debug/make_launcher.bat all 
Using erika files in /home/evidence/Erika_SVN/
CC    eecfg.c
CXX   code.cpp
In file included from /home/evidence/Erika_SVN//pkg/ee.h:179:0,
                 from /home/evidence/workspace/Event_Trigger_Architecture/code.cpp:41:
/home/evidence/Erika_SVN//pkg/mcu/atmel_atmega/inc/ee_mcu.h: In function 'EE_TIME EE_hal_gettime()':
/home/evidence/Erika_SVN//pkg/mcu/atmel_atmega/inc/ee_mcu.h:279:24: error: 'EE_timer_1_get' was not declared in this scope
  return EE_timer_1_get();
                        ^
/home/evidence/workspace/Event_Trigger_Architecture/code.cpp: In function 'int main()':
/home/evidence/workspace/Event_Trigger_Architecture/code.cpp:65:17: error: 'EE_timer1_init' was not declared in this scope
  EE_timer1_init();
                 ^
/home/evidence/workspace/Event_Trigger_Architecture/code.cpp:66:18: error: 'EE_timer1_start' was not declared in this scope
  EE_timer1_start();
                  ^
make: *** [obj/code.o] Error 1

22:11:32 Build Finished (took 7s.392ms)
I know this error for not defining __TIMER_1_USED__ . I also define as EE_OPT but there is no change at error. How should i make a change in code to avoid this error ?

My oil file

Code: Select all

CPU mySystem {

	OS myOs {

		EE_OPT = "DEBUG";

		CPU_DATA = AVR8 {
			APP_SRC = "code.cpp";
			APP_SRC = "task.c";
		  MULTI_STACK = FALSE;
		};

		MCU_DATA = MEGA {
			MODEL = MEGA_328p;
		};

		EE_OPT = "__ARDUINO_SDK__";
		EE_OPT = "__ARDUINO_UNO_328__";
		/* EE_OPT = "__ARDUINO_NANO_328__"; */
		/* Used to build separate libarduino.a */
		EE_OPT = "__ADD_LIBS__";
		LIB = ENABLE {
			NAME = "ARDUINO_SDK";
		};

		KERNEL_TYPE = EDF {
			TICK_TIME = "125 ns";
		};

	};

	COUNTER SystemTimer {
       MINCYCLE = 1;
       MAXALLOWEDVALUE = 65535;
       TICKSPERBASE = 1;
       TYPE = HARDWARE {
         DEVICE = "TIMER1_COMPA";
         SYSTEM_TIMER = TRUE;
       };
       SECONDSPERTICK = 0.001;
 };

	ALARM myAlarm {
		COUNTER = SystemTimer;
	    ACTION = ACTIVATETASK { TASK = TaskL1; };
	};
	
		TASK TaskL1 {
		PRIORITY = 1;
		STACK = SHARED;
		SCHEDULE = FULL;
		REL_DEADLINE = "10 ms";
	};

};
My cpp file

Code: Select all

#include "ee.h"
#include "Arduino.h"

// Pin 13 has an LED connected on most Arduino boards.
// give it a name:
int led = 13;

void loop(void)
{
	ActivateTask(TaskL1);
}

void setup(void)
{
	// initialize the digital pin as an output.
	pinMode(led, OUTPUT);
}

int main(void)
{
	EE_mcu_init();

	init();

	EE_timer1_init();
	EE_timer1_start();

#if defined(USBCON)
	USBDevice.attach();
#endif
	
	setup();

	for (;;) {
		loop();
		if (serialEventRun) serialEventRun();
	}

	return 0;

}

Post Reply