Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Platform.h #177

Open
pamukcu09 opened this issue Aug 22, 2023 · 4 comments
Open

Platform.h #177

pamukcu09 opened this issue Aug 22, 2023 · 4 comments

Comments

@pamukcu09
Copy link

Hi @matth-x ,

I am trying to compile this project in STM32CubeIDE environment. However, I get a compilation error because it does not contain the arduino.h in the platform.h file. What should I define MOCPP_PLATFORM as?

@matth-x
Copy link
Owner

matth-x commented Aug 23, 2023

Hi @pamukcu09, the best start is MOCPP_PLATFORM=MOCPP_PLATFORM_UNIX. Probably you also need to add MOCPP_CUSTOM_TIMER which removes the dependency on the <chrono> library. Feedback about further compilation issues is highly appreciated.

@pamukcu09
Copy link
Author

pamukcu09 commented Aug 23, 2023

Thank you for your reply @matth-x

-I started with the definition MOCPP_PLATFORM=MOCPP_PLATFORM_UNIX and also defined MOCPP_CUSTOM_TIMER.

-Then I started getting the error that the dirent.h file is not supported.

https://github.com/armink/FreeModbus_Slave-Master-RTT-STM32/blob/master/RT-Thread-1.2.2/components/libc/newlib/sys/dirent.h
-I replaced the dirent.h file in the link with the file in the project, and I also included other dependencies in the library ( rtthread.h etc.)

-This way I got an error-free build in the STM32CUBEIDE environment. I have already integrated mongoose library and arduinoJson libraries before. I will try to connect to the OCPP server by integrating an ethernet connection as well.

@matth-x
Copy link
Owner

matth-x commented Aug 23, 2023

Thanks for sharing your results and congrats on the successful build! Would be curious about what's finally necessary for the full port. Can you imagine to add an MOCPP_PLATFORM_STM32 section to the Platform.h and create a PR?

Before running into trouble with the filesystem, you could deactivate it for the moment by adding MOCPP_USE_FILEAPI=DISABLE_FS. It's not super important for a proof of concept.

At runtime, the OCPP lib will also need the clock. It reads the clock using a callback function which is set using this function:

void mocpp_set_timer(unsigned long (*get_ms)());

get_ms needs to be a function which returns the milliseconds since start.

@pamukcu09
Copy link
Author

After making sure that I did everything right, it would be great to add the MOCPP_PLATFORM_STM32 section.
I will continue to try to establish the OCPP connection based on your suggestions . I will share the results with you. Thank you again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants