From: DrPi <314@drpi.fr>
Subject: Re: Record initialisation question
Date: Sun, 10 Jan 2021 17:53:49 +0100 [thread overview]
Message-ID: <5ffb311f$0$16185$426a74cc@news.free.fr> (raw)
In-Reply-To: <i5u1apFp2qsU1@mid.individual.net>
Le 09/01/2021 à 16:44, Niklas Holsti a écrit :
> On 2021-01-09 11:30, DrPi wrote:
>> Hi,
>>
>> I'm working on a µP BSP. The boot sequence of this µP requires byte
>> structures located in FLASH memory.
>> For example :
>>
>> type t_Dcd_Header is record
>> Tag : Unsigned_8 := 16#D2#;
>> Length : Unsigned_16 := 4; -- Length in byte of the DCD
>> structure (this header included)
>
>
> (As the default value (4) does not include the rest of the DCD
> structure, the comment is rather misleading. Best to remove the default
> value, I think.)
Maybe, I'm sure sure.
Value of 4 means only the header is present.
>
>
>> Version : Unsigned_8 := 16#41#;
>> end record
>> with Object_Size => 32,
>> Bit_Order => System.Low_Order_First;
>>
>> for t_Dcd_Header use record
>> Tag at 0 range 0 .. 7;
>> Length at 0 range 8 .. 23;
>> Version at 0 range 24 .. 31;
>> end record;
>>
>> The t_Dcd_Header is part of t_Dcd record.
>> The Length field of t_Dcd_Header must contain the length of t_Dcd.
>>
>> Dcd : constant t_Dcd :=
>> ( Dcd_Header => ( Length => ???, -- Length of Dcd
>> others => <>),
>> ...
>> );
>>
>> Is there a way to automatically set Length ?
>
>
> If the Length should apply to the whole t_Dcd object, it is hard to
> answer without knowing how the rest of the t_Dcd type is defined. Does
> it have a fixed size, or are there some components of variable size?
>
The DCD is fully specified.
>
>> Dcd goes in a dedicated .txt section.
>
>
> Do you expect the compiler/linker to generate the full value of the Dcd
> object into the program image at compilation and link time?
That's it.
> Have you
> ensured that the construction of the Dcd object requires no elaboration
> code? Most Flash memories cannot be written in the same way as RAM, so
> even if that .txt section is not write-protected, normal RAM-oriented
> elaboration code would not be able to write into Flash.
I'm aware of this (I'm an electronics guy).
I'll add a "pragma No_Elaboration_Code_All;" when I'm ready.
next prev parent reply other threads:[~2021-01-10 16:53 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-09 9:30 Record initialisation question DrPi
2021-01-09 10:46 ` Dmitry A. Kazakov
2021-01-10 16:41 ` DrPi
2021-01-11 21:48 ` Shark8
2021-01-12 11:38 ` Simon Wright
2021-01-12 15:01 ` Shark8
2021-01-14 21:32 ` Simon Wright
2021-01-14 23:12 ` Shark8
2021-01-14 12:58 ` DrPi
2021-01-17 17:03 ` DrPi
2021-01-17 23:55 ` Shark8
2021-01-18 20:02 ` DrPi
2021-01-19 5:50 ` Randy Brukardt
2021-01-09 15:44 ` Niklas Holsti
2021-01-10 16:53 ` DrPi [this message]
2021-01-10 19:30 ` Niklas Holsti
2021-01-10 21:27 ` DrPi
2021-01-10 22:14 ` Niklas Holsti
2021-01-11 17:46 ` DrPi
2021-01-11 20:58 ` Niklas Holsti
2021-01-14 13:07 ` DrPi
2021-01-14 13:36 ` AdaMagica
2021-01-14 14:07 ` Jeffrey R. Carter
2021-01-14 14:09 ` Jeffrey R. Carter
2021-01-14 14:27 ` Niklas Holsti
2021-01-14 16:53 ` Shark8
2021-01-15 7:50 ` DrPi
2021-01-15 18:15 ` Shark8
2021-01-16 10:28 ` DrPi
2021-01-14 16:59 ` Paul Rubin
2021-01-15 7:49 ` DrPi
2021-01-17 17:08 ` DrPi
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox