Change the project architecture to emphasis both on device and board levels

The current approach only defines boards (inside a single project). This
patches adds devices projects that will help custom board definition
(e.g. Crazyflie or Embrick).

A project for Cortex-M packages is also added.

The component directory is moved at the root of the repository, since
component could be share across architecture, in particular those
connected on serial buses (SPI, I2C, UART, etc.).

Signed-off-by: Fabien Chouteau <chouteau@adacore.com>
This commit is contained in:
Fabien Chouteau 2016-02-10 21:13:01 +01:00
parent 5ed2b2f64c
commit b4c2077f51
59 changed files with 215 additions and 198 deletions

View File

@ -0,0 +1,12 @@
These projects represent general MCU devices, such as a platform based on an
STM32F405.
Use one of these project if that is the kind of hardware your target is based
upon. For example, the Crazyflie 2.0 uses an STM32F405, so project
stm32f40x.gpr would be appropriate.
Note that if you are using one of the `*_Discovery` boards, there are projects
available in the boards directory are the root of this repository. The
corresponding project would be appropriate since it includes the additional
hardware specific to the board. With that approach the additional hardware
specific to that board will available, such as the user buttons and LEDs.

View File

@ -1,15 +0,0 @@
These packages represent specific implementations, "boards" such as the
`*_Discovery` kit boards.
They include the peripheral declarations for their specific MCU device, such as
the GPIO ports and timers on the F405 or F429, as well as declarations specific
to that board, such as the LEDs.
Use one of these packages if that is the specific target you are using.
Alternatively, if you have some platform that is based on a given MCU device but
is not a specific board (e.g., not one of the `*_Discovery` boards), use the
corresponding MCU device package instead. For example, the Crazyflie 2.0 uses
an STM32F405, so package STM32F40xxx would be appropriate. With that approach
the hardware that the `*_Discovery` boards include will not be available, such
as the user buttons.

View File

@ -1,12 +0,0 @@
These packages represent general MCU devices, such as a platform based on an
STM32F405.
Use one of these packages if that is the kind of hardware your target is based
upon. For example, the Crazyflie 2.0 uses an STM32F405, so package STM32F40xxx
would be appropriate.
Note that if you are using one of the `*_Discovery` boards, using the
corresponding package would be appropriate since those packages include the
additional hardware specific to those boards. With that approach the additional
hardware specific to that board will available, such as the user buttons and
LEDs.

View File

