How to add the FreeRTOS in simulink for S32K

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

How to add the FreeRTOS in simulink for S32K

7,295 次查看
eautopower
Contributor IV

How to add the FreeRTOS in simulink for S32K? There is no FreeRTOS block in the toolbox.

10 回复数

5,893 次查看
Daniel_Popa
NXP Employee
NXP Employee

Hi eautopower‌,

Indeed there is not special block for FreeRTOS. Can you explain us what are you trying to achieve ?

Depending on your feedback we may suggests some approaches.

So, you wish to have a block that configures the FreeRTOS ? If so, what type of configuration are you looking for?

Or, 

You wish to insert/inject automatic C code generated from Simulink into specific FreeRTOS tasks ?

Looking forward to hearing from you soon!

Best regards,
Daniel!

0 项奖励
回复

3,451 次查看
wjandsq
Contributor IV
希望MATLAB Simulink 生成的C代码,能通过NXP Toolbox 输出为工程文件(Project),C代码归类到不同的文件夹。可以直接打开工程文件(Project),并且能象S32 Design Studio for ARM 2.2一样,可以定制FreeRTOS组件,并进行任务调度。
0 项奖励
回复

5,893 次查看
eautopower
Contributor IV

Hi Daniel:

   I mean how to achieve task scheduling in simulink?because I am unfamiliar with the simulimk about  task scheduling,but i know, this can be done in simulink, So i wan to know that how to achieve task scheduling like FreeRTOS,or if  you have some ways ,pls tell me.

  thank you very much!

Best regards,

xie

0 项奖励
回复

5,893 次查看
jfrey
Contributor IV

You need to create .tlc files for RTW so it knows how to build for FreeRTOS. 

I made a ChibiOS/RT (Another RTOS) blockset a few years ago: GitHub - jed-frey/ChibiOS_SimulinkBlockset: ChibiOS Blockset 

In particular look at ChibiOS_SimulinkBlockset/chibiOS_customRoutineProcess.tlc. It shows how to start a Thread based on Simulink task rates. 

I am currently working on just this, a set of FreeRTOS blocksets for the inexpensive MPC57xx devkits. However it is not near completion at this time.

4,408 次查看
ahmetsaglam
Contributor I

Hello

Is there any improvement in this regard? (rtos)

Br, 

0 项奖励
回复

5,893 次查看
eautopower
Contributor IV

Hi Jed:

   Check this model for me. What's wrong with it?

CAN  warning interrupt cannot enter

thank you!~

0 项奖励
回复

5,893 次查看
Daniel_Popa
NXP Employee
NXP Employee

Hi Xie,

I see that you have a triggered system that is supposed to sent the CAN messages. I guess you can't sent those messages out right ?

This is how i would approach the problem:

- step 1: use  a simple program to sent a CAN message based on a time interrupt and verify with a CAN viewer that i can receive the messages. This will validate the basic CAN configuration and CAN network

- step 2: using S32 Design Studio, i would try to attach to the running target (without reset) when the real application is running but not transmitting CAN. This way you can suspend the processor execution and check where the PC is. Then please a breakpoint in the task you are supposed to sent the CAN messages and check is you ever enter into that or not.

In general the S32 Design Studio or any other IDE supporting that processor you are using is the only way to debug the application

Hope this will inspire you!

Best regards,
Daniel

0 项奖励
回复

5,893 次查看
eautopower
Contributor IV

Dnaiel:

 thank you very much,i will try to do.

0 项奖励
回复

5,893 次查看
Daniel_Popa
NXP Employee
NXP Employee

Hi Xie, 

Sorry for delay - i had to do some research. Unfortunately,i could not find any relevant information on this matter.

Still i think that with a bit of persuade it can be done using Stateflow logic to implement the scheduler and a combination of custom code injection to call/initialize/reset and terminate Simulink blocks.

The scheduler can easily implemented using the Stateflow like in these examples: Schedule Execution of Simulink Subsystems - MATLAB & Simulink 

e.g.: time based scheduller

 

Then within each subsystem you could use S-function block to call a specific RTOS Tasks using this type of approach: https://community.nxp.com/thread/450605 

Hope this helps!

Daniel

5,893 次查看
eautopower
Contributor IV

Daniel:

thank you!~

0 项奖励
回复