
QDK™
R8C/Tau-NC30
www.state-machine.com/m16c
5.2.2 Specifying Stack and Heap Sizes
This QDK-M16C/R8C does not use the heap
1
uses only the Interrupt Stack and no User Stack.
Therefore, you disable the heap and set the User Stack size to zero. You need to declare adequate
stack size for the Interrupt Stack, which is the only stack used in this QDK-nano. In the C-startup
code, you specify the heap and stack sizes in the file
cstartdef.h
:
/* Modify the next line if you change the stack size */
#define __STACKSIZE__ 0x0
/* Modify the next line if you change the interrupt stack size */
#define __ISTACKSIZE__ 0x80
/* Modify the next line if you change the heap size */
#define __HEAPSIZE__ 0x0
/* Modify the next line if you change the standard I/O */
#define __STANDARD_IO__ 0
NOTE: The QK preemptive kernel generally requires more stack space than the cooperative
“Vanilla” kernel. You need to adjust the
__ISTACKSIZE__
value for your system.
5.3 The BSP header file bsp.h
(1) #include "sfr_r825.h"
(2) #include "taudef.h" /* RSK-R8C25 board */
/*--------------------------------------------------------------------------*/
(3) #define BSP_TICKS_PER_SEC 50
/*..........................................................................*/
void BSP_init(void);
void BSP_displyPhilStat(uint8_t n, char const *stat);
Listing 9 The bsp.h for the PELICAN crossing example.
(1) The header file “
sfr_r825.h
” provides the definitions of the R8C/25 special function registers.
(2) The header file “
taudef.h
” defines the interface to the TAU board.
(3) The BSP defines the desired ticking rate. This constant is useful for defining timeouts, which are
always specified in units of clock ticks.
5.4 BSP initialization
The following
BSP_init()
function from the PELICAN crossing application for the TAU board config-
ures the PIO lines for the User LEDs, the system clock tick, and the QS output:
void BSP_init(void) {
/* initialize the CPU clock... */
prcr = 1; /* protect off */
1
Using the heap in real-time embedded devices can cause many problems, such as heap fragmentation, non-
determinism, concurrency issues, etc.
Copyright © Quantum Leaps, LLC. All Rights Reserved.
19 of 26
Comentarios a estos manuales