@ -1,167 +0,0 @@
project STM32 is
type LOADER_Type is
("RAM", "ROM");
LOADER : LOADER_Type := external ("LOADER", "ROM");
type Board_Type is ("STM32F4-DISCO",
"STM32F429-DISCO",
"STM32F469-DISCO",
"STM32F7-DISCO");
Board : Board_Type := external ("BOARD", "STM32F429-DISCO");
type RTS_Profile_Type is ("ravenscar-sfp", "ravenscar-full");
RTS : RTS_Profile_Type := external ("RTS", "ravenscar-sfp");
type LCH_Type is ("led", "lcd");
LCH : LCH_Type := external ("LCH", "lcd");
type Build_Type is ("Production", "Debug");
Build : Build_Type := external ("BUILD", "Production");
for Source_Dirs use
("cortex_m",
"drivers",
"utils");
for Object_Dir use "obj/" & Board & "/" & RTS;
for Library_Name use "stm32";
for Library_Dir use "lib/" & Board & "/" & RTS;
for Target use "arm-eabi";
package Builder is
case Build is
when "Production" =>
for Default_Switches ("Ada") use ("-O3");
when "Debug" =>
for Default_Switches ("Ada") use ("-g", "-O0");
end case;
end Builder;
case Board is
when "STM32F4-DISCO" =>
for Runtime ("Ada") use RTS & "-stm32f4";
for Source_Dirs use Project'Source_Dirs &
("svd/stm32f40x",
"boards/stm32f4_discovery",
"devices/stm32f40x",
"drivers/i2c_stm32f4",
"drivers/uart_stm32f4",
"components/gyro/lis3dsh");
case RTS is
when "ravenscar-sfp" =>
for Source_Dirs use Project'Source_Dirs &
("utils/lch_sfp",
"utils/lch_sfp/led");
when "ravenscar-full" =>
for Source_Dirs use Project'Source_Dirs &
("utils/lch_full",
"utils/lch_full/led");
end case;
when "STM32F429-DISCO" =>
for Runtime ("Ada") use RTS & "-stm32f429disco";
for Source_Dirs use Project'Source_Dirs &
("svd/stm32f429x",
"boards/stm32f429_discovery",
"devices/stm32f42x",
"drivers/fmc",
"drivers/dma2d",
"drivers/i2c_stm32f4",
"drivers/uart_stm32f4",
"drivers/ltdc",
"components/button",
"components/sdram",
"components/lcd/ili9341",
"components/touch_panel",
"components/touch_panel/stmpe811",
"components/gyro/l3gd20",
"utils/gui");
case RTS is
when "ravenscar-sfp" =>
for Source_Dirs use Project'Source_Dirs &
("utils/lch_sfp",
"utils/lch_sfp/" & LCH);
when "ravenscar-full" =>
for Source_Dirs use Project'Source_Dirs &
("utils/lch_full",
"utils/lch_full/" & LCH);
end case;
when "STM32F469-DISCO" =>
for Runtime ("Ada") use RTS & "-stm32f469disco";
for Source_Dirs use Project'Source_Dirs &
("svd/stm32f46_79x",
"boards/stm32f469_discovery",
"devices/stm32f46_79x",
"drivers/fmc",
"drivers/dma2d",
"drivers/i2c_stm32f4",
"drivers/uart_stm32f4",
"drivers/dsi",
"drivers/ltdc",
"components/button",
"components/sdram",
"components/lcd/otm8009a",
"components/touch_panel",
"components/touch_panel/ft6x06",
"utils/gui");
case RTS is
when "ravenscar-sfp" =>
for Source_Dirs use Project'Source_Dirs &
("utils/lch_sfp",
"utils/lch_sfp/" & LCH);
when "ravenscar-full" =>
for Source_Dirs use Project'Source_Dirs &
("utils/lch_full",
"utils/lch_full/" & LCH);
end case;
when "STM32F7-DISCO" =>
for Runtime ("Ada") use RTS & "-stm32f7disco";
for Source_Dirs use Project'Source_Dirs &
("svd/stm32f7x",
"boards/stm32f7_discovery",
"devices/stm32f7x",
"drivers/i2c_stm32f7",
"drivers/fmc",
"drivers/dma2d",
"drivers/ltdc",
"components/button",
"components/sdram",
"components/lcd/rortech_stm32f7disco",
"components/touch_panel",
"components/touch_panel/ft5336",
"components/eth",
"utils/gui");
case RTS is
when "ravenscar-sfp" =>
for Source_Dirs use Project'Source_Dirs &
("utils/lch_sfp",
"utils/lch_sfp/" & LCH);
when "ravenscar-full" =>
for Source_Dirs use Project'Source_Dirs &
("utils/lch_full",
"utils/lch_full/" & LCH);
end case;
end case;
package Compiler is
case Build is
when "Production" =>
for Default_Switches ("Ada") use ("-O3");
when "Debug" =>
for Default_Switches ("Ada") use ("-g", "-O0");
end case;
for Default_Switches ("ada") use Compiler'Default_Switches ("Ada") &
("-gnatwa", "-gnatQ", "-gnatw.X");
end Compiler;
package Ide is
for Gnat use "arm-eabi-gnat";
for Gnatlist use "arm-eabi-gnatls";
for Debugger_Command use "arm-eabi-gdb";
for Program_Host use "localhost:4242";
for Communication_Protocol use "remote";
end Ide;
end STM32;

View File

@ -0,0 +1,10 @@
project STM32F40x extends "../../cortex_m/cortex_m.gpr" is
for Source_Dirs use Project'Source_Dirs &
("drivers",
"svd/stm32f40x",
"devices/stm32f40x",
"drivers/i2c_stm32f4",
"drivers/uart_stm32f4");
end STM32F40x;

View File

@ -0,0 +1,13 @@
project STM32F42x extends "../../cortex_m/cortex_m.gpr" is
for Source_Dirs use Project'Source_Dirs &
("drivers",
"svd/stm32f429x",
"devices/stm32f42x",
"drivers/fmc",
"drivers/dma2d",
"drivers/i2c_stm32f4",
"drivers/uart_stm32f4",
"drivers/ltdc");
end STM32F42x;

