The Anybus CompactCom Driver is the capable and flexible foundation for your CompactCom host application.
For a simpler API, visit abcc-driver-api.
It's suggested to add the repository as a submodule in your projects lib/ folder.
git submodule add https://github.com/hms-networks/abcc-driver.git lib/abcc-driver
This repository already contains another "nested" submodule (abcc-abp/) that must be initialized. Therefore, go to the path of abcc-driver/ and initialize abcc-abp/.
cd lib/abcc-driver
git submodule update --init --recursive
Go back to your git repository and stage the new submodules, otherwise they will only be linked locally on your machine.
cd ../../
git add .gitmodules lib/abcc-driver
This repository contains a submodule (abcc-abp/) that must be initialized. Therefore, pass the flag --recurse-submodules when cloning.
It's suggested to clone the repository into your projects lib/ folder.
git clone --recurse-submodules https://github.com/hms-networks/abcc-driver.git lib/abcc-driver
If you did not pass the flag --recurse-submodules when cloning, the following command can be run:
git submodule update --init --recursive
The Anybus CompactCom Driver shall always be configured by a file called abcc_driver_config.h, created by you, custom to your project. The file shall contain macro definitions to enable, disable, and set values of different features and funtionalities.
This repository can be included as a library into a CMake target by adding a few sections to your CMakeLists.txt file.
- Add your file abcc_hardware_abstraction.c to your target.
target_sources(<your_target> PRIVATE <"path/to/abcc_hardware_abstraction.c">)
- Create a variable called
ABCC_DRIVER_INCLUDE_DIRSwith directories containing your personal include (.h) files related to the CompactCom Driver, such as abcc_driver_config.h.
set(ABCC_DRIVER_INCLUDE_DIRS
<${PROJECT_SOURCE_DIR}/path/to/include_directory>
<...>
)
- Create a variable called
ABCC_DRIVER_DIRwith the path to the directory where the CompactCom Driver repository was cloned.
set(ABCC_DRIVER_DIR <"${PROJECT_SOURCE_DIR}/path/to/abcc-driver">)
- Includes the standard CMake file from the CompactCom Driver.
include(${ABCC_DRIVER_DIR}/abcc-driver.cmake)
- Add directories containing include (.h) files related to the CompactCom Driver to your target.
target_include_directories(host_application_exec PRIVATE ${ABCC_DRIVER_INCLUDE_DIRS})
- Add the CompactCom Driver library to the user host application executable target.
target_link_libraries(<your_target> abcc_driver)
This repository's Makefile, abcc-driver.mk, can be included into a Make target by adding a few sections to your higher level Makefile.
- Create
SRCS, add your source files to it (optional), and create object files from the content ofSRCS.
SRCS = ./src/main.c
SRCS += ./src/abcc_adaptation/abcc_hardware_abstraction.c
...
- Create
INCLUDES, add your include paths to it (optional), and append the content as compiler flags when compiling. Make sure to include the folder containing abcc_driver_config.h somehow, even if it's not inINCLUDESspecifically..
INCLUDES = -I./src
INCLUDES = -I./src/abcc_adaptation
...
- Create
ABCC_DRIVER_DIRcontaining the path to the Anybus CompactCom Driver directory.
ABCC_DRIVER_DIR := ./path/to/abcc-driver
- Include abcc-driver.mk.
include $(ABCC_DRIVER_DIR)/abcc-driver.mk
The CompactCom Driver should now compile together with your target!