User`s manual
Copyright © Quantum Leaps, LLC. All Rights Reserved.
QDK™
Renesas RX with HEW
state-machine.com/rx
(12-13) The Renesas RX compiler requires this unusual syntax to define the inline assembly function 
set
_psw_i()
.
4.3 The Board Support Package for the “Vanilla” Port
The Board Support Package (BSP) for a QP application implements the board initialization, ISRs, QP 
callback functions, and application-specific board-specific functions. The whole BSP is located in the file 
bsp.c
 in the directory 
qpc\examples\rx\vanilla\renesas\dpp-yrdkrx62n\
.
4.3.1 Interrupt Service Routines (ISRs) for the “Vanilla” kernel
As mentioned earlier, the Renesas compiler enables the user to write ISRs as interrupt functions in C/C+
+. These compiler-generated ISRs are perfectly adequate for the non-preemptive Vanilla kernel.
Listing 6: Tick timer ISR for the Vanilla kernel in intprog.c
 (1) #include "vect.h"
 (2) #pragma section IntPRG
 . . .
 (3) void Excep_CMTU0_CMT0(void) {
 (4) QF_ISR_ENTRY(); /* inform the QF Vanilla kernel about entering the ISR */
 (5) #ifdef Q_SPY
 (6) l_tickTime_ += l_tickPeriod_; /* account for the clock rollover */
 #endif
 (7) QF_TICK(&l_tickISR);  /* process all armed time events */
 (8) QF_ISR_EXIT(); /* inform the QF vanilla kernel about exiting the ISR */
 }
(1) The header file 
vect.h
 provides declarations of all possible interrupt functions.
(2) All ISRs must be placed in the 
IntPRG
 section.
(3) The ISR must be one of the 
#pragma interrupt
 functions declared in the 
vect.h
 header file.
(4) The macro 
QF_ISR_ENTRY()
 leaves the critical section established automatically by the RX 
hardware upon the entry to the interrupt. This allows calling the QP services (such as 
QF_TICK()
) 
outside the critical section.
(5) This code is conditionally compiled into the build when the macro Q_SPY is defined. When using 
QS the variable 
l_tickTime_
 keeps track of how many have elapsed so far. At the time an actual 
time-stamp is needed, the free running counter is added to this value to get a high resolution 32-bit 
time-stamp.
(6) The macro 
QF_TICK()
 is used to notify the framework about another clock tick. This allows the 
framework to perform time-event management activities. This call may result in one or more events 
being posted to active objects which had started timers. The parameter to 
QF_TICK()
 is only used 
when tracing with QSPY, otherwise it is ignored.
(7) The macro 
QF_ISR_EXIT()
 re-establishes again the critical section by restoring PSW[I] to the value 
it was upon first entering the ISR.
19 of 32










