FreeRTOS for the Renesas Demonstration kit (RDK) for the RX62N

I tried to ready FreeRTOS for the Renesas Demonstration Kit (RDK) for the RX62N. I could build it, but it did not run correctly. I also tried to modify a port for the Renesas Starter Kit (RSK) for the RX62N. It also did not work but I could build it. The port for the RSK was from 2011 and tasks.c was 70K. Where as todays task.c is over 200k.

Could any one elaborate on this.

Please specify “did not run correctly.”

When run and stepped through the execution of an example using the Hew, the program made a continuous loop through the same code but not going through the expected code.

What are those code? Can you share those code snippets?

Also, can you try to use the latest version? Per this readme, you should be able to use this port - https://github.com/FreeRTOS/FreeRTOS-Kernel/tree/main/portable/Renesas/RX600v2

Here are the code snippets, with comments from the Hew (High Performance Embedded Workstation) running in Debugger mode stepping through the code. Which was downloaded to the board and run from the board.

Tasks.c
2349 portDISABLE_INTERRUPTS – only code line run by debugger, won’t step in

Interrupt_INTC.c
459 rpdl_INTC_callback_func[PDL_INTC_PRIVILEGED] – code run to here

That does not provide much help. Can you try using the latest FreeRTOS code and the port I mentioned above?

I tried … and got lots of errors. I already tried once before and got similar.
I first tried to compiler port.c

In FreeRTOSConfig.h – remedy found for the following
//#define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 7 ) – not accepted by compiler
#define configMAX_PRIORITIES (7) – alternative

In port.c
BaseType_t xPortStartScheduler( void )
{

/* Start the first task. */
190 prvStartFirstTask();

}

