FreeRTOS Ported to RH850

Hello @mikisama ,
Thanks for you explanation! I used the direct vecotor mode too.
Recently,I’ve been testing the RTOS on RH850 platform, recursive mutex/ counting Semaphore/ block timer passed the tests.
But interrupt queue test failed and the failure rate was about 70%, the direct failure reason was suspend and resume flag didn’t match.

BaseType_t xTaskResumeAll( void )
{
........

/* If uxSchedulerSuspended is zero then this function does not match a
     * previous call to vTaskSuspendAll(). */
    configASSERT( uxSchedulerSuspended );
........
}

I have spent 3 days debugging this issue and haven’t figured out yet.
As a comparison, I‘d like to know if you have encountered a similar problem?
Appreciate that if you have any good suggestions!
Thanks!

hi, @Bowen_Gu

I was busy a while ago. Did you solve this problem?
Can you share your project so that I can help you with this issue.

Hi @mikisama ,
Appreciate that you can help me with this project.
For the issue, not yet, but I have used table reference mode + no interrupt nest to work around it so that I can keep porting other modules.
Finally, interrupt nesting is neccessary for current project.
freeRTOS and platform relevant code as below:
RH850F1L_FreeRTOS_V202112.00.zip (296.5 KB)
I’d like to explain what I have done on project.

  1. GCC directory as portable file
  2. remove commad HILO of “mov hilo(_xInterruptNesting), r6” to fit GHS compiler
  3. use TAUB channel 0 and channel 1 for interrupt queue test
    The rest is basically the same as the reference code.

HI, @Bowen_Gu

Both INTTAUB0I0_IRQHandler and INTTAUB0I1_IRQHandler are defined but never used.

You may have forgotten to call these two handlers in the ISR.

Hi @mikisama
INTTAUB0I0_IRQHandler and INTTAUB0I1_IRQHandler were defined in my project, Sorry! I forgot to upload file.

extern void INTTAUB0I0_IRQHandler(void);
extern void INTTAUB0I1_IRQHandler(void);

__interrupt void INTTAUB0I0(void)
{
	INTTAUB0I0_IRQHandler();
}

__interrupt void INTTAUB0I1(void)
{
	INTTAUB0I1_IRQHandler();
}

You should not use the __interrupt keyword to define an ISR.

I don’t know much about the GHS compiler, but when IAR uses the __interrupt keyword to define the ISR, the registers are saved and restored in a different order than defined by pxPortInitialiseStack.

It will break the stack layout.

Hi

If we use this port for RH850, we see that multiple interrupts are not working

then next doubt is : how and where do we enable multiple interruption , can you please point it out?

Thanks

Hi, @pra18

Can the sample code in my repository work on your platform?

The sample code enables 3 peripheral interrupts.

  1. OSTM0 (for system tick)
  2. TAUJ0I0 (for IntQueueTimer test)
  3. TAUJ0I1 (for IntQueueTimer test)

Thank you for replying

I am asking in general if we use the freeRTOS port to RH850 and interrupt occur only once how to enable multiple interrupts as explained in the link below by Renesas

Thanks,

Hi, @pra18

Well, I now know what multiple interrupts is. Before I only knew it by another name, interrupt nesting, which is already enabled.

image

exactly,
thanks for pointing this out.

did you anytime try out porting the freertos port of RH850 to eclipse ?

we tried another port of RH850(dguleria) in GHS and it works but when we try to port the same project onto eclipse based ghs we encounter a hang at a the place
configASSERT(pxQueue);

this occurs when We try to run a counting semaphore example test code, but binary semaphore example works fine.

Hi, @pra18

GHS seems does not offer an evaluation version and I don’t have GHS license, so I can’t work on.

If someone can provide an evaluation version of the GHS compiler, I can try it out.

It’s hard to say what cause configASSERT(pxQueue).

Can you share your project so that I can try help you with this issue.

bootloader.zip (1.1 MB)

ok

attached this project we are trying to build in eclipse based GHS

we could successfully build and debug the GHS version of the same project earlier

this is a clone of freertos ported to rh850 with some adaptation to our platform HW

Regards,

Hi, @pra18

Can you share the ELF files compiled by GHS since I can’t use the GHS compiler. :joy:

One is compiled by GHS Multi and the other is compiled by eclipse.

I am doubting that the different compiler options cause this issue.

Bootloader.zip (89.2 KB)

ok here it is

Hi, @pra18

The usage of some V850/RH850 general purpose registers can be switched via compile options.

Special attention needs to be paid to R5(TP) and R30(EP).

In the function pxPortInitialiseStack of bootloader/src/RTOS/portable/Core/port.c:

  1. There is no allocation for R5 which means the OS port treat R5 as it is fixed or unused.
  2. R30 is filled with 0x30303030 which means the OS port do not treat R30 is fixed.

The compiler must be set up to meet both of two requirements above.

I recommend you run the registers tests task first. The registers tests will ensure that the registers are saved and restored as expected by the OS port.

Here is the example.
RegTest.s

Good luck and have fun!

ok thanks,

but these are unchanged as it is used as is from [dguleria] post and sample/tests folder

checked registers and found savin and restoring context works.

will try to look from different viewpoints

Hi,
How to create CSTACK section in GHS.
Thanks

HI, @pra18
What setting did you do in your GHS to make [dguleria] code work. i am trying since many days it is not working for me. Is it possible for you to share the complete project.

Thanks