Makefile-based build of examples. Finally, share common body file.
This commit is contained in:
parent
a587b7a512
commit
68fe374be0
|
@ -1,11 +1,14 @@
|
|||
with STM32.RCC; use STM32.RCC;
|
||||
with STM32.GPIO; use STM32.GPIO;
|
||||
with Chip.Units; use Chip.Units;
|
||||
|
||||
package Board is
|
||||
pragma Preelaborate;
|
||||
|
||||
LED_Port: GPIO_Registers renames GPIOD;
|
||||
LED_Bit: constant Port_Bit_Number := 3;
|
||||
LED_On: constant Boolean := False;
|
||||
LED_Port : GPIO_Registers renames GPIOD;
|
||||
LED_Bit : constant Port_Bit_Number := 3;
|
||||
LED_On : constant Boolean := False;
|
||||
|
||||
LED_RCC_EN : Boolean renames RCC.AHB1ENR(Index.GPIOD);
|
||||
|
||||
end Board;
|
|
@ -1,12 +1,15 @@
|
|||
with STM32.RCC; use STM32.RCC;
|
||||
with STM32.GPIO; use STM32.GPIO;
|
||||
with STM32.USART; use STM32.USART;
|
||||
with Chip.Units; use Chip.Units;
|
||||
package Board is
|
||||
pragma Preelaborate;
|
||||
|
||||
LED_Port: GPIO_Registers renames GPIOG;
|
||||
LED_Bit: constant Port_Bit_Number := 13;
|
||||
LED_On: constant Boolean := True;
|
||||
LED_Port : GPIO_Registers renames GPIOG;
|
||||
LED_Bit : constant Port_Bit_Number := 13;
|
||||
LED_On : constant Boolean := True;
|
||||
|
||||
LED_RCC_EN : Boolean renames RCC.AHB1ENR(Index.GPIOG);
|
||||
|
||||
UART_Port: GPIO_Registers renames GPIOA;
|
||||
UART_TX_Bit: constant Port_Bit_Number := 9;
|
||||
|
|
|
@ -1,15 +1,20 @@
|
|||
PROJECTS = led_flasher led_flasher_429disco
|
||||
BOARDS = 407z_piswords 429disco
|
||||
|
||||
all:
|
||||
echo $(BOARDS:%=flash_led_flasher_%)
|
||||
|
||||
$(PROJECTS:%=flash_%):flash_%:objects/%.bin
|
||||
|
||||
$(BOARDS:%=flash_led_flasher_%):flash_led_flasher_%:objects/%/led_flasher.bin
|
||||
st-flash --reset write $< 0x8000000
|
||||
|
||||
objects/%:%
|
||||
$(BOARDS:%=objects/%/led_flasher):objects/%/led_flasher:led_flasher_%
|
||||
gprbuild $<.gpr
|
||||
|
||||
%.bin:%
|
||||
$(BOARDS:%=objects/%/led_flasher.bin):objects/%/led_flasher.bin:objects/%/led_flasher
|
||||
arm-eabi-objcopy -O binary $< $@
|
||||
|
||||
.PHONY: $(PROJECTS:%=flash_%)
|
||||
.PHONY: $(BOARDS:%=flash_led_flasher_%)
|
||||
|
||||
$(BOARDS:%=led_flasher_%):.FORCE
|
||||
|
||||
.PHONY: .FORCE
|
|
@ -1,7 +1,7 @@
|
|||
with Board; use Board;
|
||||
|
||||
with STM32.RCC; use STM32.RCC;
|
||||
with STM32.F429.Units; use STM32.F429.Units;
|
||||
with Chip.Units; use Chip.Units;
|
||||
with STM32.GPIO; use STM32.GPIO;
|
||||
with STM32.GPIO.Ports; use STM32.GPIO.Ports;
|
||||
with Ada.Real_Time; use Ada.Real_Time;
|
||||
|
@ -12,7 +12,8 @@ procedure LED_Flasher is
|
|||
Now: Time := Clock;
|
||||
package LED is new GPIO_Port_Boolean(LED_Port, LED_Bit);
|
||||
begin
|
||||
RCC.AHB1ENR(Index.GPIOD) := True;
|
||||
LED_RCC_EN := True;
|
||||
|
||||
LED_Port.MODER(LED_Bit) := Output_Mode;
|
||||
LED_Port.OTYPER(LED_Bit) := Push_Pull_Type;
|
||||
LED_Port.OSPEEDR(LED_Bit) := Very_High_Speed;
|
||||
|
|
|
@ -3,7 +3,7 @@ with "../../stm32f4_library.gpr";
|
|||
project LED_Flasher is
|
||||
for Languages use("Ada");
|
||||
for Main use("led_flasher.adb");
|
||||
for Object_Dir use "objects";
|
||||
for Object_Dir use "objects/407z_piswords";
|
||||
for Target use "arm-eabi";
|
||||
for Runtime("Ada") use "ravenscar-sfp-stm32f4";
|
||||
for Source_Dirs use(".", "../common/407z-piswords");
|
|
@ -1,28 +0,0 @@
|
|||
with Board; use Board;
|
||||
|
||||
with STM32.RCC; use STM32.RCC;
|
||||
with Chip.Units; use Chip.Units;
|
||||
with STM32.GPIO; use STM32.GPIO;
|
||||
with STM32.GPIO.Ports; use STM32.GPIO.Ports;
|
||||
with Ada.Real_Time; use Ada.Real_Time;
|
||||
|
||||
procedure LED_Flasher_429disco is
|
||||
Period: constant Time_Span := Milliseconds(250);
|
||||
On_Time: constant Time_Span := Milliseconds(10);
|
||||
Now: Time := Clock;
|
||||
package LED is new GPIO_Port_Boolean(LED_Port, LED_Bit);
|
||||
begin
|
||||
RCC.AHB1ENR(Index.GPIOG) := True;
|
||||
LED_Port.MODER(LED_Bit) := Output_Mode;
|
||||
LED_Port.OTYPER(LED_Bit) := Push_Pull_Type;
|
||||
LED_Port.OSPEEDR(LED_Bit) := Very_High_Speed;
|
||||
LED_Port.PUPDR(LED_Bit) := No_Pull;
|
||||
loop
|
||||
LED.Set(LED_On);
|
||||
delay until Now + On_Time;
|
||||
LED.Set(not LED_On);
|
||||
Now := Now + Period;
|
||||
delay until Now;
|
||||
end loop;
|
||||
end Led_Flasher_429disco;
|
||||
|
|
@ -2,8 +2,8 @@ with "../../stm32f4_library.gpr";
|
|||
|
||||
project LED_Flasher_429disco is
|
||||
for Languages use("Ada");
|
||||
for Main use("led_flasher_429disco.adb");
|
||||
for Object_Dir use "objects";
|
||||
for Main use("led_flasher.adb");
|
||||
for Object_Dir use "objects/429disco";
|
||||
for Target use "arm-eabi";
|
||||
for Runtime("Ada") use "ravenscar-sfp-stm32f429disco";
|
||||
for Source_Dirs use(".", "../common/429disco");
|
||||
|
|
Loading…
Reference in a new issue