Reading view
Seer - a new gui frontend to gdb/mi (Updated v2.0)
Ported to Qt6. Still compiles with Qt5.
[link] [comments]
usb_embedded + RP2040
Hello! I am considering using Ada for my bachelor's thesis since I've had nice experiences before (I've moved to GNAT Studio and everything is alright now).
Specifically, I am implementing a Forth interpreter, which means I (obviously) need to get data from the user and you can guess by the title I am doing that over USB.
https://pico-doc.synack.me/#usb_device_controller points me to the usb_embedded crate and its usb-echo example... the problem is that I can't make it to show anything other than the string I entered as per the example (or see anything in picocom or minicom). I am using Picoprobe + OpenOCD (external, I couldn't figure out how to make it also take -f interface/cmsis-dap.cfg
) + gdb from inside GNAT Studio, if that helps.
To cite the example (with the only changes being formatting and the USB stack details:
``` with RP.Device; with RP.Clock; with Pico;
with USB.Device.Serial; with USB.Device; with USB; with HAL; use HAL;
procedure Hello_Pico is Fatal_Error : exception; Max_Packet_Size : constant := 64;
USB_Stack : USB.Device.USB_Device_Stack (Max_Classes => 1); USB_Serial : aliased USB.Device.Serial.Default_Serial_Class (TX_Buffer_Size => Max_Packet_Size, RX_Buffer_Size => Max_Packet_Size);
use type USB.Device.Init_Result; Status : USB.Device.Init_Result;
Message : String (1 .. Max_Packet_Size); Length : HAL.UInt32; begin RP.Clock.Initialize (Pico.XOSC_Frequency);
if not USB_Stack.Register_Class (USB_Serial'Unchecked_Access) then raise Fatal_Error with "Failed to register USB Serial device class"; end if;
Status := USB_Stack.Initialize (Controller => RP.Device.UDC'Access, Manufacturer => USB.To_USB_String ("Something"), Product => USB.To_USB_String ("Here"), Serial_Number => USB.To_USB_String ("1337"), Max_Packet_Size => Max_Packet_Size);
if Status /= USB.Device.Ok then raise Fatal_Error with "USB stack initialization failed: " & Status'Image; end if;
USB_Stack.Start;
loop USB_Stack.Poll;
if USB_Serial.List_Ctrl_State.DTE_Is_Present then USB_Serial.Read (Message, Length); if Length > 0 then USB_Serial.Write (RP.Device.UDC, Message (1 .. Natural (Length)), Length); end if; end if;
end loop; end Hello_Pico; ```
I understand the logic behind this, however I don't get where I should do USB_Serial.Write(RP.Device.UDC, "> ", Length);
. Nothing is displayed if I add it before the loop, inside it on either part of the USB_Stack.Poll;
line OR in either of the if
s. I really feel like I am missing one key part.
Additionally, every (and I mean every) embedded project of any kind on Ada (at least on GitHub, although my Google-fu and DDG-fu showed no results either) has everything BUT an USB example. I would really, really like to avoid C and not give up on this beautiful language, so can someone help me? I really feel like I'm not seeing something so obvious.
Thank you and have a beautiful [insert time of day]!
[link] [comments]
June 2023 What Are You Working On?
Welcome to the monthly r/ada What Are You Working On? post.
Share here what you've worked on during the last month. Anything goes: concepts, change logs, articles, videos, code, commercial products, etc, so long as it's related to Ada. From snippets to theses, from text to video, feel free to let us know what you've done or have ongoing.
Please stay on topic of course--items not related to the Ada programming language will be deleted on sight!
[link] [comments]
Null access analyzer?
Is there any GNAT option or other static analyzer that can warn about possible null pointers and avoid a Constraint_Error
at a runtime? For example:
procedure Test (P : access Integer) is begin P.all := 1; -- `P` could be null. end Test;
EDIT: Renamed compiler. Improved explanation.
[link] [comments]
New project: Alice
After months of dedicated work, I'm thrilled to introduce my project: Alice!
Alice, Adventures for Learning and Inspiring Coding Excellence, is a collaborative Ada framework that allows programmers to enhance and share their solutions to various problem sources (e.g. Project Euler, CodinGame and Advent of Code), fostering collaboration, learning and creativity.
While it's currently in the proof of concept stage, and only Project Euler is supported, I believe it holds immense potential.
The wiki pages offer a glimpse into Alice's concept, participation opportunities, and development ideas.
I warmly invite all members of the Ada community, as well as beginners and students exploring Ada, to read across the wiki pages and share your valuable feedback. Your insights and input will be instrumental in shaping Alice's future. Together, let's unlock the possibilities and make a significant impact.
Stay tuned for the upcoming public release, as we embark on this exciting journey together!
[link] [comments]
Mavlink Ada - Having issues while connecting using UDP
The examples (https://github.com/ArduPilot/pymavlink/tree/master/generator/Ada/examples) are implemented using Serial communication. When I tried to update one of the examples with UDP protocol, Mav_Conn.Parse_Byte()
is not returning true (But I'm receiving the data). I'm not sure, what I've done wrong, Can someone help me with this?
Also, adding the code for your reference, Thank you:
with Ada.Streams; with Ada.Text_IO; with Interfaces; with Ada.Numerics.Generic_Elementary_Functions; with GNAT.Sockets; use GNAT.Sockets; with Ada.Unchecked_Conversion; with Mavlink; with Mavlink.Connection; with Mavlink.Messages; with Mavlink.Types; procedure Attitude is use type Ada.Streams.Stream_Element_Offset; use type Interfaces.Unsigned_8; package Short_Float_Text_IO is new Ada.Text_IO.Float_IO(Short_Float); Server : Socket_Type; Address, From : Sock_Addr_Type; Input : Ada.Streams.Stream_Element_Array(1..1024); Input_Last : Ada.Streams.Stream_Element_Offset; Count : Integer := 0; Mav_Conn : Mavlink.Connection.Connection (System_Id => 250); procedure Handler_Attitude is Attitude : Mavlink.Messages.Attitude; K_Rad2Deg : Short_Float := 180.0 / Ada.Numerics.Pi; begin Mav_Conn.Unpack (Attitude); Ada.Text_IO.Put ("Pitch: "); Short_Float_Text_IO.Put(Attitude.Pitch * K_Rad2Deg, Aft => 4, Exp => 0); Ada.Text_IO.Put (" Roll: "); Short_Float_Text_IO.Put(Attitude.Roll * K_Rad2Deg, Aft => 4, Exp => 0); Ada.Text_IO.Put (" Yaw: "); Short_Float_Text_IO.Put(Attitude.Yaw * K_Rad2Deg, Aft => 4, Exp => 0); Ada.Text_IO.New_Line; end Handler_Attitude; begin Create_Socket (Server, Family_Inet, Socket_Datagram); Set_Socket_Option (Server, Socket_Level, (Reuse_Address, True)); Address.Addr := Inet_Addr("127.0.0.1"); Address.Port := 14551; Ada.Text_IO.Put_Line ("Connects to ardupilot (baud rate 115200) via ttyUSB0 and reads attitude angles"); Bind_Socket (Server, Address); loop Receive_Socket (Server, Input, Input_Last, From); for B of Input (Input'First .. Input_Last) loop if Mav_Conn.Parse_Byte(Interfaces.Unsigned_8(B)) then if Mav_Conn.Get_Msg_Id = Mavlink.Messages.Attitude_Id then Handler_Attitude; end if; end if; end loop; end loop; end Attitude;
[link] [comments]
Unconventional Project: Video Game Inventory Manager in Ada 2022
Hello all, as I’ve alluded to over the past few weeks I’ve been developing a relatively complex GUI application in Ada 2022 using Gtkada, VSS, and AWS. The result of this is <https://github.com/andrewathalye/destiny-inventory-tool/>, an inventory management tool for the video game Destiny 2.
It’s not an example of mission-critical code or anything of the sort, but it is quite performant (more than twice as fast as the most popular competitor), open source, and (hopefully) rather aesthetically-pleasing.
It has some trouble building with the Alire versions of Gtkada and AWS at the moment, but if you can get Gtkada and AWS installed on a computer with support for OpenSSL enabled then it will almost certainly work. It is also necessary to create a self-signed certificate if you want to sign in and download profile data.
There is a fairly high likelihood it only works on Linux and macOS at the moment, but I’d love to hear success (or failure) stories if anyone here attempts to get it working elsewhere.
[link] [comments]
AEiC 2023 - Ada-Europe conference - program info
http://www.ada-europe.org/conference2023/
The 27th Ada-Europe International Conference on Reliable Software Technologies (AEiC 2023) returns to Portugal after 5 years, to take place in Lisbon, in the week of 13-16 June.
The conference program includes two core days with various presentations, bracketed by one day with 6 tutorials, and one day with 2 satellite events. There will be time for networking during breaks as well as social events around historic, cultural, scenic, and culinary highlights of Lisbon.
For more info and latest updates see the conference web site. You'll find there an overview of the program, the list of accepted papers and presentations, and descriptions of workshops, tutorials, keynote presentation and panel, and social events. Also check the conference site for registration, accommodation and travel information.
Online registration is open. Reduced fees for various groups. Early registration discount until 22 May.
#AEiC2023 #AdaEurope #AdaProgramming
[link] [comments]
Reduce and concat operator ?
I work on a program with -gnatX flag enabled because I want array aggregator and reduce attribute
Here is my simplified prog function f return String is ( [for i in 1..4 => "---" ]'Reduce("&","") --i use concat operator here );
But i get the compilation error: wrong operator type
(I write this error from memory it could not be the same exact word)
Any Idea hox fix it ?
EDIT:
So here my response, the error message was error: incompatible arguments for operator
when i renames the operator it strangely work, and thanks to u/sttaft to give me part of the answer.
``` function conck(L,R : Unbounded_String) return Unbounded_String renames "&";
function strToBFValue(str:string) return String is ( To_String( [for i in str'range => To_Unbounded_String("some operation...") ] 'Reduce(conck,NULL_UNBOUNDED_STRING)) );
```
[link] [comments]