How to Merge Two Separate Projects Using e2studio

How to Merge Two Separate Projects Using e2studio

Some applications require the underlying algorithms to be provided by the chip supplier or a third party, while the user only writes the application layer code and then merges the two parts of the code to run.

Based on this purpose, this article introduces how to use e2studio to create two separate projects and merge the mot files of the two projects to run as a complete project, thereby achieving the specified functions.

The example projects RX26T_user and RX26T_mot in this article achieve the following functions:

  1. RX26T_user calls the assignment function in RX26T_mot to assign values to the variables test_value1 and test_value2. 

  1. The 1ms interrupt program of RX26T_user calls the 1-second increment function in RX26T_mot to assign values to the variable cnt_1s, achieving an increment of 1 per second. 

  1. The 1ms interrupt program of RX26T_user calls the function in RX26T_mot to toggle PORTB1.

 

For the specific implementation of the functions, please refer to the example program.

  1. Creating the Project

  • IDE: e2studio, Version: 2025-04.1 (25.4.1)

  • Compiler: CCRX, Version: v3.07.00

  • Test Board: RX26T CPU Board (YCB23RX26TMCU0111)

 

Creating RX26T_user:

  1. Select the project directory. 

W1.png
  1. Select "Create a new C/C++ project".

Picture5.png

 

  1. Select "Renesas CC-RX C/C++ Executable project" and click "Next".

 

Picture6.png

 

  1. Enter the project name "RX26T_user" and click "Next". 

Picture7.png
  1. Select "Toolchain Version" and "Target Device", then click "Next". 

Picture8.png
  1. Check "Use Smart Configurator" and click "Finish". 

Picture9.png
  1. The RX26T_user project is created as shown below. 

Picture10.png
  1. Click "Components", then click "+" Add Component, select "Compare Match Timer" and click "Next". 

Picture11.png
  1. Select "CMT0" and click "Finish". 

Picture12.png

10.   Change the "Interval value" to 1ms, then click "Generate Code". 

Picture13.png

11.   Call the API function R_API_mot_Time1ms() in the interrupt function r_Config_CMT0_cmi0_interrupt(). 

Picture14.png

12.   Add the API files r_api_function.c/h and r_function_list.c/h to the project to call the functions in the RX26T_mot project. Please refer to the files for details.

Picture15.png

13.   Click "Components", then click "+" Add Component, select "Ports" and click "Finish". 

Picture16.png

14.   Set "PB1" to "Out", then click "Generate Code". 

Picture17.png

 

Creating RX26T_mot:

  1. Click "File" -> "New" -> "C/C++ Project".

Picture18.png
  1. Select "Renesas CC-RX C/C++ Executable project" and click "Next". 

Picture19.png
  1. Enter the project name "RX26T_mot" and click "Next". 

Picture20.png
  1. Select "Toolchain Version" and "Target Device", then click "Next". 

Picture21.png
  1. Note: uncheck "Use Smart Configurator" here and click "Finish". 

Picture22.png
  1. The RX26T_mot project is created as shown below. 

Picture23.png
  1. Delete the files resetprg.c and vecttbl.c.

Picture24.png
  1. Add the files r_function_list.c/h and r_ram.c/h, delete the main() function in RX26T_mot.c, and add your own functions.

 

Picture25.png
  1. Special note.

1)All functions should be placed after the definition of "#pragma section P P_MOTCODE_SECTION" to place the RX26T_mot code in the specified area, as shown below.

Picture26.png

2)All variables should be placed after the definition of "#pragma section B B_MOT_RAM" to place the RX26T_mot variables in the specified area, as shown below.

Picture27.png

3)The function list should be placed after the definition of "#pragma section C C_FUNCTIONLIST_SECTION" to place the RX26T_mot function list in the specified area, as shown below.

Note: The names “P_MOTCODE_SECTION, B_MOT_RAM, and C_FUNCTIONLIST_SECTION” can be customized.

Picture28.png

 

10.   Right-click the project name in the Project Explorer, select "Properties" -> "Settings" -> "Section", and add the three sections defined above.

Note: The address can be customized.

Picture29.png
Picture30.png

 

11.   Follow the same steps as in step 10 to complete the "Section" settings for the RX26T_user project.

 

  1. Online Debugging

  1. Select the RX26T_user project, right-click and select "Debug As" -> "Debug Configurations" to open the debug settings interface.

 

Picture31.png
  1. Click "Startup" -> "Add" RX26T_mot.mot, and click "Move Up" to move RX26T_mot.mot above RX26T_user.x, as shown below.

Note: RX26T_mot.mot must be moved above RX26T_user.x, otherwise the interrupt vector table of RX26T_user.x will be overwritten by RX26T_mot.mot, causing the program to crash. 

Picture32.png
Picture33.png
  1. Click "Debug" to enter the debug interface and run the program. You can see that the variables test_value1 and test_value2 get the correct values, and cnt_1s increments by 1 every second.

Picture34.png

 

3.Programming and Running

Tool: Renesas Flash Programmer V3.19.00

  1. Click "Add/Remove Files..." to load RX26T_mot.mot, and click "Block Settings" to select only the code area of RX26T_mot.mot, then click "Start" to successfully program it, as shown below. 

Picture35.png
Picture36.png
Picture37.png
  1. Click "Add/Remove Files..." to load RX26T_user.mot, and click "Block Settings" to select only the code area of RX26T_user.mot, then click "Start" to successfully program it, as shown below.

 

Picture38.png
Picture39.png
Picture40.png
  1. Power on and run the program, test the waveform of PORTB1, we can see that it toggles once per second. It verifies that the specified functions are successfully achieved after programming the two mot files.

 

Picture41.png

    By the online debugging and programming two mots demonstrated in this article, it can be seen that merging the two separate example projects RX26T_user and RX26T_mot can achieve the specified functions.