Skip to content

Latest commit

 

History

History
96 lines (71 loc) · 4.13 KB

README.adoc

File metadata and controls

96 lines (71 loc) · 4.13 KB

ada-stm32f746-disco

Develop

Link git hooks:

./scripts/link-githooks

Style

Basic GNATcheck standards setup in coding_standard. To check run:

make gnatcheck

This creates obj/gnatcheck.out and obj/gnatcheck-source-list.out.

Dependencies

AdaCore GNAT Community Edition 2019 for x86_64 and ARM ELF

Using the 2019 version for compatibility with ASIS tools. 2020 and on dropped support for ASIS as AdaCore is migrating to libadalang-tools but they are not mature yet.

To install, make the downloaded binaries executable then run them and follow the install wizard. Make sure you add the bin paths to your PATH environment variable.

ASIS

Tarball was downloaded from. Added to repo because I suspect it may disappear at some point because it is not linked on their download page. See https://stackoverflow.com/questions/62405736/no-gnattest-in-gnat-community-edition:

To build (don’t need to install) just run one of the make targets that depends on it, e.g.:

make gnatcheck

conform

Use conform to enforce certain rules for git commits. Using my own fork of conform because of a bug that I submitted for a PR.

To install:

git clone https://github.com/dsmcfarl/conform.git
cd conform
go install

Learnings/Observations

  • The elimination of the ASIS tools in the AdaCore Community Edition before the libadalang-tools have been added was a little disappointing and took a lot of research to figure out a work around to be able to use GNATcheck and GNATtest. I ended up reverting to the 2019 version which includes GNATtest and then built the ASIS tools from source to use GNATcheck.

  • Unrelated to Ada, but I discovered the conventional commits standard while setting up this project.

  • I became more familiar with OpenOCD. Before, I’d always used https://github.com/stlink-org/stlink, but I was having problems with st-util GDB server with this project. The program kept raising an exception when using st-util whereas it worked fine with OpenOCD. Not sure why. Here are some of the things I learned:

    • how to create a custom OpenOCD config file that sources a default one and adds to it

    • how to resume the program automatically when a debugging session detaches with a custom config

    • When the GDB server is killed, the board gets stuck in a halted state until the board is power cycled. This only happens when utilizing semihosting.

    • how to use a GDB script to auto attach to a remote target when GDB starts

  • Became more familiar with GDB. I learned:

    • how to re-upload a file to the remote target from within a debug session (load)

    • how to set commands to run automatically when a breakpoint is hit (cannot do things like next, step, or finish though)

    • how to define a custom function in a GDB script

  • GNAT tools:

    • gprbuild builds a project using a .gpr file.

    • gprinstall installs a project. If you use the version from the cross compiler it installs in its install directory by default.

    • GNATcheck does static analysis of Ada source based on configurable standards and generates a report

    • GNATtest builds a test harness and stubs and skeleton tests for a specified set of interfaces (or all interfaces).

    • ada_language_server can be used in vim using coc.nvim to provide a nice development environment. To avoid building ada_language_server you can use the binary that gets installed with AdaCore Community Edition 2021 (~/opt/GNAT/2021/libexec/gnatstudio/als/ada_language_server).