Skip to content

About RL78 FreeRTOS

Shunichiro Nakamura edited this page Jul 13, 2026 · 9 revisions

Renesas/FreeRTOS-Kernel wiki


Supported MCUs (RL78 FreeRTOS)

A list of the microcontrollers supported by FreeRTOS for the RL78 and folders of the portable layer that must be selected are summarized in the table below. Links to the methods for creating projects for each MCU (Code Generator support or Smart Configurator support) are also given in the table.
The “MCU Group” column lists microcontrollers for which operation has been confirmed. Users cannot receive technical support through “support tickets” for Renesas Technical Support in the case of microcontrollers for which operation has not yet been confirmed.

RL78 MCU Portable Layer Methods for Creating Projects
MCU Group CPU Core Type CC-RL Compiler
RL78/G13 RL78-S2 Renesas/RL78 Method using the Code Generator
RL78/G14 RL78-S3
RL78/G23
RL78/G24
Method using the Smart Configurator

✅ Note:
Under the following conditions, the RL78 FreeRTOS kernel uses approx. 8 Kbytes of ROM and approx. 4 Kbytes of RAM.

  • CC-RL compiler
    • Compiler options
      • -Odefault: Applied optimization is effective for both the object size and execution speed.
      • -memory_model: Automatically selected
      • -far_rom: Setting the near/far attribute for the ROM data specified by the memory model to far
    • Linker option
      • -optimize=symbol_delete: Deleting variables or functions not referred to even once

Restrictions (RL78 FreeRTOS)

  • Switching of register banks (the memory space for allocating general-purpose registers of the RL78 microcontroller) is not supported.
  • Interrupt nesting is not supported.
  • Since task-switch requests are implemented by the software interrupt, task switching is to be executed immediately after a task switch has been requested due to the specification. This imposes the following restriction on the user application.
    • In an interrupt service routine (ISR), request a task switch (execute the portYIELD_FROM_ISR macro) in the last processing of the ISR.
      For details on this restriction for the specification, refer to Issue ticket #21 of GitHub.
    • Do not request a task switch in a critical section.
  • Caution should be taken when implementing the user application if near pointers are being treated as 4-byte integers by the CC-RL compiler.
    For example, the following phenomenon occurs in xTaskCreate() because a void * type argument is always handled as a near pointer.
    • Phenomenon: The value specified in the argument pvParameters on the xTaskCreate() side does not match the value obtained by casting the argument pvParameters on the task-entry function side to a 4-byte integer.

    • Cause: Based on the specifications of memory allocation in the CC-RL compiler:

      • Since the arguments of a FreeRTOS API function are not designated specifically with the keyword __far, void * type arguments are always treated as 2-byte near pointers.
      • When the size of the near pointer is extended from 2 bytes to 4 bytes, the third byte from the least significant is set to 0x0f.
      • For details on the specifications, refer to the following in the CC-RL Compiler User's Manual.
        • Sub-section on “Relationship with near and far”
        • Sub-section on “Internal representation and value area of data”
        • Item on “Specifying memory allocation area (__near /__far)”
    • Countermeasure: In each task, incrementally cast the value of the argument pvParameters in order through “2-byte integer (int type)” to “4-byte integer (long type)”.

      void main (void)
      {
          void* parameter = 0x0;
          // The void* type arguments of FreeRTOS APIs (e.g. xTaskCreate's pvParameters) are always near pointers.
          xReturned = xTaskCreate(vTaskA, "TaskA", stackSize, 
                                  parameter, // The parameter is a near pointer
                                  priority, &xHandle);
          ...
      }
      
      void vTaskA(void * pvParameters)
      {
          // NG: Because the val is casted from a near pointer to a long type,
          //     its value is 0xf0000 instead of 0x0
          // long val = (long)pvParameters;
      
          // OK: Cast in stages: near pointer (2 bytes) → int type (2 bytes) → long type (4 bytes)
          int val_int = (int)pvParameters;
          long val = (long)val_int;    // val = 0x0
          ...
      }

Clone this wiki locally