Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
JUTA_2823561
Level 4
Level 4
Distributor - Macnica (Japan)
25 replies posted 25 sign-ins 10 likes received

Dear supporter,

I would like to translate the following KBA. Could you confirm?

https://community.infineon.com/t5/Knowledge-Base-Articles/Porting-RT-Thread-to-ModusToolbox/ta-p/457...

Best regards,
JUTA_2823561

0 Likes
1 Solution
MuhammadNanda_K
Moderator
Moderator
Moderator
250 sign-ins 250 replies posted 50 likes received

Hello @JUTA_2823561,

After internal discussion, I have done reviewing and trying on my side.
In general, to do porting RT-Thread into ModusToolbox (MTB), several workarounds must be done (especially when facing error in compilation).

Please kindly try below steps.

  1. Create new RT-Thread project in RT-Thread Studio (RTT Studio).

  2. In RTT Studio, choose “Base On Board” then select PSOC62-IFX-PROTO-KIT -> Fill project name -> “Finish”.

  3. In RTT Studio, Ensure the created project working by building and flashing into the CY8CPROTO-062-4343W.

  4. In ModusToolbox (MTB), create empty app using CY8CPROTO-062-4343W.

  5. Replace content of linker file “<MTB_Proj>\bsps\TARGET_APP_CY8CPROTO-062-4343W\COMPONENT_CM4\TOOLCHAIN_GCC_ARM\linker.ld” with the one inside “<RTT_Studio_Proj>\board\linker_scripts\link.ld”.

  6. Replace “<MTB_Proj>\bsps\TARGET_APP_CY8CPROTO-062-4343W\COMPONENT_CM4\TOOLCHAIN_GCC_ARM\startup_psoc6_02_cm4.S” with “<RTT_Studio_Proj>\libraries\IFX_PSOC6_HAL\TARGET_CY8CKIT-062S2-43012\COMPONENT_CM4\TOOLCHAIN_GCC_ARM\startup_psoc6_02_cm4.S”.

  7. Create folder “rt-thread\” in <MTB_Proj> as seen in KBA.

  8. Copy “<RTT_Studio_Proj>\board\”, “<RTT_Studio_Proj>\libraries\” and “<RTT_Studio_Proj>\rt-thread\” into “<MTB_Proj>\rt-thread\”.

  9. Copy “<RTT_Studio_Proj>\cconfig.h”, “<RTT_Studio_Proj>\rtconfig.h” and “<RTT_Studio_Proj>\rtconfig_preinc.h” into “<MTB_Proj>\rt-thread\”.

  10. Delete “<MTB_Proj>\rt-thread\board\linker_scripts\”.

  11. Update “<MTB_Proj>\rt-thread\board\board.h” to add:
    #define BSP_I2C0_SCL_PIN       P0_2
    #define BSP_I2C0_SDA_PIN       P0_3
    
    #define BSP_I2C1_SCL_PIN       P2_0
    #define BSP_I2C1_SDA_PIN       P2_1
    
    #define BSP_I2C2_SCL_PIN       P3_0
    #define BSP_I2C2_SDA_PIN       P3_1
    
    #define BSP_I2C3_SCL_PIN       P6_0
    #define BSP_I2C3_SDA_PIN       P6_1
    
    #define BSP_I2C6_SCL_PIN       P12_0
    #define BSP_I2C6_SDA_PIN       P12_1
    
    #define BSP_USING_SPI3_SAMPLE
    #define BSP_SPI3_MOSI_PIN    P6_0
    #define BSP_SPI3_MISO_PIN    P6_1
    #define BSP_SPI3_SCLK_PIN    P6_2
    #define BSP_SPI3_CS_PIN      P6_3​
  1. Update “<MTB_Proj>\rt-thread\rtconfig.h” to add:
    #define RT_USING_HWTIMER
    #define RT_USING_I2C
    #define RT_USING_I2C_BITOPS
    #define RT_USING_WDT
    #define RT_USING_ADC
    #define RT_USING_DAC
    #define RT_USING_PWM
    #define RT_USING_SPI
    #define BSP_USING_I2C1
    #define BSP_USING_HW_I2C1
    #define BSP_USING_SPI3
    #define BSP_USING_ADC1​
  1. Delete “<MTB_Proj>\rt-thread\libraries\IFX_PSOC6_HAL\”.

  2. Delete folders inside “<MTB_Proj>\rt-thread\rt-thread\components\” except “rt-thread\rt-thread\components\drivers\” and “rt-thread\components\finsh\”.

  3. Replace “<MTB_Proj>\main.c” with “<RTT_Studio_Proj>\applications\main.c.

  4. Delete folders inside “<MTB_Proj>\rt-thread\rt-thread\libcpu\” except ”<MTB_Proj>\libcpu\arm\cortex-m4\” and ”<MTB_Proj>\libcpu\arm\common\”.

  5. Delete “<MTB_Proj>\rt-thread\rt-thread\libcpu\arm\common\divsi3.S”.

  6. Delete “<MTB_Proj>\rt-thread\rt-thread\libcpu\arm\cortex-m4\context_iar.S” and “<MTB_Proj>\rt-thread\rt-thread\libcpu\arm\cortex-m4\context_rvds.S”.

  7. Change include "cyhal_irq_psoc.h" with "cyhal_irq_impl.h" in “<MTB_Proj>\rt-thread\libraries\HAL_Drivers\drv_gpio.h”.

  8. Add csdadc and csdidac using MTB Library Manager.

  9. Remove include "cy_retarget_io.h" in “<MTB_Proj>\rt-thread\libraries\HAL_Drivers\drv_hwtimer.h”.

  10. Delete folders inside rt-thread\rt-thread\components\drivers\” except “hwtimer\”, “i2c\”, “include\”, “ipc\”, “misc\”, “serial\”, “spi\” and “watchdog\”.

  11. Remove warning by deleting a variable in ifx_pin_dettach_irq() on “<MTB_Proj>\rt-thread\libraries\HAL_Drivers\drv_gpio.c”.

  12. Remove warning by adding include “stdio.h” in “<MTB_Proj>\rt-thread\libraries\HAL_Drivers\drv_adc.c”.

  13. Delete “<MTB_Proj>\rt-thread\rt-thread\components\drivers\misc\pulse_encoder.c” and “<MTB_Proj>\rt-thread\rt-thread\components\drivers\misc\rt_inputcapture.c”.

  14. Delete <MTB_Proj>\rt-thread\rt-thread\components\drivers\serial\serial_v2.c”.

  15. Delete source and header files “enc28j60”, “spi_msd”, “spi_wifi_rw009” and “spi-bit-ops” under “<MTB_Proj>\rt-thread\rt-thread\components\drivers\spi\”.

  16. Delete “<MTB_Proj>\rt-thread\rt-thread\tools\”.

  17. Move #endif in “<MTB_Proj>\rt-thread\libraries\HAL_Drivers\drv_i2c.c” to after enum.

  18. Change #ifdef RT_USING_I2C to #ifdef RT_USING_SOFT_I2C in “<MTB_Proj>\rt-thread\libraries\HAL_Drivers\drv_soft_i2c.c”.

  19. Build (compile) and flash (program) in the MTB into CY8CPROTO-062-4343W.


