goToMain / libosdp

Implementation of IEC 60839-11-5 OSDP (Open Supervised Device Protocol); provides a C library with support for C++, Rust and Python3
https://libosdp.sidcha.dev
Apache License 2.0
134 stars 71 forks source link

Porting libosdp to FreeRTOS #40

Closed atandersson closed 3 years ago

atandersson commented 3 years ago

Would it be possible to port this library for using with FreeRTOS running on ARM MCU's? Some embedded solutions which are looking to start implementing OSDP today are running task schedulers like FreeRTOS on small ARM Cortex-M0/M3/M4 cores. I think it would be a nice feature to include an option/fork for building the library for these devices as well, especially the PD's which are most likely to run on cheaper MCU's.

patrick-compass commented 3 years ago

I'm currently trying to implement this library to operate a CP on a Maxim Cortex-M4. Any tips would be appreciated.

sidcha commented 3 years ago

Most of the platform dependent code is well abstracted, so you should be able to port libosdp to FreeRTOS with minimal effort. I have listed the things you need to do on the CP side, if you need to get the PD also working, similar methods exists for the PD too.

In src/osdp_cp.c:

In src/osdp_common.c:

Depending on the crypto library you are using, you can choose to use one of the files src/crypto/*.c, or you'd have to create a new file there if you are using some other exotic library. And in that new file:

Hopefully, I've mentioned everything needed to accomplish this task do let me know if I missed anything. I did the above steps (and some more) when porting this library to Zephyr RTOS; you can have a look at that implementation if you need inspiration. Be informed that the zephyr implementation is not yet updated to libosdp's master.

Lastly, if you do get everything to work, don't forget to send a PR this way :-).

Cheers!

sidcha commented 3 years ago

@patrick-compass confirmed (by email) that he is able to run LibOSDP on FreeRTOS after redefining some internal methods locally. Those symbols have been marked weak with commit: e3eb1fbd49c1bb189642c4230971232148e15bc8 (so it can be linked without any modification to the library).

Closing this issue.

laszlopataki commented 2 years ago

@sidcha The repo has quite changed since the last comment. Could you please give some updated tips for the porting? Thank you

sidcha commented 2 years ago

@laszlopataki, I reviewed the existing comment and found it to be valid, mostly. Where it didn't I have updated the comment instead of duplicating it. Can you please follow it and report issues you run into?