open62541/arch
2023-07-28 21:42:56 +02:00
..
common refactor(core): Remove unused architecture_functions.h 2023-06-22 01:06:21 +02:00
eCos refactor(core): Use mp_printf everywhere 2023-07-28 21:42:56 +02:00
freertosLWIP refactor(core): Remove unused architecture_functions.h 2023-06-22 01:06:21 +02:00
posix refactor(core): Use mp_printf everywhere 2023-07-28 21:42:56 +02:00
vxworks refactor(core): Use mp_printf everywhere 2023-07-28 21:42:56 +02:00
wec7 refactor(core): Use mp_printf everywhere 2023-07-28 21:42:56 +02:00
win32 refactor(core): Use mp_printf everywhere 2023-07-28 21:42:56 +02:00
CMakeLists.txt fixes compile error of network_tcp.c when open is added as cmake subdirectory 2020-02-27 00:27:24 +01:00
eventloop_common.c feat(el): Improve logging for the parameter validation 2022-12-19 16:53:04 +01:00
eventloop_common.h feat(el): Improve logging for the parameter validation 2022-12-19 16:53:04 +01:00
eventloop_mqtt.c refactor(core): Move architecture-specific definition out of the public headers 2023-07-28 21:42:56 +02:00
eventloop_posix_epoll.c refactor(el): Finalize locking within the EventLoop 2023-03-10 07:37:34 +01:00
eventloop_posix_eth.c refactor(core): Use mp_printf everywhere 2023-07-28 21:42:56 +02:00
eventloop_posix_interrupt.c refactor(el): Finalize locking within the EventLoop 2023-03-10 07:37:34 +01:00
eventloop_posix_select.c fix(arch): Fix issues with eventloop mutex (#5869) 2023-07-12 10:19:12 +02:00
eventloop_posix_tcp.c refactor(core): Use mp_printf everywhere 2023-07-28 21:42:56 +02:00
eventloop_posix_udp.c refactor(core): Use mp_printf everywhere 2023-07-28 21:42:56 +02:00
eventloop_posix.c fix(arch): Fix issues with eventloop mutex (#5869) 2023-07-12 10:19:12 +02:00
eventloop_posix.h refactor(core): Use mp_printf everywhere 2023-07-28 21:42:56 +02:00
Readme.md refactor(core): Remove unused architecture_functions.h 2023-06-22 01:06:21 +02:00

open62541 Architectures

The arch folder contains all the architecture-specific code for a given operating system.

The list of supported architectures is also available as a CMake option.

Adding new architectures

To port to a new architecture you should follow these steps:

  1. Create a folder with your architecture, let's call it new_arch

  2. In the CMakeLists.txt file located next to this file, add add_subdirectory(new_arch) at the end of it

  3. Create a CMakeLists.txt file in the new_arch folder

  4. Use the following template for it (remember that when you see new_arch you should replace with the name of your architecture)

    # ---------------------------------------------------
    # ---- Beginning of the CMakeLists.txt template -----
    # ---------------------------------------------------
    
    SET(SOURCE_GROUP ${SOURCE_GROUP}\\new_arch)
    
    ua_add_architecture("new_arch")
    
    if("${UA_ARCHITECTURE}" STREQUAL "new_arch")
    
        ua_include_directories(${CMAKE_CURRENT_SOURCE_DIR})
        ua_add_architecture_file(${CMAKE_CURRENT_SOURCE_DIR}/ua_clock.c)
    
        #
        # Add here below all the things that are specific for your architecture
        #
    
        #You can use the following available CMake functions:
    
        #ua_include_directories() include some directories specific to your architecture when compiling the open62541 stack
        #ua_architecture_remove_definitions() remove compiler flags from the general ../../CMakeLists.txt file that won't work with your architecture
        #ua_architecture_add_definitions() add compiler flags that your architecture needs
        #ua_architecture_append_to_library() add libraries to be linked to the open62541 that are needed by your architecture
        #ua_add_architecture_header() add header files to compilation (Don't add the file ua_architecture.h)
        #ua_add_architecture_file() add .c files to compilation    
    
    endif()
    
    # ---------------------------------------------------
    # ---- End of the CMakeLists.txt template -----
    # ---------------------------------------------------
    
  5. Create a ua_clock.c file that implements the following functions defined in open62541/types.h:

    • UA_DateTime UA_DateTime_now(void);

    • UA_Int64 UA_DateTime_localTimeUtcOffset(void);

    • UA_DateTime UA_DateTime_nowMonotonic(void);

  6. Create a file in the folder new_arch called ua_architecture.h

  7. Use the following template for it:

    • Change YEAR, YOUR_NAME and YOUR_COMPANY in the header

    • Change NEW_ARCH at the beginning in PLUGINS_ARCH_NEW_ARCH_UA_ARCHITECTURE_H_ for your own name in uppercase

    /* This work is licensed under a Creative Commons CCZero 1.0 Universal License.
     * See http://creativecommons.org/publicdomain/zero/1.0/ for more information.
     *
     *    Copyright YEAR (c) YOUR_NAME, YOUR_COMPANY
     */
    
    #ifndef PLUGINS_ARCH_NEW_ARCH_UA_ARCHITECTURE_H_
    #define PLUGINS_ARCH_NEW_ARCH_UA_ARCHITECTURE_H_
    
    /*
     * Define and include all that's needed for your architecture
     */
    
    #endif /* PLUGINS_ARCH_NEW_ARCH_UA_ARCHITECTURE_H_ */