View File

@ -0,0 +1,14 @@
project STM32F46_79x extends "../../cortex_m/cortex_m.gpr" is
for Source_Dirs use Project'Source_Dirs &
("drivers",
"svd/stm32f46_79x",
"devices/stm32f46_79x",
"drivers/fmc",
"drivers/dma2d",
"drivers/i2c_stm32f4",
"drivers/uart_stm32f4",
"drivers/dsi",
"drivers/ltdc");
end STM32F46_79x;

View File

@ -0,0 +1,12 @@
project STM32F7x extends "../../cortex_m/cortex_m.gpr" is
for Source_Dirs use Project'Source_Dirs &
("drivers",
"svd/stm32f7x",
"devices/stm32f7x",
"drivers/i2c_stm32f7",
"drivers/fmc",
"drivers/dma2d",
"drivers/ltdc");
end STM32F7x;

View File

@ -30,8 +30,9 @@
------------------------------------------------------------------------------
with System.Machine_Code; use System.Machine_Code;
with System; use System;
package body STM32.FPU is
package body Cortex_M.FPU is
use ASCII;
@ -64,4 +65,4 @@ package body STM32.FPU is
return Result;
end FPSCR;
end STM32.FPU;
end Cortex_M.FPU;

View File

@ -44,7 +44,7 @@
-- May 2014 DocID022708 Rev 4, file "DM00046982.pdf"
-- especially section 4.6.4
package STM32.FPU is
package Cortex_M.FPU is
function Sqrt (X : Float) return Float;
@ -54,6 +54,10 @@ package STM32.FPU is
To_Minus_Infinity,
To_Zero);
type Bits_1 is mod 2**1 with Size => 1;
type Bits_2 is mod 2**2 with Size => 2;
type Bits_6 is mod 2**6 with Size => 6;
type Status_Control_Register is record
-- negative condition flag
N : Boolean;
@ -114,4 +118,4 @@ package STM32.FPU is
function FPSCR return Status_Control_Register;
end STM32.FPU;
end Cortex_M.FPU;

View File

@ -0,0 +1,3 @@
project Cortex_M is
for Source_Dirs use (".");
end Cortex_M;

15
boards/README.md Normal file
View File

@ -0,0 +1,15 @@
These projects represent specific implementations, "boards" such as the
`*_Discovery` kit boards.
They include the peripheral declarations for their specific MCU device, such as
the GPIO ports and timers on the F405 or F429, as well as declarations specific
to that board, such as the LEDs.
Use one of these project if that is the specific target you are using.
Alternatively, if you have some platform that is based on a given MCU device
but is not a specific board (e.g., not one of the `*_Discovery` boards), use
the corresponding MCU device project instead. For example, the Crazyflie 2.0
uses an STM32F405, so project stm32f40x.gpr would be appropriate. With that
approach the hardware that the `*_Discovery` boards include will not be
available, such as the user buttons.

View File

@ -0,0 +1,34 @@
project STM32F429_Discovery extends "../../ARM/STMicro/STM32/stm32f42x.gpr" is
type RTS_Profile_Type is ("ravenscar-sfp", "ravenscar-full");
RTS : RTS_Profile_Type := external ("RTS", "ravenscar-sfp");
for Object_Dir use "obj/";
for Runtime ("Ada") use RTS & "-stm32f429disco";
for Source_Dirs use Project'Source_Dirs &
("src",
"../../components/button",
"../../components/sdram",
"../../components/lcd/otm8009a",
"../../components/touch_panel",
"../../components/touch_panel/ft6x06",
"../../components/gyro/l3gd20",
"../../ARM/STMicro/STM32/utils//gui");
type LCH_Type is ("led", "lcd");
LCH : LCH_Type := external ("LCH", "lcd");
case RTS is
when "ravenscar-sfp" =>
for Source_Dirs use Project'Source_Dirs &
("../../ARM/STMicro/STM32/utils/lch_sfp",
"../../ARM/STMicro/STM32/utils/lch_sfp/led");
when "ravenscar-full" =>
for Source_Dirs use Project'Source_Dirs &
("../../ARM/STMicro/STM32/utils/lch_full",
"../../ARM/STMicro/STM32/utils/lch_full/led");
end case;
end STM32F429_Discovery;

