System Timer for MPC56xx

Forum related to ERIKA Enterprise and RT-Druid version 2

Moderator: paolo.gai

Locked
eugenskt

System Timer for MPC56xx

Post by eugenskt »

Hello,

The system timer of MPC56xx needs this defines: EE_DECREMENTER_LEVEL and EE_DECREMENTER_PRIORITY.

Code: Select all

CC    ee_system_timer.c
"D:\\Erika\\eclipse\\plugins\\CO1C02~1.201\\ee_files\\pkg\\cpu\\e200zx\\src\\ee_system_timer.c", line 78: error (dcc:1525): identifier EE_DECREMENTER_LEVEL not declared
"D:\\Erika\\eclipse\\plugins\\CO1C02~1.201\\ee_files\\pkg\\cpu\\e200zx\\src\\ee_system_timer.c", line 79: error (dcc:1525): identifier EE_DECREMENTER_PRIORITY not declared
make: *** [obj/pkg/cpu/e200zx/src/ee_system_timer.o] Error 1
How can I generate it via oil file?

Currently I make is this way:

Code: Select all

	COUNTER os_counter {
		 MINCYCLE = 1;
		 //MAXALLOWEDVALUE = 0xFFFFFFF;
		 MAXALLOWEDVALUE = 0xFFFFFFFF;
		 TICKSPERBASE = 1;

		 TYPE = HARDWARE{
		 	DEVICE = "DECREMENTER";
		 	SYSTEM_TIMER = TRUE;
		 	//PRIORITY = 15;
		 };
		 SECONDSPERTICK = 0.002; /* 2 ms tick duration */
Another question:
Why can not I take a U32_MAX value for MAXALLOWEDVALUE ?

Code: Select all

ERROR > Unable to load "D:\Erika\workspace\Test\conf.oil" caused by :The value '0xFFFFFFFF' is invalid. java.lang.NumberFormatException: For input string: "FFFFFFFF"
Thanks!

Best Regards, Eugen
fesposito

Re: System Timer for MPC56xx

Post by fesposito »

Dear Eugen,

i suppose you are using the Dynamic ISR table approach, that means that in your .oil file you have something like this:

...
...
EE_OPT = "EE_ISR_DYNAMIC_TABLE";
EE_OPT="EE_SYSTEM_TIMER_DEVICE_DECREMENTER";
...
...

those errors are due to a missing definitions (sorry, it is our fault!). This depends on the fact that the ISR table Dynamic approach is not OSEK-oriented and most of our customers do not use this feature anymore. Hence we wrongly removed the generation of such definitions from RT-Druid missing our backward compatibility.

The preferable solution is the static ISR table (OSEK-like) approach that represents the default scenario. I noticed that you added the ee_vtable.c module in your porting, hence i suppose you already supported this feature. According with this assumption removing the "EE_ISR_DYNAMIC_TABLE" from your .oil file should solve your problem.

However, if you want to use the dynamic approach, please wait for our next commit on Erika repository, i will remove the cause of your fault on dynamic isr table management.

We really appreciate your extra-effort.

Regards

Francesco
fesposito

Re: System Timer for MPC56xx

Post by fesposito »

Concerning the 0xFFFFFFFF value in the .oil file, please use this as max value:

MAXALLOWEDVALUE = 2147483647;

Ciao
Francesco
eugenskt

Re: System Timer for MPC56xx

Post by eugenskt »

Hello,

I use options

Code: Select all

		EE_OPT = "ENABLE_SYSTEM_TIMER";
		EE_OPT = "EE_SYSTEM_TIMER_DEVICE_DECREMENTER";
for the system timer

Now IVOR10 calls directly EE_e200zx_system_timer_handle with counts the system timer. Is there a switch from ISR1 (IVOR10) and ISR2 (EE_e200zx_system_timer_handler)? Or is EE_e200zx_system_timer_handle handled as a ISR1?

//Eugen
paolo.gai
Administrator
Posts: 877
Joined: Thu Dec 07, 2006 12:11 pm

Re: System Timer for MPC56xx

Post by paolo.gai »

The system timer should be a ISR2, because it will implement the alarm notifications linked to its counter... thus activating tasks, setting events, ...

PJ
fesposito

Re: System Timer for MPC56xx

Post by fesposito »

Dear Eugen,

you can also remove the EE_OPT = "ENABLE_SYSTEM_TIMER"; if you have an updated kernel. It is not necessary anymore.

But according with the PJ's previous post, it must to be a ISR2. You can set it to ISR1 following your requirements but be aware to handle your ISR1 in a proper way.

Please notice that we use ISR2_INT because decrementer is a cpu-isr, you can try with ISR1_INT, references:

erika/pkg/cpu/e200zx/src/ee_system_timer.c
erika/pkg/cpu/e200zx/inc/ee_irq.h

but it is not guranteed, it is up to you managing the ISR1.

Francesco
fesposito

Re: System Timer for MPC56xx

Post by fesposito »

Dear Eugen,

i talked with my collegue in charge of generated part of Erika. If you want to develop your system timer this can be a solution without modifying the kernel:

1) remove each reference to system-timer from the oil file;
2) declare a new ISR1 in the oil file e provide the associated code in your project:

ISR your_system_timer {
CATEGORY = 1;
PRIORITY = XX;
ENTRY = "XXX";
};

3) BE AWARE that you cannot call kernel primitives from a ISR1, hence you have to provide your mechanism in order to have your app working fine if you decide to have your system timer based on ISR1.

Ciao
Francesco
paolo.gai
Administrator
Posts: 877
Joined: Thu Dec 07, 2006 12:11 pm

Re: System Timer for MPC56xx

Post by paolo.gai »

In other words, it cannot be used as the "system timer" as specified by the OSEK standard...

the System Timer ISR must be an ISR2...

PJ
Locked