Page 2 of 2

Re: chThdCreateFromHeap migration issue

Posted: Wed Jun 28, 2017 7:17 am
by omcdr
My code looks like now:

Code: Select all

#pragma data_alignment = 4
static uint8_t data[MEMORY_POOL_SIZE];
static memory_pool_t mp1;

chPoolObjectInit(&mp1, sizeof(data), NULL);
chPoolFree(&mp1, &data[0]);
cmd_console.threadp = chThdCreateFromMemoryPool(&mp1, "cmd", NORMALPRIO + 5, cmd_console_thd, (void *) &cmd_console);
chThdWait(cmd_console.threadp);

I still got chSysHalt.

With commented out line in chThdCreateSuspendedI:

Code: Select all

  chDbgCheck(MEM_IS_ALIGNED(tdp->wbase, PORT_WORKING_AREA_ALIGN) &&
             MEM_IS_ALIGNED(tdp->wend, PORT_STACK_ALIGN) &&
             (tdp->wend > tdp->wbase) &&
             (((size_t)tdp->wend - (size_t)tdp->wbase) >= THD_WORKING_AREA_SIZE(0)));

and my thread is working correctly.

Should I check every condition in this check separately?

I don't run test suite on my boards.

Re: chThdCreateFromHeap migration issue

Posted: Wed Jun 28, 2017 9:18 am
by Giovanni
Yes, you should understand which condition fails, you problem is then clear.

Giovanni

Re: chThdCreateFromHeap migration issue

Posted: Tue Jul 18, 2017 9:29 am
by omcdr
I have found problem, should be:

Code: Select all

#pragma data_alignment = 32
static uint8_t data[MEMORY_POOL_SIZE];


Do you have plans for integrate #pragma data_alignment into code for IAR compiler version ?

Re: chThdCreateFromHeap migration issue

Posted: Tue Jul 18, 2017 9:40 am
by Giovanni
Hi,

Alignment support is provided by the macros used to declare thread working areas. You need to declare your buffer using those.

Giovanni