CODESYS - the IEC 61131-3 automation software
https://forum.codesys.com/

Semaphores on Linux target
https://forum.codesys.com/viewtopic.php?f=11&t=4887
Page 1 of 1

Author:  francois [ Wed May 02, 2012 1:12 pm ]
Post subject:  Semaphores on Linux target

Hi,

I need a way to use sems on my V3.4.2.0 arm-linux target.
Using SysSemProcess lib makes segmentation fault when attempting to start the runtime, I think the lib might not be implemented on Linux in my current runtime version.

Using SysSem, SysSemEnter or SysSemTry always return ERR_OK, no matter if the sem is locked or not!

Code:
IF pSemHandle^ = RTS_INVALID_HANDLE THEN
   pSemHandle^ := SysSemCreate(ADR(semCreateResult));
END_IF

semTryResult:=SysSemTry(pSemHandle^);
semEnterResult:=SysSemEnter(pSemHandle^);

pSemHandle is a pointer to a udint declared in a GVL.
Obviously I have more code that later releases the sem when not needed anymore, but my problem is that I cannot check if the resource is free or not!

I dont what to use SW FB for that because I want to make sure that the P and V functions will be "atomic".

Anyone had any luck with this lib on an arm-linux target?

Thanks!

Author:  kberlin [ Thu May 03, 2012 7:56 am ]
Post subject:  Re: Semaphores on Linux target

There is an old bug report CDS-7499 that just says "Linux: Semaphores are not working correctly". But I think it would be best if you contacted 3S support directly.

Best regards,
Kristian Berlin

Author:  Jay [ Mon May 07, 2012 8:19 am ]
Post subject:  Re: Semaphores on Linux target

Which Linux distro are you using? I noticed that Codesys (V. 3.4.x.x) Semaphores work if your Linux supports POSIX IPC Semaphores, but not with System V semaphores. Your Linux distro should support POSIX if you can find /dev/shm directory.

Author:  francois [ Wed May 09, 2012 4:06 pm ]
Post subject:  Re: Semaphores on Linux target

Interesting point, I am running linux-davinci, which support POSIX sems.
I compiled a small c application that uses semaphores.h and sem_init, wait, post, destroy to test on the target and it runs smoothly, so I gess I'll have to upgrade my runtime to make it works.

Anyway, thanks for your help!

Author:  sarathbabu [ Mon Sep 17, 2012 8:45 am ]
Post subject:  Re: Semaphores on Linux target

Hi

I would like to know whether codesys can be used for programming embedded controllers and can I know one example how it is done for this linux and one embedded application


Thanks

Author:  TimvH [ Mon Sep 17, 2012 9:18 pm ]
Post subject:  Re: Semaphores on Linux target

To use CoDeSys on your own embedded controller, you will need the CoDeSys Runtime Toolkit.
Together with 3S-Smart Software Solutions you can then implement and adapt the runtime to your hardware.
Please contact the sales team of 3S-Smart Software Solutions for further information.

Author:  sarathbabu [ Tue Sep 18, 2012 2:17 am ]
Post subject:  Re: Semaphores on Linux target

Thanks for the info.Can I you give me a link for any existing embedded controller using codesys.It will be helpful for me.

:)

Author:  TimvH [ Tue Sep 18, 2012 6:21 am ]
Post subject:  Re: Semaphores on Linux target

I don't understand exactly what you mean:
- If you want to buy an existing controller which can be programmed with CoDeSys you can go to the CoDeSys Device Directory and search http://www.3s-software.com/index.shtml? ... _directory
- If you want to build your own controller you could choose any platform. See http://www.3s-software.com/index.shtml?en_CoDeSysSP_OEM (click on Linux) to see the details and requirements.
I cannot advise you which platform is best.

Page 1 of 1 All times are UTC+01:00
Powered by phpBB® Forum Software © phpBB Limited
https://www.phpbb.com/