CW files

Discussions and support about ChibiOS/RT, the free embedded RTOS.
louis
Posts: 23
Joined: Tue May 17, 2016 9:26 am

CW files

Postby louis » Thu Jun 30, 2016 10:17 am

Hello,

I am porting ChibiOS/RT on my project using CW. But I encore difficulties with the integration of files from "rt/port/compiler/CW".
You could find enclosed my project-zip (some private files had been deleted). The chibiOS code source are in "/source/BSP/CORE/ChibiOS_rt" part.

In cpu_drv (/source/BSP/CORE/cpu_drv), you could find the interrupt vectors. We use IVOR4, 10 and 11.
In runtime ressources (/runtimeressources), there is startup file.

According to my project, what should I do in order to integrate CW files from ChibiOS with my own runtime ressources? (Because actually there is two declarations of IVOR)

I know this question is really generic. But I am lost with this integration :( . Then your help is welcome :|

Louis
Attachments
SPU4026_SW_APP_HW_Test_All-In-One_ChibiOSRT_ .zip
(2.31 MiB) Downloaded 89 times

User avatar
Giovanni
Site Admin
Posts: 13012
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 744 times
Been thanked: 620 times
Contact:

Re: CW files

Postby Giovanni » Thu Jun 30, 2016 10:40 am

Hi,

ChibiOS needs to use the IVOR4 vector by itself because scheduling requirements. Note that the ChibiOS IVOR4 handler performs calls to the kernel in order to achieve this. This is required because after servicing an ISR a check must be performed to see if a reschedule is required and eventually reschedule. Calls to statistics and debug modules are also required.

IVOR10 is used (if present) for system tick but any timer ISR can be used for that.

It would be much easier if you just use startup files and vectors table provided with ChibiOS. And only include your code starting from the main() function.

If you need to use your startup files then make your IVOR4 handler do exactly the same things done in ChibiOS one. In this scenario you need to remove all .s files from ChibiOS except chcoreasm.s. Startup, vectors, exceptions would be handled by you.

Just a note, in ChibiOS 4.0 (currently in repository only) startup files have been separated from the port layer so it is much easier to understand what you need to integrate. You may want to give a look to the new organization.

Giovanni

louis
Posts: 23
Joined: Tue May 17, 2016 9:26 am

Re: CW files

Postby louis » Fri Jul 01, 2016 9:52 am

Hello,

Thank you Giovanni for this instructive answer.
Then, my handler for IVOR4 should do exactly the same than yours in ivor.s, isn't it?

For the startup file, should I do also exactly the same as you do?

Louis

User avatar
Giovanni
Site Admin
Posts: 13012
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 744 times
Been thanked: 620 times
Contact:

Re: CW files

Postby Giovanni » Fri Jul 01, 2016 11:14 am

Not necessarily like we do, the only critical one is IVOR4.

The easy path is to use our startup files but it is not mandatory.

Giovanni

louis
Posts: 23
Joined: Tue May 17, 2016 9:26 am

Re: CW files

Postby louis » Fri Jul 08, 2016 11:19 am

hi Giovanni,

Thank you for your answer. I succeeded to port your ChibiOS/RT.
Now, I am creating a task (flashing led). But the problem is that the task is executed only 1 time.
I initialize the ChibiOS in my main(), and I create my thread. After I enter in the main loop (the main loop is also executed 1 time when I debbug).
I don't find the origin of this problem (I followed the tutoriel of Creation of Task on your website).

Attached, you have my main function, my thread, and my main init.

Thank for your help.

Louis
Attachments
Task_flashingLed.PNG
main.PNG
init_ChibiOS+IVOR.PNG
init_ChibiOS+IVOR.PNG (8.36 KiB) Viewed 2123 times

User avatar
Giovanni
Site Admin
Posts: 13012
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 744 times
Been thanked: 620 times
Contact:

Re: CW files

Postby Giovanni » Fri Jul 08, 2016 5:54 pm

Hi,

Do you mean that the task never exits chThdSleepMilliseconds() ? this could be caused by a problem with system tick.

Giovanni

louis
Posts: 23
Joined: Tue May 17, 2016 9:26 am

Re: CW files

Postby louis » Mon Jul 11, 2016 9:12 am

Hi,

Yes exactly, I don't exit chThdSleepMilliseconds(). But when I debug, the tick handler (chSysTimerHandlerI) is called. Then, do you know which kind of problems (on the tick) can be the origin of this problem?

Louis

User avatar
Giovanni
Site Admin
Posts: 13012
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 744 times
Been thanked: 620 times
Contact:

Re: CW files

Postby Giovanni » Mon Jul 11, 2016 9:25 am

Hi,

Possible problems on top of my mind:

1) The system tick is called once and then stops.
2) It is much slower than expected.
3) The preemption code (IVOR4 and IVO10 if decrementer is used) is not working as expected, it is the most critical part of a port.

Giovanni

louis
Posts: 23
Joined: Tue May 17, 2016 9:26 am

Re: CW files

Postby louis » Mon Jul 11, 2016 3:42 pm

Thank Giovanni,

I forget to tell you that I desactivated the IVOR (PPC_SUPPORTS_IVORS & PPC_SUPPORTS_DECREMENTER = FALSE) because it was alrealdy handled by my CPU driver. The tick handler (chSysTimerHandlerI() from IVOR10) is normally called.
So the fact to desactivate the IVOR on your ChibiOS will have an impact on the chThdSleepMilliseconds() function?
Otherwhise, what does this function do?

Louis

User avatar
Giovanni
Site Admin
Posts: 13012
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 744 times
Been thanked: 620 times
Contact:

Re: CW files

Postby Giovanni » Mon Jul 11, 2016 3:45 pm

Hi,

Look at the IVOR4/IVOR10 implementations, there are calls to the OS in there.

Giovanni


Return to “ChibiOS/RT”

Who is online

Users browsing this forum: No registered users and 5 guests