DEV Community

gurndar
gurndar

Posted on

#4 now it blinky

Yeah
Finally
I made it blinky.
Yeah

Initially, I used this code:

  with A0B.STM32F401.SVD.GPIO; use A0B.STM32F401.SVD.GPIO;
  with A0B.STM32F401.SVD.RCC;  use A0B.STM32F401.SVD.RCC;

  procedure my_blackpill_project is
  begin
     RCC_Periph.AHB1ENR.GPIOCEN := True;
     GPIOC_Periph.MODER.Arr(13) := 2#01#;
     loop
        GPIOC_Periph.ODR.ODR.Arr (13) := False;
     end loop;
  end my_blackpill_project;
Enter fullscreen mode Exit fullscreen mode

However, it does not work.
I do not know why so I mailed it to Vadim(He is the greatest programmer for me).

And I tried this code that is on vadim's example repository for a0b-tools

 with A0B.STM32F401.GPIO;
  with A0B.STM32F401.GPIO.PIOC;

  procedure my_blackpill_project is
     LED : A0B.STM32F401.GPIO.GPIO_Line
       renames A0B.STM32F401.GPIO.PIOC.PC13;
     Value : Boolean := False;

     procedure Wait is
     begin
        for I in 1 .. 500_000 loop
           null;
        end loop;
     end Wait;

  begin
     LED.Configure_Output;
     loop
        LED.Set (Value);
        Wait;
        Value := not Value;
     end loop;
  end my_blackpill_project;
Enter fullscreen mode Exit fullscreen mode

I initially tried to control the board directly using svd libraries. But it does not work.
And then, I tried to use a0b-stm32f401-gpio library, which is a more abstract version.
Then it worked.

I felt I did a wrong environment setting. Even I worried that if I should change to C/C++.
But after seeing the blinky board, my worries are gone.
My heart of an idiot was ignited again.
Maybe I will encounter lots of obstacles to build avionics with Ada from scratch.

But I will go. And be a map for others who are as stupid as I am.

Thank you
See you later

Top comments (0)