After that, we will still see some warning in compilation.
But at least the RT-Thread can be programmed using MTB now.

If you have any concerns, please kindly inform. 🙂 

Thank you and regards,
Muhammad Nanda

View solution in original post

0 Likes
8 Replies
MuhammadNanda_K
Moderator
Moderator
Moderator
250 sign-ins 250 replies posted 50 likes received

Hello @JUTA_2823561,

I just assigned to this thread.
I will try to confirm the process mentioned in that KBA posted by non-Infineon.

I will be back as soon as I get update.
I am sorry for any inconvenience.

Thank you and regards,
Muhammad Nanda

0 Likes
MuhammadNanda_K
Moderator
Moderator
Moderator
250 sign-ins 250 replies posted 50 likes received

Hello @JUTA_2823561,

I am sorry that, this KBA was just updated by our internal team and correct the author / poster as our employee.

For technical clarification, we will be back as soon as we get update on this.

Thank you and regards,
Muhammad Nanda

0 Likes
MuhammadNanda_K
Moderator
Moderator
Moderator
250 sign-ins 250 replies posted 50 likes received

Hello @JUTA_2823561,

After internal discussion, I have done reviewing and trying on my side.
In general, to do porting RT-Thread into ModusToolbox (MTB), several workarounds must be done (especially when facing error in compilation).