View File

@ -0,0 +1,32 @@
project STM32F469_Discovery extends "../../ARM/STMicro/STM32/stm32f46_79x.gpr" is
type RTS_Profile_Type is ("ravenscar-sfp", "ravenscar-full");
RTS : RTS_Profile_Type := external ("RTS", "ravenscar-sfp");
for Object_Dir use "obj/";
for Target use "arm-eabi";
for Runtime ("Ada") use RTS & "-stm32f469disco";
for Source_Dirs use Project'Source_Dirs &
("src/",
"../../components/button",
"../../components/sdram",
"../../components/lcd/otm8009a",
"../../components/touch_panel",
"../../components/touch_panel/ft6x06",
"../../ARM/STMicro/STM32/utils/gui");
type LCH_Type is ("led", "lcd");
LCH : LCH_Type := external ("LCH", "lcd");
case RTS is
when "ravenscar-sfp" =>
for Source_Dirs use Project'Source_Dirs &
("../../ARM/STMicro/STM32/utils/lch_sfp",
"../../ARM/STMicro/STM32/utils/lch_sfp/led");
when "ravenscar-full" =>
for Source_Dirs use Project'Source_Dirs &
("../../ARM/STMicro/STM32/utils/lch_full",
"../../ARM/STMicro/STM32/utils/lch_full/led");
end case;
end STM32F469_Discovery;

View File

@ -0,0 +1,28 @@
project STM32F4_Discovery extends "../../ARM/STMicro/STM32/stm32f40x.gpr" is
type RTS_Profile_Type is ("ravenscar-sfp", "ravenscar-full");
RTS : RTS_Profile_Type := external ("RTS", "ravenscar-sfp");
for Object_Dir use "obj/";
for Target use "arm-eabi";
for Runtime ("Ada") use RTS & "-stm32f4";
for Source_Dirs use Project'Source_Dirs &
("src/",
"../../components/gyro/lis3dsh",
"../../ARM/STMicro/STM32/utils/gui");
type LCH_Type is ("led", "lcd");
LCH : LCH_Type := external ("LCH", "lcd");
case RTS is
when "ravenscar-sfp" =>
for Source_Dirs use Project'Source_Dirs &
("../../ARM/STMicro/STM32/utils/lch_sfp",
"../../ARM/STMicro/STM32/utils/lch_sfp/led");
when "ravenscar-full" =>
for Source_Dirs use Project'Source_Dirs &
("../../ARM/STMicro/STM32/utils/lch_full",
"../../ARM/STMicro/STM32/utils/lch_full/led");
end case;
end STM32F4_Discovery;

View File

@ -0,0 +1,33 @@
project STM32F7_Discovery extends "../../ARM/STMicro/STM32/stm32f7x.gpr" is
type RTS_Profile_Type is ("ravenscar-sfp", "ravenscar-full");
RTS : RTS_Profile_Type := external ("RTS", "ravenscar-sfp");
for Object_Dir use "obj/";
for Target use "arm-eabi";
for Runtime ("Ada") use RTS & "-stm32f7disco";
for Source_Dirs use Project'Source_Dirs &
("src/",
"../../components/button",
"../../components/sdram",
"../../components/lcd/rortech_stm32f7disco",
"../../components/touch_panel",
"../../components/touch_panel/ft5336",
"../../components/eth",
"../../ARM/STMicro/STM32/utils/gui");
type LCH_Type is ("led", "lcd");
LCH : LCH_Type := external ("LCH", "lcd");
case RTS is
when "ravenscar-sfp" =>
for Source_Dirs use Project'Source_Dirs &
("../../ARM/STMicro/STM32/utils/lch_sfp",
"../../ARM/STMicro/STM32/utils/lch_sfp/led");
when "ravenscar-full" =>
for Source_Dirs use Project'Source_Dirs &
("../../ARM/STMicro/STM32/utils/lch_full",
"../../ARM/STMicro/STM32/utils/lch_full/led");
end case;
end STM32F7_Discovery;