This is a modular and scalable open‑source Adaptive AUTOSAR demo using CXX_STANDARD 17. The project leverages CMake for build configuration, enabling straightforward integration, testing, d future expansion.
- Key Features
- Repository Structure
- Components Overview
- Tests Overview
- Prerequisites
- Building the Project
- Build Targets
- Testing the Project
- Running the Examples
- Advanced Configuration
- Troubleshooting
- Contributing
- License
- Modular Architecture: Easily add or remove components as needed.
- Scalable Design: Suitable for both small-scale applications and large automotive systems.
- Comprehensive Testing: Extensive tests ensure reliability and correctness, including oss‑translation unit sharing.
- Cross‑Platform Support: Build and run on both Linux and QNX with various architectures.
- Modern CXX_STANDARD 17 Implementation: Leverages inline variables, constexpr where possible, and robust error handling and others.
The repository is organized as follows:
.
├── CMake // CMake configuration and toolchain files
├── components // Source code for components:
│ ├── open-aa-std-adaptive-autosar-libs // Core Adaptive AUTOSAR libraries (e.g., array, abort)
│ ├── open-aa-platform-os-abstraction-libs // OS abstraction layers for Linux and QNX
│ └── open-aa-example-apps // Example applications demonstrating library usage
├── open-aa-tests // Test applications for core platform components
├── build.sh // Build script
├── CMakeLists.txt // Top-level CMake configuration
├── LICENSE
└── README.md
Provides OS abstraction layers to facilitate cross‑platform development.
- Interface Layer: Abstract interfaces for process management (e.g.,
process_factory.h
, process_interaction.h`). - Linux Implementation: Concrete implementations for Linux (
process.cpp
under the Linux folder). - QNX Implementation: Concrete implementations for QNX (
process.cpp
under the QNX folder).
Contains core utilities and internal mechanisms essential for Adaptive AUTOSAR:
- ara::core::Array: A fixed‑size array container with enhanced functionality.
- ara::core::Abort: API for explicitly aborting operations when violations occur.
- Internal Utilities: Helpers for location handling and violation management (e.g.,
location_utils.,
violation_handler.h`).
Demonstrates how to use the Adaptive AUTOSAR libraries via sample applications.
- demo/app: A sample application illustrating integration through a
demo_manager
.
The open-aa-tests
directory contains test applications for the core platform:
- core_platform tests: Validate components such as
ara::core::Array
andara::core::Abort
. - The tests include both positive scenarios and negative (compile‑time or runtime) tests (the latter are commented out).
Operating System: Linux (tested on Ubuntu 22.04) or QNX.
C++ Compiler:
- GCC: Version 11.x.x or later smaller versions (for Linux builds)
- QNX QCC: Version 12 (for QNX builds)
CMake: Version 3.27 or later
Bash and GNU Make: For building targets.
sudo apt-get update
sudo apt-get install -y software-properties-common lsb-release
sudo apt-get remove --purge cmake
sudo apt-get install -y apt-transport-https ca-certificates gnupg software-properties-common wget
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc | sudo apt-key add -
sudo apt-add-repository 'deb https://apt.kitware.com/ubuntu/ focal main'
sudo apt-get update
sudo apt-get install cmake
sudo apt-get install -y build-essential cmake gcc-11 g++-11
Follow QNX's official documentation to install the QNX Software Development Platform.
The project is built using CMake and the provided build.sh
script.
./build.sh [OPTIONS]
-h, --help
: Show help message and exit.-c, --clean
: Remove existing build and install directories.-t, --build-type
: Build type (Debug
orRelease
). Default:Release
.-b, --build-target
: Build target (e.g.,gcc11_linux_x86_64
,gcc11_linux_aarch64
, cc12_qnx800_aarch64,
qcc12_qnx800_x86_64`).-s, --sdp-path
: Path toqnxsdp-env.sh
for QNX builds.-j, --jobs
: Number of parallel jobs.-e, --exception-safety
: Choose exception safety mode:conditional
(default): DefinesARA_CORE_ARRAY_ENABLE_CONDITIONAL_EXCEPTIONS
safe
: Does not define the macro (safe mode)
1. Clean and Build for GCC 11 Linux x86_64 (Release):
./build.sh --clean -b gcc11_linux_x86_64 -t Release -j 8
2. Build for QNX aarch64 (Debug) with safe exception mode:
./build.sh -b qcc12_qnx800_aarch64 -t Debug -s /path/to/qnxsdp-env.sh -e safe -j 4
3. Build for GCC 11 Linux aarch64 (Release) with conditional exceptions:
./build.sh --clean -b gcc11_linux_aarch64 -t Release -e conditional
Build Target | Compiler | Platform | Architecture | Build Types |
---|---|---|---|---|
gcc11_linux_x86_64 |
GCC 11 | Linux | x86_64 | Debug/Release |
gcc11_linux_aarch64 |
GCC 11 | Linux | aarch64le | Debug/Release |
qcc12_qnx800_aarch64 |
QCC 12 | QNX | aarch64le | Debug/Release |
qcc12_qnx800_x86_64 |
QCC 12 | QNX | x86_64 | Debug/Release |
Note: “Debug” or “Release” is appended internally based on the build type.
After building, test executables are located in:
cd install/<build-target>/
./platform_core_test/core_array_test/bin/core_array_test [OPTION]
./platform_core_test/core_abort_test/bin/core_abort_test [OPTION]
The repository includes comprehensive tests for core platform components. In particular, the
ara::core::Array
test suite (located in tests/core_platform/ara_core_array_test
) covers a wide range
of scenarios to ensure reliability and correctness. The test executable accepts a test number as a
command-line argument to run specific tests:
- 1: Element Access and Iterators
Tests both checked access viaat()
and unchecked access usingoperator[]
, as well as forward iteration. - 2: get() Functionality
Validates the compile-time and runtime behavior of the helper functionget<I>()
. - 3: Swap and Fill
Verifies that arrays can be swapped correctly and that thefill()
method assigns the specified value to all elements. Includes constexpr tests. - 4: Comparison Operators
Checks equality (==
), inequality (!=
), and lexicographical comparisons (<
,<=
,>
,>=
). - 5: Usage with User-Defined Class
Demonstrates array usage with a custom class (SafeTestClass
) that implements copy/move semantics. - 6: Usage with User-Defined Struct
Tests array behavior using a custom struct (SafeTestStruct
). - 7: Copy and Move Semantics
Validates correct behavior of copy and move constructors and assignments. - 8: Const Correctness
Ensures that const arrays support proper element access and iteration, with compile-time checks. - 9: Violation Handling (Out-of-Range)
Confirms that accessing an out-of-range index viaat()
triggers a violation and terminates the process. - 10: Zero-Sized Arrays
Checks that zero-sized arrays behave correctly (e.g.,size()
,empty()
, anddata()
return expected results). - 11: Reverse Iterators
Tests reverse iteration capabilities usingrbegin()
,rend()
,crbegin()
, andcrend()
. - 12: Partial Initialization
Verifies that arrays can be partially initialized, with unspecified elements defaulting as expected. - 13: Negative Scenarios
Contains (commented-out) tests demonstrating expected compile-time or run-time errors when misusing the API. - 14: Two-Dimensional Arrays
Demonstrates usage of nested arrays and validates operations on multi-dimensional arrays.
To run the array tests, navigate to the corresponding test executable (e.g., ara_core_array_test
)
in the install directory and pass the desired test number as a command-line argument.
The test executable ara_core_abort_test
accepts a test number as a command-line argument:
- 1: Inline tests (e.g., AddAbortHandler, SetAbortHandler)
- 2: Cross‑Translation Unit Sharing test (set handler from another file)
- 3: Termination test (calls Abort() and terminates the process)
The open-aa-example-apps component contains demo applications to illustrate library usage.
- Build the project:
./build.sh --clean -b gcc11_linux_x86_64 -t Release
- Navigate to the installed directory for your target:
cd install/<build-target>/adaptive_platform/opt/demo_app/bin
- Run the demo application:
./demo_app
- Create a new CMake configuration file in
CMake/CMakeConfig/
(for example, by copying an existing one). - Define the new target in the build script (
build.sh
) and the ToolChain Folder. - Update
CMakePresets.json
with a new preset for the target.
- Add a new component directory under
components/
. - Create a CMakeLists.txt file for the component with the required includes, sources, and dependencies.
- Integrate the component in the root CMakeLists.txt using
add_subdirectory()
.
-
CMake Not Found
- Error:
cmake: command not found
- Solution: Install CMake and ensure it’s in your PATH:
cmake --version
- Error:
-
QNX Environment Variables Not Set
- Error:
Error: QNX_HOST and QNX_TARGET environment variables must be set.
- Solution: Source
qnxsdp-env.sh
or specify the path via the-s
option.
- Error:
-
Toolchain File Not Found
- Error:
Error: Toolchain file not found: ...
- Solution: Verify the file exists in
CMake/CMakeConfig/
and that your build target is correct.
- Error:
-
Compilation Errors
- Cause: Mismatched compiler versions or missing dependencies.
- Solution: Use the correct compiler and install any missing dependencies.
Contributions are welcome! Follow these steps:
- Fork the Repository.
- Create a Feature Branch:
git checkout -b feature/my-new-feature
- Commit Your Changes with clear messages.
- Push to Your Fork:
git push origin feature/my-new-feature
- Open a Pull Request targeting the
master_integration
branch.
This project is licensed under the MIT License. See the LICENSE file for details.
Thank you for using and contributing to OpenAA: Adaptive AUTOSAR CXX_STANDARD 17 Project! For more information, visit the GitHub repository.