FreeRTOS port for K12

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

FreeRTOS port for K12

Jump to solution
2,223 Views
Hab
Contributor III

Hello all, a few questions:

Does anyone have or know where I can find a freeRTOS port for the K12 processor using IAR?

If there is a K10 port, would it cover the K12?

Yes I have checked freeRTOS.org, the only thing I can find there is a K60 IAR port.

Specifically I am using the MK12DX256

Thanks,

Hab

Labels (1)
Tags (2)
0 Kudos
Reply
1 Solution
1,760 Views
BlackNight
NXP Employee
NXP Employee

Have you assigned the following three vectors in your vector table?

    DCD vPortSVCHandler ;SVC_Handler
    DCD 0
    DCD 0
    DCD vPortPendSVHandler; PendSV_Handler
    DCD vPortTickHandler; SysTick_Handler

(depends how you define your vector table, but you need to have above vectors set)

I hope this helps.

View solution in original post

0 Kudos
Reply
10 Replies
1,760 Views
BlackNight
NXP Employee
NXP Employee

You can use the KL25Z port, as the K12/K15 is the same core (Cortex M0+).

There is even a Processor Expert version of it:

http://mcuoneclipse.com/2013/01/31/tutorial-iar-freertos-freedom-board/

Additionally, that GitHub site has static (without Processor Expert) ports.

I hope this helps,

Erich

0 Kudos
Reply
1,760 Views
Hab
Contributor III

Much thanks for responding.  I am not sure I can use this because of the following concerns:

1. The K12 is an M4, the KL25 I belive is an M0.

2. The URL describes the need for 3 different software packages, IAR, PE driver suite, and additional PE components.  We require all firmware be written in IAR.

But since you mentioned an M0, freeRTOS does have a K60 IAR demo project.  The K60, like the K12 is an M4, but with more stuff.  Can I use that port?  If so, do you know if there anything I must do to the port to make it work for a K12 device?

Thanks,

Hab

0 Kudos
Reply
1,760 Views
BlackNight
NXP Employee
NXP Employee

Hi Hab,

yes, I realize that this is a M4, not an M0.

>>We require all firmware be written in IAR.

So IAR writes all your code? ;-) I guess you mean that your code is *compiled* with IAR. And this is the case for above case :-). IAR is still the tool you are using. And you can simply copy the code and place it into your project.

And yes, you could use that K60 port. Altough I think it might be somewhat outdated.

Or you could take the most recent port from

https://github.com/ErichStyger/mcuoneclipse/tree/master/Examples/FreeRTOS_Ports/IAR/FreeRTOS_FRDM-KL...

And then in the FreeRTOSconfig.h you change the core to M4. Should be very simple.

Erich

0 Kudos
Reply
1,760 Views
Hab
Contributor III

Any feedback on this?

Does this mean there is not a solution for Kinetis K1X on FreeRTOS?

0 Kudos
Reply
1,760 Views
BlackNight
NXP Employee
NXP Employee

I'm sorry, I missed your first reply. I see now your problem. Working on it right now.

0 Kudos
Reply
1,760 Views
BlackNight
NXP Employee
NXP Employee

Hello,

I have fixed the guilty portasm.s (attached), and it works now for me with IAR 6.50.

I have attached as well my project for the FRDM-K20D50M for reference.

This should solve the problem.

Otherwise, let me know.

1,760 Views
Hab
Contributor III

Much thanks for your patience and support.

The supplied portasm.s complied, but the scheduler crashes when I run.  vTaskStartScheduler() fails on a call to vPortStartFirstTask().  The processor fails on 2 vectors within vPortStartFirstTask():  Vector 11 on

line 199: svc 0

And the hard fault Vector 3

line 200: nop

To accomodate for the K12 (specificaly I am using the MK12DX256) I am making only 3 changes to the FreeRTOSConfig.h you supplied

line 93: #define configCPU_CLOCK_HZ                        50000000u // WAS 48MHz

line 94: #define configBUS_CLOCK_HZ                        50000000u // WAS 48MHz

line 172: #define configCPU_FAMILY                     configCPU_FAMILY_ARM_M4 // WAS configCPU_FAMILY_ARM_M0P

Help...

1,761 Views
BlackNight
NXP Employee
NXP Employee

Have you assigned the following three vectors in your vector table?

    DCD vPortSVCHandler ;SVC_Handler
    DCD 0
    DCD 0
    DCD vPortPendSVHandler; PendSV_Handler
    DCD vPortTickHandler; SysTick_Handler

(depends how you define your vector table, but you need to have above vectors set)

I hope this helps.

0 Kudos
Reply
1,760 Views
Hab
Contributor III

I added the 3 handlers to my IRQ Vector Table and the two simple tasks I created for testing started working.

Many, many thanks for your time and your help!!!

Next I will add a few ISR to ready tasks just to make sure all works as it should.  If I have any additional questions can I post to this thread or should I start a new?

0 Kudos
Reply
1,760 Views
Hab
Contributor III

Much thanks for responding.

I modified my project and added the FreeRTOS to my project from the link.  (First time using GitHub so that was an experience - painful).  I changed FreeRTOSconfig.h to use M4 core as suggested.

Defining the M4 core in FreeRTOSconfig.h causes the file portasm.s to require a definition for pxCurrentTCBConst and pxCurrentTCBConst2 which are undefined.  I searched the FreeRTOS directory and the project but could not find a definition for these - Help...

Thanks,

Hab

0 Kudos
Reply