source: rtems/cpukit/include/rtems/confdefs/percpu.h @ d582d0e

5
Last change on this file since d582d0e was d582d0e, checked in by Sebastian Huber <sebastian.huber@…>, on 04/05/20 at 07:58:24

Revert "score: Fix _ISR_Stack_area_end"

This reverts commit 8e80876bdd54e36fb668eee655eec1dd588daf13
which broke several architectures.

  • Property mode set to 100644
File size: 5.1 KB
Line 
1/* SPDX-License-Identifier: BSD-2-Clause */
2
3/**
4 * @file
5 *
6 * @ingroup RTEMSApplicationConfiguration
7 *
8 * @brief Evaluate Per-CPU Configuration Options
9 *
10 * Since the idle thread stack size (CONFIGURE_IDLE_TASK_STACK_SIZE) depends on
11 * CONFIGURE_MINIMUM_TASK_STACK_SIZE, the POSIX-specific
12 * CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE configuration option is also evaluated
13 * in this header file for simplicity.
14 *
15 * This header file defines _CONFIGURE_MAXIMUM_PROCESSORS for use by other
16 * configuration header files.
17 */
18
19/*
20 * Copyright (C) 2018, 2020 embedded brains GmbH (http://www.embedded-brains.de)
21 *
22 * Redistribution and use in source and binary forms, with or without
23 * modification, are permitted provided that the following conditions
24 * are met:
25 * 1. Redistributions of source code must retain the above copyright
26 *    notice, this list of conditions and the following disclaimer.
27 * 2. Redistributions in binary form must reproduce the above copyright
28 *    notice, this list of conditions and the following disclaimer in the
29 *    documentation and/or other materials provided with the distribution.
30 *
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
32 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
33 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
34 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
35 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
36 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
37 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
38 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
39 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
40 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGE.
42 */
43
44#ifndef _RTEMS_CONFDEFS_PERCPU_H
45#define _RTEMS_CONFDEFS_PERCPU_H
46
47#ifndef __CONFIGURATION_TEMPLATE_h
48#error "Do not include this file directly, use <rtems/confdefs.h> instead"
49#endif
50
51#ifdef CONFIGURE_INIT
52
53#include <rtems/confdefs/bsp.h>
54#include <rtems/score/context.h>
55#include <rtems/score/percpu.h>
56#include <rtems/score/smp.h>
57
58#ifdef __cplusplus
59extern "C" {
60#endif
61
62/* Ensure that _CONFIGURE_MAXIMUM_PROCESSORS > 1 only in SMP configurations */
63#if defined(CONFIGURE_MAXIMUM_PROCESSORS) && defined(RTEMS_SMP)
64  #define _CONFIGURE_MAXIMUM_PROCESSORS CONFIGURE_MAXIMUM_PROCESSORS
65#else
66  #define _CONFIGURE_MAXIMUM_PROCESSORS 1
67#endif
68
69#ifdef RTEMS_SMP
70  const uint32_t _SMP_Processor_configured_maximum =
71    _CONFIGURE_MAXIMUM_PROCESSORS;
72
73  Per_CPU_Control_envelope
74    _Per_CPU_Information[ _CONFIGURE_MAXIMUM_PROCESSORS ];
75#endif
76
77/* Interrupt stack configuration */
78
79#ifndef CONFIGURE_INTERRUPT_STACK_SIZE
80  #ifdef BSP_INTERRUPT_STACK_SIZE
81    #define CONFIGURE_INTERRUPT_STACK_SIZE BSP_INTERRUPT_STACK_SIZE
82  #else
83    #define CONFIGURE_INTERRUPT_STACK_SIZE CPU_STACK_MINIMUM_SIZE
84  #endif
85#endif
86
87#if CONFIGURE_INTERRUPT_STACK_SIZE % CPU_INTERRUPT_STACK_ALIGNMENT != 0
88  #error "CONFIGURE_INTERRUPT_STACK_SIZE fails to meet the CPU port interrupt stack alignment"
89#endif
90
91RTEMS_DEFINE_GLOBAL_SYMBOL(
92  _ISR_Stack_size,
93  CONFIGURE_INTERRUPT_STACK_SIZE
94);
95
96char _ISR_Stack_area_begin[
97  _CONFIGURE_MAXIMUM_PROCESSORS * CONFIGURE_INTERRUPT_STACK_SIZE
98] RTEMS_ALIGNED( CPU_INTERRUPT_STACK_ALIGNMENT )
99RTEMS_SECTION( ".rtemsstack.interrupt.begin" );
100
101RTEMS_DEFINE_GLOBAL_SYMBOL_IN_SECTION(
102  _ISR_Stack_area_end,
103  ".rtemsstack.interrupt.end"
104);
105
106/* Thread stack size configuration */
107
108#ifndef CONFIGURE_MINIMUM_TASK_STACK_SIZE
109  #define CONFIGURE_MINIMUM_TASK_STACK_SIZE CPU_STACK_MINIMUM_SIZE
110#endif
111
112#ifndef CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE
113  #define CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE \
114    ( 2 * CONFIGURE_MINIMUM_TASK_STACK_SIZE )
115#endif
116
117/* Idle thread configuration */
118
119#ifndef CONFIGURE_IDLE_TASK_STACK_SIZE
120  #ifdef BSP_IDLE_TASK_STACK_SIZE
121    #define CONFIGURE_IDLE_TASK_STACK_SIZE BSP_IDLE_TASK_STACK_SIZE
122  #else
123    #define CONFIGURE_IDLE_TASK_STACK_SIZE CONFIGURE_MINIMUM_TASK_STACK_SIZE
124  #endif
125#endif
126
127#if CONFIGURE_IDLE_TASK_STACK_SIZE < CONFIGURE_MINIMUM_TASK_STACK_SIZE
128  #error "CONFIGURE_IDLE_TASK_STACK_SIZE less than CONFIGURE_MINIMUM_TASK_STACK_SIZE"
129#endif
130
131const size_t _Thread_Idle_stack_size = CONFIGURE_IDLE_TASK_STACK_SIZE;
132
133char _Thread_Idle_stacks[
134  _CONFIGURE_MAXIMUM_PROCESSORS
135    * ( CONFIGURE_IDLE_TASK_STACK_SIZE + CPU_IDLE_TASK_IS_FP * CONTEXT_FP_SIZE )
136] RTEMS_ALIGNED( CPU_INTERRUPT_STACK_ALIGNMENT )
137RTEMS_SECTION( ".rtemsstack.idle" );
138
139#if defined(CONFIGURE_IDLE_TASK_INITIALIZES_APPLICATION) && \
140  !defined(CONFIGURE_IDLE_TASK_BODY)
141  #error "If you define CONFIGURE_IDLE_TASK_INITIALIZES_APPLICATION, then you must define CONFIGURE_IDLE_TASK_BODY as well"
142#endif
143
144#if !defined(CONFIGURE_IDLE_TASK_BODY) && defined(BSP_IDLE_TASK_BODY)
145  #define CONFIGURE_IDLE_TASK_BODY BSP_IDLE_TASK_BODY
146#endif
147
148#ifdef CONFIGURE_IDLE_TASK_BODY
149  const Thread_Idle_body _Thread_Idle_body = CONFIGURE_IDLE_TASK_BODY;
150#endif
151
152#ifdef __cplusplus
153}
154#endif
155
156#endif /* CONFIGURE_INIT */
157
158#endif /* _RTEMS_CONFDEFS_PERCPU_H */
Note: See TracBrowser for help on using the repository browser.