While Alire provides ready for use runtimes for some boards, it is not trivial to run an application on other boards, and even harder to use Ada tasking. I’ve developed runtime generator to create custom runtimes for bare board application. Runtime can be fine tuned for particular application, it is generated near to application’s code and not need to be distributed.
I’ve able to run blink led example on STM32F401/411 and STM32G431/474 boards, and on Arduino Due.
I would never normally recommend using C however for clock setup and PWR setup then they are probably very well tested by ST so using their SDK code might not be so bad? (caveat: I have shaken my head at their code before for example their clock setup code uses a global variable that makes it fragile in relation to procedure execution order). It would mean that porting the Ada runtime might be a drop in. I guess it depends if finding the right C #includes are less or more of an issue. Certainly gprbuild makes it easy to do it once you do. The trickier issue is low power parts and making the runtime be compatible with user executed clock changes which is an exercise I shall have to hope to have the time for one day.
Time and tasking support in GNAT RTL should be improved to support flexible CPU frequencies. Right now, CPU frequency is hardcoded.
Do you have an experience with changing power modes? For STM changing of CPU clocks configuration require change of clock prescalers for peripherals. How is it handled?
I have only done it with the low power parts L and U which are designed for it but yes some drivers like timers have to get the current speeds and if I recall correctly there are differences in the code generated by STM32Cube IDE. So my Ada code to get the clock speeds had to be adapted between L and U. To save time I currently have bindings to SystemClock_Config, HAL_ RCC_GetPCLK1Freq, HAL_RCC_GetSysClockFreq and HAL_ RCC_GetHCLKFreq pulling in around 40 .c and .h files. I have a script to compare them to upstream which is not ideal but I guess it’s easier to copy in those 40 files from any new chip than compare for changes in the generated code and you can just copy the clock init code (SystemClock_Config) after any changes made in the STM32Cube IDE. The others are in the HAL package with just an example of binding SystemClock_Config as that needs to be added to main once generated based on STs IDEs clock configuration tooling.