Developing HAL Components
01 Apr 2019 12:15 #130090
by inoxix
Developing HAL Components was created by inoxix
Hi,
I'm wondering if there are any best practices and strategies for developing HAL components. Code testing is a bit hard in the context of a RT thread. Is there any approach for unit testing of components?
Something like JUinit would be great that one can define the test cases together with the code.
Maybe this is already somewhere but I missed it.
Regards,
Tom
I'm wondering if there are any best practices and strategies for developing HAL components. Code testing is a bit hard in the context of a RT thread. Is there any approach for unit testing of components?
Something like JUinit would be great that one can define the test cases together with the code.
Maybe this is already somewhere but I missed it.
Regards,
Tom
Please Log in or Create an account to join the conversation.
01 Apr 2019 12:59 #130091
by pl7i92
Replied by pl7i92 on topic Developing HAL Components
most hal componets are made bye Users themself for special cases
the standard components are integreded and as so many uses them are testet all over
so what are you trying to get working
did you check the comps in the system
linuxcnc.org/docs/html/man/man9/
linuxcnc.org/docs/html/man/man1/
the standard components are integreded and as so many uses them are testet all over
so what are you trying to get working
did you check the comps in the system
linuxcnc.org/docs/html/man/man9/
linuxcnc.org/docs/html/man/man1/
Please Log in or Create an account to join the conversation.
02 Apr 2019 08:53 #130147
by inoxix
Replied by inoxix on topic Developing HAL Components
It's not my aim to re-test existing components. I want to test my own ones.
I now figured out how halstreamer and halsampler works for testing logic. I also saw how to test timing functions. But I still lock for a way to test the component with different parameters. I could create a (sub) test for each parameter combinations. This should work. Maybe there is a better way to do this.
I now figured out how halstreamer and halsampler works for testing logic. I also saw how to test timing functions. But I still lock for a way to test the component with different parameters. I could create a (sub) test for each parameter combinations. This should work. Maybe there is a better way to do this.
Please Log in or Create an account to join the conversation.
02 Apr 2019 12:09 #130151
by rodw
Replied by rodw on topic Developing HAL Components
Debugging Interrupt driven code is always hard. In the first instance, small components are easier to debug than complex ones. Studying your code critically before deployment is the next step. Building a sim config is also powerful.
Some behaviour is pretty easy to debug with halshow but for more complex real time stuff, Halscope is very useful as it shows what is going on in real time. Also there is a module called sim_pin which allows you to change data on the fly while debugging. The current docs are not leaping out at me so read this:
linuxcnc.org/docs/html/man/man1/sim_pin.1.html
So putting this together, I have one config originally written by Dewey Garrett that opens up several SIM-PIN windows and Halscope with prediefned variables which is quite an eyeopener
Some behaviour is pretty easy to debug with halshow but for more complex real time stuff, Halscope is very useful as it shows what is going on in real time. Also there is a module called sim_pin which allows you to change data on the fly while debugging. The current docs are not leaping out at me so read this:
linuxcnc.org/docs/html/man/man1/sim_pin.1.html
So putting this together, I have one config originally written by Dewey Garrett that opens up several SIM-PIN windows and Halscope with prediefned variables which is quite an eyeopener
Please Log in or Create an account to join the conversation.
03 Apr 2019 16:12 #130208
by andypugh
I just use a lot of "printf" statements to figure out what is going wrong.
If your component actually segfaults then you can try this:
github.com/LinuxCNC/linuxcnc/blob/master/docs/rtfaults.txt
I understand that it is possible, in principle, to use a debugger in realtime code with Uspace/preempt-rt but I have never tried it.
Replied by andypugh on topic Developing HAL Components
I'm wondering if there are any best practices and strategies for developing HAL components.
I just use a lot of "printf" statements to figure out what is going wrong.
If your component actually segfaults then you can try this:
github.com/LinuxCNC/linuxcnc/blob/master/docs/rtfaults.txt
I understand that it is possible, in principle, to use a debugger in realtime code with Uspace/preempt-rt but I have never tried it.
Please Log in or Create an account to join the conversation.
Time to create page: 0.070 seconds