Please kindly try below steps.

  1. Create new RT-Thread project in RT-Thread Studio (RTT Studio).

  2. In RTT Studio, choose “Base On Board” then select PSOC62-IFX-PROTO-KIT -> Fill project name -> “Finish”.

  3. In RTT Studio, Ensure the created project working by building and flashing into the CY8CPROTO-062-4343W.

  4. In ModusToolbox (MTB), create empty app using CY8CPROTO-062-4343W.

  5. Replace content of linker file “<MTB_Proj>\bsps\TARGET_APP_CY8CPROTO-062-4343W\COMPONENT_CM4\TOOLCHAIN_GCC_ARM\linker.ld” with the one inside “<RTT_Studio_Proj>\board\linker_scripts\link.ld”.

  6. Replace “<MTB_Proj>\bsps\TARGET_APP_CY8CPROTO-062-4343W\COMPONENT_CM4\TOOLCHAIN_GCC_ARM\startup_psoc6_02_cm4.S” with “<RTT_Studio_Proj>\libraries\IFX_PSOC6_HAL\TARGET_CY8CKIT-062S2-43012\COMPONENT_CM4\TOOLCHAIN_GCC_ARM\startup_psoc6_02_cm4.S”.

  7. Create folder “rt-thread\” in <MTB_Proj> as seen in KBA.

  8. Copy “<RTT_Studio_Proj>\board\”, “<RTT_Studio_Proj>\libraries\” and “<RTT_Studio_Proj>\rt-thread\” into “<MTB_Proj>\rt-thread\”.

  9. Copy “<RTT_Studio_Proj>\cconfig.h”, “<RTT_Studio_Proj>\rtconfig.h” and “<RTT_Studio_Proj>\rtconfig_preinc.h” into “<MTB_Proj>\rt-thread\”.

  10. Delete “<MTB_Proj>\rt-thread\board\linker_scripts\”.

  11. Update “<MTB_Proj>\rt-thread\board\board.h” to add:
    #define BSP_I2C0_SCL_PIN       P0_2
    #define BSP_I2C0_SDA_PIN       P0_3
    
    #define BSP_I2C1_SCL_PIN       P2_0
    #define BSP_I2C1_SDA_PIN       P2_1
    
    #define BSP_I2C2_SCL_PIN       P3_0
    #define BSP_I2C2_SDA_PIN       P3_1
    
    #define BSP_I2C3_SCL_PIN       P6_0
    #define BSP_I2C3_SDA_PIN       P6_1
    
    #define BSP_I2C6_SCL_PIN       P12_0
    #define BSP_I2C6_SDA_PIN       P12_1
    
    #define BSP_USING_SPI3_SAMPLE
    #define BSP_SPI3_MOSI_PIN    P6_0
    #define BSP_SPI3_MISO_PIN    P6_1
    #define BSP_SPI3_SCLK_PIN    P6_2
    #define BSP_SPI3_CS_PIN      P6_3​
  1. Update “<MTB_Proj>\rt-thread\rtconfig.h” to add:
    #define RT_USING_HWTIMER
    #define RT_USING_I2C
    #define RT_USING_I2C_BITOPS
    #define RT_USING_WDT
    #define RT_USING_ADC
    #define RT_USING_DAC
    #define RT_USING_PWM
    #define RT_USING_SPI
    #define BSP_USING_I2C1
    #define BSP_USING_HW_I2C1
    #define BSP_USING_SPI3
    #define BSP_USING_ADC1​
  1. Delete “<MTB_Proj>\rt-thread\libraries\IFX_PSOC6_HAL\”.

  2. Delete folders inside “<MTB_Proj>\rt-thread\rt-thread\components\” except “rt-thread\rt-thread\components\drivers\” and “rt-thread\components\finsh\”.

  3. Replace “<MTB_Proj>\main.c” with “<RTT_Studio_Proj>\applications\main.c.

  4. Delete folders inside “<MTB_Proj>\rt-thread\rt-thread\libcpu\” except ”<MTB_Proj>\libcpu\arm\cortex-m4\” and ”<MTB_Proj>\libcpu\arm\common\”.

  5. Delete “<MTB_Proj>\rt-thread\rt-thread\libcpu\arm\common\divsi3.S”.

  6. Delete “<MTB_Proj>\rt-thread\rt-thread\libcpu\arm\cortex-m4\context_iar.S” and “<MTB_Proj>\rt-thread\rt-thread\libcpu\arm\cortex-m4\context_rvds.S”.

  7. Change include "cyhal_irq_psoc.h" with "cyhal_irq_impl.h" in “<MTB_Proj>\rt-thread\libraries\HAL_Drivers\drv_gpio.h”.

  8. Add csdadc and csdidac using MTB Library Manager.

  9. Remove include "cy_retarget_io.h" in “<MTB_Proj>\rt-thread\libraries\HAL_Drivers\drv_hwtimer.h”.

  10. Delete folders inside rt-thread\rt-thread\components\drivers\” except “hwtimer\”, “i2c\”, “include\”, “ipc\”, “misc\”, “serial\”, “spi\” and “watchdog\”.

  11. Remove warning by deleting a variable in ifx_pin_dettach_irq() on “<MTB_Proj>\rt-thread\libraries\HAL_Drivers\drv_gpio.c”.

  12. Remove warning by adding include “stdio.h” in “<MTB_Proj>\rt-thread\libraries\HAL_Drivers\drv_adc.c”.

  13. Delete “<MTB_Proj>\rt-thread\rt-thread\components\drivers\misc\pulse_encoder.c” and “<MTB_Proj>\rt-thread\rt-thread\components\drivers\misc\rt_inputcapture.c”.

  14. Delete <MTB_Proj>\rt-thread\rt-thread\components\drivers\serial\serial_v2.c”.

  15. Delete source and header files “enc28j60”, “spi_msd”, “spi_wifi_rw009” and “spi-bit-ops” under “<MTB_Proj>\rt-thread\rt-thread\components\drivers\spi\”.

  16. Delete “<MTB_Proj>\rt-thread\rt-thread\tools\”.

  17. Move #endif in “<MTB_Proj>\rt-thread\libraries\HAL_Drivers\drv_i2c.c” to after enum.

  18. Change #ifdef RT_USING_I2C to #ifdef RT_USING_SOFT_I2C in “<MTB_Proj>\rt-thread\libraries\HAL_Drivers\drv_soft_i2c.c”.

  19. Build (compile) and flash (program) in the MTB into CY8CPROTO-062-4343W.


