[PATCH] rtems: Add RTEMS_PARTITION_ALIGNMENT

Gedare Bloom gedare at rtems.org
Thu Oct 1 15:22:43 UTC 2020


ok, this should be documented in the partition manager docs

On Wed, Sep 30, 2020 at 6:37 AM Sebastian Huber
<sebastian.huber at embedded-brains.de> wrote:
>
> Update #4105.
> ---
>  cpukit/include/rtems/rtems/part.h           |  9 +++++++++
>  testsuites/psxtests/psxconfig01/init.c      |  2 +-
>  testsuites/sptests/sppartition_err01/init.c | 17 +++++++++--------
>  3 files changed, 19 insertions(+), 9 deletions(-)
>
> diff --git a/cpukit/include/rtems/rtems/part.h b/cpukit/include/rtems/rtems/part.h
> index 5a6484329f..c5e1551d8c 100644
> --- a/cpukit/include/rtems/rtems/part.h
> +++ b/cpukit/include/rtems/rtems/part.h
> @@ -35,6 +35,15 @@ extern "C" {
>   */
>  /**@{*/
>
> +/**
> + * @brief This constant defines the minimum alignment of a partition buffer in
> + *   bytes.
> + *
> + * Use it with RTEMS_ALIGNED() to define the alignment of statically allocated
> + * partition buffers.
> + */
> +#define RTEMS_PARTITION_ALIGNMENT CPU_SIZEOF_POINTER
> +
>  /**
>   *  @brief RTEMS Partition Create
>   *
> diff --git a/testsuites/psxtests/psxconfig01/init.c b/testsuites/psxtests/psxconfig01/init.c
> index d2811b409a..6d7a227793 100644
> --- a/testsuites/psxtests/psxconfig01/init.c
> +++ b/testsuites/psxtests/psxconfig01/init.c
> @@ -186,7 +186,7 @@ static rtems_task Init(rtems_task_argument argument);
>
>  #include <rtems/confdefs.h>
>
> -typedef struct {
> +typedef struct RTEMS_ALIGNED(RTEMS_PARTITION_ALIGNMENT) {
>    uint64_t data [16];
>  } area;
>
> diff --git a/testsuites/sptests/sppartition_err01/init.c b/testsuites/sptests/sppartition_err01/init.c
> index 39373852fb..a2297d53cc 100644
> --- a/testsuites/sptests/sppartition_err01/init.c
> +++ b/testsuites/sptests/sppartition_err01/init.c
> @@ -16,17 +16,18 @@
>
>  const char rtems_test_name[] = "SPPARTITION_ERR 1";
>
> -uint32_t Other_Memory;
> +static uint32_t Other_Memory;
>
> -TEST_EXTERN rtems_name Partition_name[ 2 ]; /* array of partition names */
> -TEST_EXTERN rtems_id   Partition_id[ 2 ];   /* array of partition ids */
> +static rtems_name Partition_name[ 2 ]; /* array of partition names */
>
> -TEST_EXTERN uint8_t   Partition_good_area[256] CPU_STRUCTURE_ALIGNMENT;
> -#define Partition_bad_area (void *) 0x00000005
> +static rtems_id   Partition_id[ 2 ];   /* array of partition ids */
> +
> +static RTEMS_ALIGNED( RTEMS_PARTITION_ALIGNMENT ) uint8_t
> +  Partition_good_area[ 256 ];
>
> -void test_partition_errors(void);
> +#define Partition_bad_area (void *) 0x00000005
>
> -void test_partition_errors(void)
> +static void test_partition_errors(void)
>  {
>    void              *buffer_address_1;
>    void              *buffer_address_2;
> @@ -152,7 +153,7 @@ void test_partition_errors(void)
>      Partition_name[ 1 ],
>      Partition_good_area,
>      128,
> -    35,
> +    RTEMS_PARTITION_ALIGNMENT - 1,
>      RTEMS_DEFAULT_ATTRIBUTES,
>      &junk_id
>    );
> --
> 2.26.2
>
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel


More information about the devel mailing list