Hello,

I want to use the RTEMS region manager but the function rtems_region_create() fails with code RTEMS_INVALID_ADDRESS.

I am using RTEMS 4.10 on a LEON4 processor.

My RTEMS configuration information includes:

#define CONFIGURE_MAXIMUM_REGIONS               1


According to the RTEMS C User's Guide,  RTEMS_INVALID_ADDRESS should be caused by one of the following:

- starting address is NULL

- id is NULL

- starting address is not on a four byte boundary.


But in my case it looks like none of the above conditions is true.

Here is a snippet of my code:

###########################################

static int memory_region[MEM_REGION_LENGTH_32BITS];

void memory_regions_init (void)
{
    rtems_status_code ret_code;

    Mem_region_name = rtems_build_name('M', 'E', 'M', 'R');

    ret_code = rtems_region_create(Mem_region_name, (void *) memory_region, MEM_REGION_LENGTH_BYTES, MEM_REGION_PAGE_SIZE_BYTES, RTEMS_DEFAULT_ATTRIBUTES, &Mem_region_id);

    if (ret_code != RTEMS_SUCCESSFUL)
    {
        .....
    }

    // debugging
    printf("address of memory_region[] is 0x%08X\n", memory_region);
    printf("address of Mem_region_id is 0x%08X\n", &Mem_region_id);

}

###########################################

The printfs give this output:

address of memory_region[] is 0x40546EBC
address of Mem_region_id is 0x40551C00

from which we see that the starting address is 0x40546EBC = 1079275196, which is a multiple of 4, so it should be on a 4-byte boundary.


If I tweak a bit the code and the starting address (i.e. the address of memory_region[]) turns out to be 0x4054C2F8  (= 1079296760 which is a multiple of 4 and 8 as well) then the function rtems_region_create() returns RTEMS_SUCCESSFUL.

Does anybody know what the cause of this problem could be?

Thanks in advance!

Francesco

_______________________________________________
users mailing list
users@rtems.org
http://lists.rtems.org/mailman/listinfo/users

Reply via email to