After that, we will still see some warning in compilation.
But at least the RT-Thread can be programmed using MTB now.

If you have any concerns, please kindly inform. 🙂 

Thank you and regards,
Muhammad Nanda

0 Likes
MuhammadNanda_K
Moderator
Moderator
Moderator
250 sign-ins 250 replies posted 50 likes received

Hello JUTA_2823561,

May you kindly update your concern / status on this issue ?

Thank you and regards,
Muhammad Nanda

0 Likes
MuhammadNanda_K
Moderator
Moderator
Moderator
250 sign-ins 250 replies posted 50 likes received

Hello JUTA_2823561,

Please kindly update your status on this query.
Are you good with my explanation ?

Thank you and regards,
Muhammad Nanda

0 Likes
MuhammadNanda_K
Moderator
Moderator
Moderator
250 sign-ins 250 replies posted 50 likes received

Hello JUTA_2823561,

Please kindly inform if you are still wanted to discuss this query.
Besides, I will close this discussion thread in the following days. 

Thank you and regards,
Muhammad Nanda

0 Likes
JUTA_2823561
Level 4
Level 4
Distributor - Macnica (Japan)
25 replies posted 25 sign-ins 10 likes received

Hello Muhammad Nanda

Thankyu for your support.
Please set to close this discussion .Thank you and regards,
Junya tatsumi

0 Likes
MuhammadNanda_K
Moderator
Moderator
Moderator
250 sign-ins 250 replies posted 50 likes received

Hello Tatsumi-san,

Thanks for your acknowledgement.
Therefore, I will set one of replied answer as a solution then close this discussion.

If you have any other query in the future, please kindly do not hesitate to create new thread. 🙂

Thank you and regards,
Muhammad Nanda

0 Likes