* Packed array problem
@ 2016-03-02 17:26 Simon Wright
2016-03-05 15:07 ` rrr.eee.27
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Simon Wright @ 2016-03-02 17:26 UTC (permalink / raw)
Investigating the SVD2Ada program[1], for converting an ARM System View
Description[2] into bindings, I got this message when compiling against
my STM32F429I runtime:
stm32f429x-rcc.ads:149:09: packing of 3-bit components not supported
by configuration
which is the same as in this little example:
1. package Checks is
2. type Uint3 is mod 8 with Size => 3;
3. type Arry is array (0 .. 1) of Uint3
|
>>> packing of 3-bit components not supported by configuration
4. with Component_Size => 3, Size => 6;
5. end Checks;
This code compiles perfectly happily against AdaCore's ravenscar-sfp
runtime.
The error message comes from freeze.adb:2721 in the compiler:
if Is_Constrained (Arr)
and then Is_Bit_Packed_Array (Arr)
and then Present (Packed_Array_Impl_Type (Arr))
and then Is_Array_Type (Packed_Array_Impl_Type (Arr))
then
declare
CS : constant Uint := Component_Size (Arr);
RE : constant RE_Id := Get_Id (UI_To_Int (CS));
begin
if RE /= RE_Null
and then not RTE_Available (RE)
then
Error_Msg_CRT
("packing of " & UI_Image (CS) & "-bit components",
First_Subtype (Etype (Arr)));
and it would seem after much delving that the compiler is checking (in
rtsfind) for System.Pack_03, which isn't present in my runtime. If I
copy the spec from GCC 5.2.0 (not 4.9 - the interface has changed) then
check.ads compiles OK (I should say I normally use GCC 5.2.0, but this
problem is the same with GNAT GPL 2015).
BUT there is no s-pack03.ad? in AdaCore's arm-eabi runtimes! And when
compiling against the AdaCore runtimes there's no reference in the
generated binary to s-pack03!
SO has anyone got any idea as to what the compiler could be looking for
and finding in AdaCore's RTS but not in mine?
[1] https://github.com/AdaCore/svd2ada
[2] http://www.arm.com/products/processors/cortex-m/cortex-microcontroller-software-interface-standard.php
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Packed array problem
2016-03-02 17:26 Packed array problem Simon Wright
@ 2016-03-05 15:07 ` rrr.eee.27
2016-03-05 15:42 ` Simon Wright
2016-03-06 22:55 ` Simon Wright
2016-03-27 1:12 ` rieachus
2 siblings, 1 reply; 5+ messages in thread
From: rrr.eee.27 @ 2016-03-05 15:07 UTC (permalink / raw)
On Wednesday, March 2, 2016 at 6:26:29 PM UTC+1, Simon Wright wrote:
> SO has anyone got any idea as to what the compiler could be looking for
> and finding in AdaCore's RTS but not in mine?
AFAIR, it is either s-unstyp.ads or s-bitops.ad[sb] or both.
RE
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Packed array problem
2016-03-05 15:07 ` rrr.eee.27
@ 2016-03-05 15:42 ` Simon Wright
0 siblings, 0 replies; 5+ messages in thread
From: Simon Wright @ 2016-03-05 15:42 UTC (permalink / raw)
rrr.eee.27@gmail.com writes:
> On Wednesday, March 2, 2016 at 6:26:29 PM UTC+1, Simon Wright wrote:
>> SO has anyone got any idea as to what the compiler could be looking for
>> and finding in AdaCore's RTS but not in mine?
>
> AFAIR, it is either s-unstyp.ads or s-bitops.ad[sb] or both.
Thanks for the thought, but I already have s-unstyp.ads, and
s-bitops.ad[bs] isn't in AdaCore's RTS and made no difference to mine.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Packed array problem
2016-03-02 17:26 Packed array problem Simon Wright
2016-03-05 15:07 ` rrr.eee.27
@ 2016-03-06 22:55 ` Simon Wright
2016-03-27 1:12 ` rieachus
2 siblings, 0 replies; 5+ messages in thread
From: Simon Wright @ 2016-03-06 22:55 UTC (permalink / raw)
Simon Wright <simon@pushface.org> writes:
> Investigating the SVD2Ada program[1], for converting an ARM System
> View Description[2] into bindings, I got this message when compiling
> against my STM32F429I runtime:
>
> stm32f429x-rcc.ads:149:09: packing of 3-bit components not
> supported by configuration
>
> which is the same as in this little example:
>
> 1. package Checks is
> 2. type Uint3 is mod 8 with Size => 3;
> 3. type Arry is array (0 .. 1) of Uint3
> |
> >>> packing of 3-bit components not supported by configuration
>
> 4. with Component_Size => 3, Size => 6;
> 5. end Checks;
>
> This code compiles perfectly happily against AdaCore's ravenscar-sfp
> runtime.
Solved. I had pragma Normalize_Scalars in package System; removed this,
now all OK.
I don't quite see why Normalize_Scalars should affect matters, since the
compiler is quite capable of generating access-3-bits code directly in
all normal cases!
Normalize_Scalars came from the Ada Bare Bones tutorial at
http://wiki.osdev.org/Ada_Bare_bones.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Packed array problem
2016-03-02 17:26 Packed array problem Simon Wright
2016-03-05 15:07 ` rrr.eee.27
2016-03-06 22:55 ` Simon Wright
@ 2016-03-27 1:12 ` rieachus
2 siblings, 0 replies; 5+ messages in thread
From: rieachus @ 2016-03-27 1:12 UTC (permalink / raw)
> I don't quite see why Normalize_Scalars should affect matters, since the
> compiler is quite capable of generating access-3-bits code directly in
> all normal cases!
GNAT's implementation of Normalize_Scalars will try to initialize scalars to
an invalid value if one exists. I suspect the bug here is that Normalize_Scalars
is trying to choose a 4-bit value 1111 and that can't be packed into three bits.
But...Normalize_Scalars should not apply to array components. So I have no idea where GNAT is trying to jam four bits into three. Glad the fix was that easy.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-03-27 1:12 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-02 17:26 Packed array problem Simon Wright
2016-03-05 15:07 ` rrr.eee.27
2016-03-05 15:42 ` Simon Wright
2016-03-06 22:55 ` Simon Wright
2016-03-27 1:12 ` rieachus
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox