cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC™ 5, 3 & 1

CaDu_3933941
New Contributor II

Hi all,

I am considering using FreeRTOS for my project. I will need this program to be hard real time.

My problem is, I do not know where to start. How do I port the FreeRTOS API onto PSoC Creator?

1 Solution
user_3716231
New Contributor II

You need to download source code of freertos and add them into your project.

1.add freertos path into your project:

step1.png

2.create freertos folders:

step2.png

3.add existing freertos files into folders:

step3.png

4.add these code in your project

extern void xPortPendSVHandler(void);

extern void xPortSysTickHandler(void);

extern void vPortSVCHandler(void);

#define CORTEX_INTERRUPT_BASE          (16)

void FreeRTOS_Start(){

  

    /* Handler for Cortex Supervisor Call (SVC, formerly SWI) - address 11 */

    CyIntSetSysVector( CORTEX_INTERRUPT_BASE + SVCall_IRQn,

        (cyisraddress)vPortSVCHandler );

  

    /* Handler for Cortex PendSV Call - address 14 */

CyIntSetSysVector( CORTEX_INTERRUPT_BASE + PendSV_IRQn,

        (cyisraddress)xPortPendSVHandler );  

  

    /* Handler for Cortex SYSTICK - address 15 */

CyIntSetSysVector( CORTEX_INTERRUPT_BASE + SysTick_IRQn,

        (cyisraddress)xPortSysTickHandler );

}

View solution in original post

0 Likes
2 Replies
user_3716231
New Contributor II

You need to download source code of freertos and add them into your project.

1.add freertos path into your project:

step1.png

2.create freertos folders:

step2.png

3.add existing freertos files into folders:

step3.png

4.add these code in your project

extern void xPortPendSVHandler(void);

extern void xPortSysTickHandler(void);

extern void vPortSVCHandler(void);

#define CORTEX_INTERRUPT_BASE          (16)

void FreeRTOS_Start(){

  

    /* Handler for Cortex Supervisor Call (SVC, formerly SWI) - address 11 */

    CyIntSetSysVector( CORTEX_INTERRUPT_BASE + SVCall_IRQn,

        (cyisraddress)vPortSVCHandler );

  

    /* Handler for Cortex PendSV Call - address 14 */

CyIntSetSysVector( CORTEX_INTERRUPT_BASE + PendSV_IRQn,

        (cyisraddress)xPortPendSVHandler );  

  

    /* Handler for Cortex SYSTICK - address 15 */

CyIntSetSysVector( CORTEX_INTERRUPT_BASE + SysTick_IRQn,

        (cyisraddress)xPortSysTickHandler );

}

View solution in original post

0 Likes
MotooTanaka
Esteemed Contributor

Hi,

Last time, when I ported an older version of FreeRTOS to PSoC4, it was not very easy.

So Today, I googled "FreeRTOS PSoC 5LP" and found the following nice site.

(It is in Japanese, though)

https://tshell.hatenablog.com/entry/2019/05/23/212250

So I followed the instruction in that site.

(1) Download FreeRTOS from

FreeRTOS - Free RTOS Source Code Downloads, the official FreeRTOS zip file release download

I clicked the Green Button in the FreeRTOS box.

000-FreeRTOS-site.JPG

(2) Expanded the downloaded "FreeRTOSv10.4.1.zip"

    Folder "FreeRTOSv10.4.1" was created.

(3) In the Folder I digged int "FreeRTOS"

001-FreeRTOSv10_4_1.JPG

(4) I found "CORTEX_CY8C5888_PSoC_Creator_GCC" in FreeRTOSv10.4.1\FreeRTOS\Demo

002-FreeRTOS_Demo.JPG

(5) I double clicked the workspace

003-CORTEX_CY8C5888_PSoC_Creator_GCC.JPG

(6) Warning about the device used was obsoleted, proceeded by selecting "OK"

004-Obsolete_Device_Warning.JPG

(7) In the PSoC Creator, I selected "Device Selector..."

005-Device-Selector.JPG

(8) I selected CY8C5888LTI-LP097 for my CY8CKIT-059

006-select-097.JPG

(9) In the schematic, I see a lots of outdated components

007-schematic-01.JPG

(10) I selected "Update Components..."

008-Update_components.JPG

(11) Components were updated, and the schematic seems to be sane.

009-schematic-updated.JPG

(12) Pins

I only specifed

Rx_1: P12[6]

Tx_1: P12[7]

Pin_LED_0: P2[1]

Startup_Release_Switch: P2[2]

And left the rest as not "unlocked"

010-Pins.JPG

(13) Tera Term Log

After compiled and started the debugger, Serial port (57600) showed the following.

And according the the site referenced, this is the expected output.

011-TeraTerm-log.JPG

So the good news is porting or getting a version of FreeRTOS to 5LP was not as difficult as I was afraid of.

And the bad (or reasonable) news is that you need to learn the manner of using this RTOS to command it for your purpose.

moto

0 Likes