#pragma inline_asm prvStartFirstTask
static void prvStartFirstTask( void )
{
SETPSW U

MOV.L	#_pxCurrentTCB, R15

port.c
port.c(190) : A2002 (E) Characters exist in expression
port.c(190) : A2002 (E) Characters exist in expression
port.c(190) : A2113 (E) Symbol definition is not appropriate
port.c(190) : A2002 (E) Characters exist in expression
port.c(190) : A2002 (E) Characters exist in expression
port.c(190) : A2113 (E) Symbol definition is not appropriate
port.c(256) : A2113 (E) Symbol definition is not appropriate

I don’t no what to do about this one off hand.

I looked at how Renesas starts assembler in the c program file. I took out the #pragma

//#pragma inline_asm prvStartFirstTask
static void prvStartFirstTask( void )
{
/* When starting the scheduler there is nothing that needs moving to the
interrupt stack because the function is not called from an interrupt.
Just ensure the current stack is the user stack. */
SETPSW U

/* Obtain the location of the stack associated with which ever task
pxCurrentTCB is currently pointing to. */
MOV.L   #_pxCurrentTCB, R15
MOV.L   [R15], R15

and got …
Phase RX C/C++ Compiler starting
D:\Renesas\WorkSpace\UNCCLabs\UNCCLabsTry2\TrainFreeRTOS\Train\FreeRTOS_Source\portable\Renesas\RX600v2\port.c
…port.c(207) : C5020 (E) Identifier “SETPSW” is undefined
port.c(211) : C5065 (E) Expected a “;”
port.c(211) : C5010 (E) “#” not expected here
port.c(235) : C5012 (W) Parsing restarts here after previous syntax error
Phase RX C/C++ Compiler finished

Build Finished
3 Errors, 1 Warning

I would like to add that taking out the assember pragma was false. I found similar at the top of renesas resetprg.c file. Also all other FreeRTOS files (heap_4.c, list.c, queue.c and tasks.c) would compile without any issues.

I also should mention that for the RX62N there was no FreeRTOSConfig.h file as there was no port, due to a security problem. Files for the RX600v2 under the portable directory were available and used but had no FreeRTOSConfig.h file. I used one from the examples for the Renesas Starter Kit for the same RX62N. This could be the problem I’m having.

Where did you get the code from?

If you just run the code, then pause in the debugger, what is the MCU executing? Is it always executing the same thing? Please link to the lines in github rather than provide a line number - line numbers don’t help unless we also have the source file you are using. For example, this links to line 568 in the head revision of tasks.c https://github.com/FreeRTOS/FreeRTOS-Kernel/blob/main/tasks.c#L568

Which compiler and compiler version are you using?

Don’t remove the pragmas unless you are using a later compiler version which has a different way of inlining assembly code. It definitely won’t work if you remove the pragams and don’t replace them with anything else.

Hi,

Pleased to have you.

The FreeRTOS source was downloaded from the FreeRTOS website around December 2012 and is version FreeRTOSv202212.00. I just saw that there is now a newer version available 01.

The MCU was always executing the same thing. I dumped the code and started new. I must have erased important code to make it compile but breaking the code.

On the new compiler errors:

This shows the fixed line. The previous one (72) is the line that did’nt work.

This shows the line in port.c Nr. 190 that complains.

Here is the data about the build tools from the High Performance Embedded workstation
High-performance Embedded Workshop

RX Standard Toolchain (V.1.2.0.0)

RX Family C/C++ Compile Driver V.1.02.00.000
RX Family C/C++ Compiler V.1.02.00.000
RX Family Assembler V.1.02.00.000
Optimizing Linkage Editor V.10.02.00.000
RX Family C/C++ Standard Library Generator V.1.02.00.000
Copyright (C) 2008 (2009 - 2011) Renesas Electronics Corporation and
Renesas Solutions Corp.
Copyright (C) 1999 Hitachi, Ltd.
All rights reserved.

I already saw that I had to replace the pramas. So they are there.

So it looks like you are using one of the latest FreeRTOS releases, but an RX demo from the older FreeRTOS V10.4.x because the demos were removed from the main release (because they used uIP with a security flaw). Is that correct?

I’m looking at V10.4.x, in which there are a couple of RX62N demos that use the Renesas compiler. Looking at configMAX_PRIORITIES in the FreeRTOSConfig.h files in those projects I see:

and

So in those projects the definition is already set to just “7” without the unsigned portBASE_TYPE cast. That said, looking at the head revision of the kernel (if you are using a recent version of everything other than the demo) I see portBASE_TYPE defined at:

So don’t see why “unsigned portBASE_TYPE” wouldn’t compile - although this is a very old method, BaseType_t is preferred for some time now.

I was actually using FreeRTOS V6.1.1 from 2011. Much older than V10.4.x. It was for demos on the Renesas Starter Kit for the RX62N. I tried using your V10.4.x file. I had to add definitions for :
/* Added myself to fulfill error messages */
#define configKERNEL_INTERRUPT_PRIORITY ( 1 )
#define configMAX_SYSCALL_INTERRUPT_PRIORITY ( 1 )

but I got a new single error in port.c
port.c(238) : C2703 (E) Illegal #pragma interrupt declaration

What could I try here?

The older FreeRTOSConfig.h file

Are you not using the latest RX compiler? Can you try using the latest compiler?

I found a newer compiler and tried it out. It did not solve the problem.
The new compiler Toolchain:
High-performance Embedded Workshop

RX Standard Toolchain (V.1.2.1.0)

RX Family C/C++ Compile Driver V.1.02.01.000
RX Family C/C++ Compiler V.1.02.01.000
RX Family Assembler V.1.02.00.000
Optimizing Linkage Editor V.10.02.00.000
RX Family C/C++ Standard Library Generator V.1.02.00.000
Copyright (C) 2008 (2009 - 2012) Renesas Electronics Corporation and
Renesas Solutions Corp.
Copyright (C) 1999 Hitachi, Ltd.
All rights reserved.

As explained by Richard Barry the older FreeRTOS distribution 10.4.1 did work.

Also I have not found anything on Assembler programming for the RX62N other than that Renesas has 3 assemblers for there RX600 series MCU’s x1, x2 and x3. Do you know which one it is? I am looking for training on it.

I think it is RXv1.
Where did you download the tools from?

If you look at this page, the latest version is 3.05.

I:

  1. Downloaded the compiler and hew from the link given in Gaurav’s post. Hew Version 4.09.00.007 which comes with CCRX V1.0.2 compiler.

  2. Checked out the FreeRTOS V10.4.1 package from GitHub - FreeRTOS/FreeRTOS at V10.4.1.

  3. Built the code - no problems.

  4. Updated the kernel submodule pointer in V10.4.1 to the kernel’s head revision.

  5. Rebuilt the code with the following output:

Building All - RTOSDemo - Debug

Phase RX C/C++ Library Generator starting
Nothing to do - skipping
Phase RX C/C++ Library Generator finished

Phase RX C/C++ Compiler starting
C:\Temp\delete\10.4.2\FreeRTOS\FreeRTOS\Demo\Common\Minimal\BlockQ.c
C:\Temp\delete\10.4.2\FreeRTOS\FreeRTOS\Demo\Common\Minimal\GenQTest.c
C:\Temp\delete\10.4.2\FreeRTOS\FreeRTOS\Demo\Common\Minimal\IntQueue.c
C:\Temp\delete\10.4.2\FreeRTOS\FreeRTOS\Demo\Common\Minimal\PollQ.c
C:\Temp\delete\10.4.2\FreeRTOS\FreeRTOS\Demo\Common\Minimal\QPeek.c
C:\Temp\delete\10.4.2\FreeRTOS\FreeRTOS\Demo\Common\Minimal\blocktim.c
C:\Temp\delete\10.4.2\FreeRTOS\FreeRTOS\Demo\Common\Minimal\death.c
C:\Temp\delete\10.4.2\FreeRTOS\FreeRTOS\Demo\Common\Minimal\flash.c
C:\Temp\delete\10.4.2\FreeRTOS\FreeRTOS\Demo\Common\Minimal\flop.c
C:\Temp\delete\10.4.2\FreeRTOS\FreeRTOS\Demo\Common\Minimal\integer.c
C:\Temp\delete\10.4.2\FreeRTOS\FreeRTOS\Demo\Common\Minimal\recmutex.c
C:\Temp\delete\10.4.2\FreeRTOS\FreeRTOS\Demo\Common\Minimal\semtest.c
C:\Temp\delete\10.4.2\FreeRTOS\FreeRTOS\Demo\Common\ethernet\FreeTCPIP\apps\httpd\http-strings.c
C:\Temp\delete\10.4.2\FreeRTOS\FreeRTOS\Demo\Common\ethernet\FreeTCPIP\apps\httpd\httpd-fs.c
C:\Temp\delete\10.4.2\FreeRTOS\FreeRTOS\Demo\Common\ethernet\FreeTCPIP\apps\httpd\httpd.c
C:\Temp\delete\10.4.2\FreeRTOS\FreeRTOS\Demo\Common\ethernet\FreeTCPIP\psock.c
C:\Temp\delete\10.4.2\FreeRTOS\FreeRTOS\Demo\Common\ethernet\FreeTCPIP\timer.c
C:\Temp\delete\10.4.2\FreeRTOS\FreeRTOS\Demo\Common\ethernet\FreeTCPIP\uip.c
C:\Temp\delete\10.4.2\FreeRTOS\FreeRTOS\Demo\Common\ethernet\FreeTCPIP\uip_arp.c
C:\Temp\delete\10.4.2\FreeRTOS\FreeRTOS\Demo\RX600_RX62N-RDK_Renesas\RTOSDemo\HighFrequencyTimerTest.c
C:\Temp\delete\10.4.2\FreeRTOS\FreeRTOS\Demo\RX600_RX62N-RDK_Renesas\RTOSDemo\IntQueueTimer.c
C:\Temp\delete\10.4.2\FreeRTOS\FreeRTOS\Demo\RX600_RX62N-RDK_Renesas\RTOSDemo\ParTest.c
C:\Temp\delete\10.4.2\FreeRTOS\FreeRTOS\Demo\RX600_RX62N-RDK_Renesas\RTOSDemo\Renesas-Files\dbsct.c
C:\Temp\delete\10.4.2\FreeRTOS\FreeRTOS\Demo\RX600_RX62N-RDK_Renesas\RTOSDemo\Renesas-Files\hwsetup.c
C:\Temp\delete\10.4.2\FreeRTOS\FreeRTOS\Demo\RX600_RX62N-RDK_Renesas\RTOSDemo\Renesas-Files\intprg.c
C:\Temp\delete\10.4.2\FreeRTOS\FreeRTOS\Demo\RX600_RX62N-RDK_Renesas\RTOSDemo\Renesas-Files\resetprg.c
C:\Temp\delete\10.4.2\FreeRTOS\FreeRTOS\Demo\RX600_RX62N-RDK_Renesas\RTOSDemo\Renesas-Files\sbrk.c
C:\Temp\delete\10.4.2\FreeRTOS\FreeRTOS\Demo\RX600_RX62N-RDK_Renesas\RTOSDemo\Renesas-Files\vecttbl.c
C:\Temp\delete\10.4.2\FreeRTOS\FreeRTOS\Demo\RX600_RX62N-RDK_Renesas\RTOSDemo\main-full.c
C:\Temp\delete\10.4.2\FreeRTOS\FreeRTOS\Demo\RX600_RX62N-RDK_Renesas\RTOSDemo\uIP_Task.c
C:\Temp\delete\10.4.2\FreeRTOS\FreeRTOS\Demo\RX600_RX62N-RDK_Renesas\RTOSDemo\webserver\EMAC.c
C:\Temp\delete\10.4.2\FreeRTOS\FreeRTOS\Demo\RX600_RX62N-RDK_Renesas\RTOSDemo\webserver\httpd-cgi.c
C:\Temp\delete\10.4.2\FreeRTOS\FreeRTOS\Demo\RX600_RX62N-RDK_Renesas\RTOSDemo\webserver\phy.c
C:\Temp\delete\10.4.2\FreeRTOS\FreeRTOS\Source\list.c
C:\Temp\delete\10.4.2\FreeRTOS\FreeRTOS\Source\portable\MemMang\heap_2.c
C:\Temp\delete\10.4.2\FreeRTOS\FreeRTOS\Source\portable\Renesas\RX600\port.c
C:\Temp\delete\10.4.2\FreeRTOS\FreeRTOS\Source\queue.c
C:\Temp\delete\10.4.2\FreeRTOS\FreeRTOS\Source\tasks.c
C:\Temp\delete\10.4.2\FreeRTOS\FreeRTOS\Source\timers.c
Phase RX C/C++ Compiler finished

Phase RX Assembler starting
C:\Temp\delete\10.4.2\FreeRTOS\FreeRTOS\Source\portable\Renesas\RX600\port_asm.src
Phase RX Assembler finished

Phase OptLinker starting
License expires in 60 days
Phase OptLinker finished

Build Finished
0 Errors, 0 Warnings


I downloaded the tools from Renesas, like shown in Gaurav’s post. I also downloaded the Hew which was the same version that I have. The Hew would however not connect to the board. So I guess there is something on the DVD that allows the Hew to connect to the board. So I reinstalled the Hew from the DVD and was once again able to connect to the board.

Gaurav’s post says the version of the compiler is 3.0.5. I found that to be for a new IDE, the CS+, not for the Hew. I downloaded and installed CS+. I found the following note in the readme:
CS+ is not generally promoted to the U.S. and European customers. Customers in the U.S. and Europe who are interested in CS+ are requested to contact our regional marketing departments for details.

I did find migration guides for Hew projects.

I want’ed to look at this on the weekend as this is for weekends.

On point 4 of Barry’s post
4. Updated the kernel submodule pointer in V10.4.1 to the kernel’s head revision.
Does this mean that the FreeRTOS files were updated to the latest build (FreeRTOSv202212.01)?