FreeRTOS V10.0.1 Demo for Renesas RL78 is not compliant with IAR Workbench V3.10

laobaitu wrote on Monday, July 09, 2018:


I was compiling FreeRTOS v10.0.1 in the latest IAR v3.10.
But in \FreeRTOS\Source\portable\IAR\RL78\portasm.s87


gives below error:

COMMON directive is not supported in ELF mode

ORG directive is not supported in ELF mode

I found the reason is that IAR 1.x compiler uses UBROF but IAR 2.x and 3.x use ELF/DWARF.
In the new compiler, COMMON, ORG and some other syntx are deleted.

I wonder if there is a way to solve this problem.

Thank you.

rtel wrote on Monday, July 09, 2018:

This has been noted by others on the forum who have been able to work
around it - but I don’t have visibility into what they did. I have not
tried myself, but if I were I would assume it was necessary to at least
update the linker script, and then maybe the C start up code if it
referenced any of the linker constants. To do that I would take the
linker script and C start up code from an example provided by IAR or

laobaitu wrote on Tuesday, July 10, 2018:

Thank you for reply.
I found an offical document EW_MigrationFromUBROF, which briefly introduces how to migrate from UBROF to ELF. I’m looking into it now.

rtel wrote on Tuesday, July 10, 2018:

Please report back what you learn. Thanks.

laobaitu wrote on Monday, July 23, 2018:

Hi Richrad,
I’ve learnt the EW_MigrationFromUBROF, and run the Demo project successfully.
We should consider below things when migrating from UBROF to ELF:

  1. C/C++ source code syntax
    No special change for RL78 demo
  2. assembler source code syntax
    Assembler directives are changed a lot.
    1. the call symbol between C code and asm code.
      I didn’t find a way to install an ISR with assembler code.
  3. linker configuration
    RL78 demo uses default linker configuration. We should pay more attention to it if we need some special section configuration

Refer to the doc for more differences.

The changes I made:

  1. The variables and function names in asm code must start with _ , and in c code without _ . Compiler will explain them as one symbol.

  2. Comment out the ISR install code in the portasm file.

;	DW vPortTickISR

;	ORG 126
;	DW vPortYield

Then install ISR in c code, by using #pragma vector:

 * Install the interrupt in portasm.
extern void vPortTickISR( void );
extern void vPortYield( void );

#pragma vector=configTICK_VECTOR
__interrupt void vPortTickISR_Wrapper( void )

#pragma vector=0x7E
__interrupt void vPortYield_Wrapper( void )

By the way, I found another bug not sure if it was due to the linker upgrade.
In port.c, function prvSetupTimerInterrupt():

	#ifdef TMKAEN
        //timer configuration

The timer configuration was not setup, While the TMKAEN has been defined as below:

  __near __no_init volatile union
    unsigned char PER1;
    __BITS8       PER1_bit;
      unsigned char  :4;
      unsigned char  TKB2EN:1;
      unsigned char  CMPEN:1;
      unsigned char  :1;
      unsigned char  TMKAEN:1;
  } @ 0xF007A;

I add a line to fix it.


That’s all what I got from this migration.

rtel wrote on Monday, July 23, 2018:

Thanks for reporting back.