Does Initialize_Scalars require a Full runtime or does light need s-scaval.ads?

When I add
pragma Initialize_Scalars

To my local configuration pragmas on a light runtime.

I get

hal.ads:164:04: error: construct not allowed in configurable run-time mode
hal.ads:164:04: error: file s-scaval.ads not found
hal.ads:164:04: error: entity “System.Scalar_Values.Is_Isf” not available

The complete output follows.

gprbuild --target=arm-eabi -d -P/mnt/crypt/elansys/code/Ada/stm32l4r9_hal/stm32l4r9_hal.gpr -XMODE=Compile -XADAFLAGS= -g -j12 -gnat2022 -largs -Wl,-Map=map.txt
Compile
[Ada] stm32_svd-spi.ads
[Ada] stm32_svd-swpmi.ads
[Ada] stm32_svd-rcc.ads
[Ada] stm32_svd-lcd.ads
[Ada] stm32_svd-fpu.ads
[Ada] stm32_svd-opamp.ads
[Ada] stm32_svd-dma.ads
[Ada] stm32_svd-octospim.ads
[Ada] stm32_svd-rtc.ads
[Ada] stm32_svd-syscfg.ads
[Ada] stm32_svd-octospi.ads
[Ada] stm32_svd-crc.ads
hal.ads:164:04: error: construct not allowed in configurable run-time mode
hal.ads:164:04: error: file s-scaval.ads not found
hal.ads:164:04: error: entity “System.Scalar_Values.Is_Isf” not available
hal.ads:164:04: error: construct not allowed in configurable run-time mode
hal.ads:164:04: error: file s-scaval.ads not found
hal.ads:164:04: error: entity “System.Scalar_Values.Is_Isf” not available
hal.ads:164:04: error: construct not allowed in configurable run-time mode
hal.ads:164:04: error: file s-scaval.ads not found
hal.ads:164:04: error: entity “System.Scalar_Values.Is_Isf” not available
hal.ads:164:04: error: construct not allowed in configurable run-time mode
hal.ads:164:04: error: file s-scaval.ads not found
hal.ads:164:04: error: entity “System.Scalar_Values.Is_Isf” not available
hal.ads:164:04: error: construct not allowed in configurable run-time mode
hal.ads:164:04: error: file s-scaval.ads not found
hal.ads:164:04: error: entity “System.Scalar_Values.Is_Isf” not available
hal.ads:164:04: error: construct not allowed in configurable run-time mode
hal.ads:164:04: error: file s-scaval.ads not found
hal.ads:164:04: error: entity “System.Scalar_Values.Is_Isf” not available
hal.ads:164:04: error: construct not allowed in configurable run-time mode
hal.ads:164:04: error: file s-scaval.ads not found
hal.ads:164:04: error: entity “System.Scalar_Values.Is_Isf” not available
hal.ads:164:04: error: construct not allowed in configurable run-time mode
hal.ads:164:04: error: file s-scaval.ads not found
hal.ads:164:04: error: entity “System.Scalar_Values.Is_Isf” not available
hal.ads:164:04: error: construct not allowed in configurable run-time mode
hal.ads:164:04: error: file s-scaval.ads not found
hal.ads:164:04: error: entity “System.Scalar_Values.Is_Isf” not available
hal.ads:164:04: error: construct not allowed in configurable run-time mode
hal.ads:164:04: error: file s-scaval.ads not found
hal.ads:164:04: error: entity “System.Scalar_Values.Is_Isf” not available
hal.ads:164:04: error: construct not allowed in configurable run-time mode
hal.ads:164:04: error: file s-scaval.ads not found
hal.ads:164:04: error: entity “System.Scalar_Values.Is_Isf” not available
hal.ads:164:04: error: construct not allowed in configurable run-time mode
hal.ads:164:04: error: file s-scaval.ads not found
hal.ads:164:04: error: entity “System.Scalar_Values.Is_Isf” not available

compilation of stm32_svd-crc.ads failed
compilation of stm32_svd-octospi.ads failed
compilation of stm32_svd-syscfg.ads failed
compilation of stm32_svd-rtc.ads failed
compilation of stm32_svd-octospim.ads failed
compilation of stm32_svd-dma.ads failed
compilation of stm32_svd-opamp.ads failed
compilation of stm32_svd-fpu.ads failed
compilation of stm32_svd-lcd.ads failed
compilation of stm32_svd-rcc.ads failed
compilation of stm32_svd-swpmi.ads failed
compilation of stm32_svd-spi.ads failed

gprbuild: *** compilation phase failed
[2023-01-16 14:11:59] process exited with status 4, 23% (27/113), elapsed time: 00.31s

I can’t see any forbidden constructs and it certainly seems to build when added to light-cortex-m4f.

Shall I open an issue in the bb-runtimes repository?

Can’t hurt to open an issue. Worst case they say that it is out of scope of their runtime and you just add it yourself for your needs.

1 Like

Initialize_Scalars can be applied to your application code only, unlike Normalize_Scalars.
This could cause problems with generic instantiations

Thank you for the tip. Especially as I do not see that caveat mentioned in the GNAT RM. Normalize had issues with SVD files. I think I shall just concentrate on using Spark mode pragmatically instead as initialize_scalars affects the generated code so much.

I think I was misleading here (possibly I misled myself).
Normalize_Scalars must be used over the whole partition; Initialize_Scalars over whatever part f your own code you’re interested in.
But you have to have the code used to implement the feature (s-scaval.ad?) present at compile time, in a place where the compiler can find it. This would normally be the runtime.
You could maybe try using the embedded- runtime for this purpose, then going to the light- for real.

1 Like

There isn’t an embedded runtime yet for the chip that we are using (stm32l4r9).

Not a problem though. In some ways the light runtime helps keep code Spark compatible.

My original use case was to make it obvious if a record with many booleans hadn’t had one set with the bonus of catching other problems. I’m thinking I shall just go back to a special Boole type of size 2 with unset as default and use Spark mode which will catch a lot more issues without affecting the code size.