File : s-bbpara-stm32f4.ads


   1 ------------------------------------------------------------------------------
   2 --                                                                          --
   3 --                  GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS                --
   4 --                                                                          --
   5 --                   S Y S T E M . B B . P A R A M E T E R S                --
   6 --                                                                          --
   7 --                                  S p e c                                 --
   8 --                                                                          --
   9 --        Copyright (C) 1999-2002 Universidad Politecnica de Madrid         --
  10 --             Copyright (C) 2003-2005 The European Space Agency            --
  11 --                     Copyright (C) 2003-2016, AdaCore                     --
  12 --                                                                          --
  13 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
  14 -- terms of the  GNU General Public License as published  by the Free Soft- --
  15 -- ware  Foundation;  either version 3,  or (at your option) any later ver- --
  16 -- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
  17 -- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
  18 -- or FITNESS FOR A PARTICULAR PURPOSE.                                     --
  19 --                                                                          --
  20 --                                                                          --
  21 --                                                                          --
  22 --                                                                          --
  23 --                                                                          --
  24 -- You should have received a copy of the GNU General Public License and    --
  25 -- a copy of the GCC Runtime Library Exception along with this program;     --
  26 -- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
  27 -- <http://www.gnu.org/licenses/>.                                          --
  28 --                                                                          --
  29 -- GNAT was originally developed  by the GNAT team at  New York University. --
  30 -- Extensive contributions were provided by Ada Core Technologies Inc.      --
  31 --                                                                          --
  32 -- The port of GNARL to bare board targets was initially developed by the   --
  33 -- Real-Time Systems Group at the Technical University of Madrid.           --
  34 --                                                                          --
  35 ------------------------------------------------------------------------------
  36 
  37 --  This package defines basic parameters used by the low level tasking system
  38 
  39 --  This is the STM32F40x (ARMv7) version of this package
  40 
  41 pragma Restrictions (No_Elaboration_Code);
  42 
  43 with Interfaces.STM32.RCC;
  44 with System.STM32;
  45 with System.BB.Board_Parameters;
  46 with System.BB.MCU_Parameters;
  47 
  48 package System.BB.Parameters is
  49    pragma Preelaborate (System.BB.Parameters);
  50 
  51    Clock_Frequency : constant := Board_Parameters.Clock_Frequency;
  52    pragma Assert (Clock_Frequency in System.STM32.SYSCLK_Range);
  53    Ticks_Per_Second : constant := Clock_Frequency;
  54 
  55    --  Set the requested SYSCLK frequency. Setup_Pll will try to set configure
  56    --  PLL to match this value when possible or reset the board.
  57 
  58    ----------------
  59    -- Prescalers --
  60    ----------------
  61 
  62    AHB_PRE  : constant System.STM32.AHB_Prescaler := System.STM32.AHBPRE_DIV1;
  63    APB1_PRE : constant System.STM32.APB_Prescaler :=
  64                 (Enabled => True, Value => System.STM32.DIV4);
  65    APB2_PRE : constant System.STM32.APB_Prescaler :=
  66                 (Enabled => True, Value => System.STM32.DIV2);
  67 
  68    --------------------
  69    -- External Clock --
  70    --------------------
  71 
  72    --  The external clock can be specific for each board. We provide here
  73    --  a value for the most common STM32 boards.
  74    --  Change the value based on the external clock used on your specific
  75    --  hardware.
  76 
  77    HSE_Clock : constant := Board_Parameters.HSE_Clock_Frequency;
  78 
  79    HSI_Clock : constant := 16_000_000;
  80 
  81    Has_FPU : constant Boolean := True;
  82    --  Set to true if core has a FPU
  83 
  84    ----------------
  85    -- Interrupts --
  86    ----------------
  87 
  88    --  These definitions are in this package in order to isolate target
  89    --  dependencies.
  90 
  91    Number_Of_Interrupt_ID : constant := MCU_Parameters.Number_Of_Interrupts;
  92    --  Number of interrupts (for both the interrupt controller and the
  93    --  Sys_Tick_Trap). This static constant is used to declare a type, and
  94    --  the handler table.
  95 
  96    Trap_Vectors : constant := 17;
  97    --  While on this target there is little difference between interrupts
  98    --  and traps, we consider the following traps:
  99    --
 100    --    Name                        Nr
 101    --
 102    --    Reset_Vector                 1
 103    --    NMI_Vector                   2
 104    --    Hard_Fault_Vector            3
 105    --    Mem_Manage_Vector            4
 106    --    Bus_Fault_Vector             5
 107    --    Usage_Fault_Vector           6
 108    --    SVC_Vector                  11
 109    --    Debug_Mon_Vector            12
 110    --    Pend_SV_Vector              14
 111    --    Sys_Tick_Vector             15
 112    --    Interrupt_Request_Vector    16
 113    --
 114    --  These trap vectors correspond to different low-level trap handlers in
 115    --  the run time. Note that as all interrupt requests (IRQs) will use the
 116    --  same interrupt wrapper, there is no benefit to consider using separate
 117    --  vectors for each.
 118 
 119    Context_Buffer_Capacity : constant := 10;
 120    --  The context buffer contains registers r4 .. r11 and the SP_process
 121    --  (PSP). The size is rounded up to an even number for alignment
 122 
 123    ------------
 124    -- Stacks --
 125    ------------
 126 
 127    Interrupt_Stack_Size : constant := 2 * 1024;
 128    --  Size of each of the interrupt stacks in bytes. While there nominally is
 129    --  an interrupt stack per interrupt priority, the entire space is used as a
 130    --  single stack.
 131 
 132    Interrupt_Sec_Stack_Size : constant := 128;
 133    --  Size of the secondary stack for interrupt handlers
 134 
 135    ----------
 136    -- CPUS --
 137    ----------
 138 
 139    Max_Number_Of_CPUs : constant := 1;
 140    --  Maximum number of CPUs
 141 
 142    Multiprocessor : constant Boolean := Max_Number_Of_CPUs /= 1;
 143    --  Are we on a multiprocessor board?
 144 
 145 end System.BB.Parameters;