opc source code
This commit is contained in:
21
third_party/open62541/tools/azure-devops/debian/build.sh
vendored
Normal file
21
third_party/open62541/tools/azure-devops/debian/build.sh
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
#DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||
#BASE_DIR="$( realpath "$DIR/../../../" )"
|
||||
|
||||
echo -e "== Building the Debian package =="
|
||||
/usr/bin/python3 ./tools/prepare_packaging.py
|
||||
echo -e "--- New debian changelog content ---"
|
||||
echo "--------------------------------------"
|
||||
cat ./debian/changelog
|
||||
echo "--------------------------------------"
|
||||
#dpkg-buildpackage -b
|
||||
|
||||
echo "Test file1" > ../libopen62541_dev.deb
|
||||
echo "Test file2" > ../libopen62541_tools.deb
|
||||
|
||||
if [ $? -ne 0 ] ; then exit 1 ; fi
|
||||
|
||||
echo "Copying .deb files to $BUILD_ARTIFACTSTAGINGDIRECTORY"
|
||||
cp ../libopen62541*.deb $BUILD_ARTIFACTSTAGINGDIRECTORY
|
||||
33
third_party/open62541/tools/azure-devops/debian/install.sh
vendored
Normal file
33
third_party/open62541/tools/azure-devops/debian/install.sh
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
sudo apt-get update
|
||||
sudo apt install -y \
|
||||
check \
|
||||
cmake \
|
||||
debhelper \
|
||||
fakeroot \
|
||||
git \
|
||||
graphviz \
|
||||
latexmk \
|
||||
libsubunit-dev \
|
||||
python3-sphinx \
|
||||
python3-pip \
|
||||
tar \
|
||||
texlive-fonts-recommended \
|
||||
texlive-extra-utils \
|
||||
texlive-latex-extra \
|
||||
wget
|
||||
|
||||
wget https://github.com/ARMmbed/mbedtls/archive/mbedtls-2.28.2.tar.gz
|
||||
tar xf mbedtls-2.28.2.tar.gz
|
||||
cd mbedtls-mbedtls-2.28.2
|
||||
cmake -DENABLE_TESTING=Off .
|
||||
make -j
|
||||
sudo make install
|
||||
|
||||
# Pin docutils to version smaller 0.15. Otherwise we run into https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=839299
|
||||
pip install --user 'docutils<=0.14'
|
||||
pip install --user sphinx_rtd_theme
|
||||
pip install --user cpplint
|
||||
25
third_party/open62541/tools/azure-devops/freeRTOS/CMakeLists.txt
vendored
Normal file
25
third_party/open62541/tools/azure-devops/freeRTOS/CMakeLists.txt
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/../../../ ${CMAKE_BINARY_DIR}/lib)
|
||||
|
||||
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
||||
|
||||
get_target_property(OPEN62541_SOURCES open62541-object SOURCES)
|
||||
get_target_property(OPEN62541_INCLUDES open62541-object INCLUDE_DIRECTORIES)
|
||||
|
||||
# Create an open62541 component for ESP IDF
|
||||
set(open62541_component_dir ${CMAKE_CURRENT_LIST_DIR}/components/open62541-lib)
|
||||
file(MAKE_DIRECTORY ${open62541_component_dir})
|
||||
file(WRITE ${open62541_component_dir}/CMakeLists.txt "
|
||||
set(COMPONENT_SRCS ${OPEN62541_SOURCES})
|
||||
set(COMPONENT_ADD_INCLUDEDIRS ${OPEN62541_INCLUDES})
|
||||
set(COMPONENT_REQUIRES lwip mbedtls freertos)
|
||||
register_component()
|
||||
")
|
||||
|
||||
add_definitions(-DUA_ARCHITECTURE_FREERTOSLWIP)
|
||||
|
||||
project(hello-world)
|
||||
|
||||
add_dependencies(open62541-lib open62541-code-generation)
|
||||
|
||||
45
third_party/open62541/tools/azure-devops/freeRTOS/build.sh
vendored
Executable file
45
third_party/open62541/tools/azure-devops/freeRTOS/build.sh
vendored
Executable file
@@ -0,0 +1,45 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||
BASE_DIR="$( realpath "$DIR/../../../" )"
|
||||
|
||||
echo "== freeRTOS Build =="
|
||||
|
||||
# Add xtensa compiler to path
|
||||
export PATH=$PATH:$IDF_PATH/xtensa-esp32-elf/bin
|
||||
|
||||
mkdir -p build_freertos && cd build_freertos
|
||||
|
||||
CMAKE_ARGS="-DCMAKE_BUILD_TYPE=Debug \
|
||||
-DUA_ENABLE_AMALGAMATION=OFF \
|
||||
-DCMAKE_TOOLCHAIN_FILE=${IDF_PATH}/tools/cmake/toolchain-esp32.cmake \
|
||||
-DUA_ARCHITECTURE=freertosLWIP \
|
||||
-DUA_ARCH_EXTRA_INCLUDES=${IDF_PATH}/components/freertos/include/freertos \
|
||||
-DUA_BUILD_EXAMPLES=OFF"
|
||||
|
||||
|
||||
# We first need to call cmake separately to generate the required source code. Then we can call the freeRTOS CMake
|
||||
mkdir lib && cd lib
|
||||
cmake \
|
||||
${CMAKE_ARGS} \
|
||||
${BASE_DIR}
|
||||
if [ $? -ne 0 ] ; then exit 1 ; fi
|
||||
|
||||
make -j open62541-code-generation
|
||||
if [ $? -ne 0 ] ; then exit 1 ; fi
|
||||
|
||||
# Now call the freeRTOS CMake with same arguments
|
||||
cd ..
|
||||
|
||||
cmake \
|
||||
${CMAKE_ARGS} \
|
||||
${BASE_DIR}/tools/azure-devops/freeRTOS/
|
||||
if [ $? -ne 0 ] ; then exit 1 ; fi
|
||||
|
||||
# NOTE!!!
|
||||
# If you came here to see how to build your own version for the ESP32,
|
||||
# make sure to call `make menuconfig` first and configure the options.
|
||||
|
||||
make hello-world.elf
|
||||
if [ $? -ne 0 ] ; then exit 1 ; fi
|
||||
6
third_party/open62541/tools/azure-devops/freeRTOS/components/main/CMakeLists.txt
vendored
Normal file
6
third_party/open62541/tools/azure-devops/freeRTOS/components/main/CMakeLists.txt
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
set(COMPONENT_REQUIRES open62541-lib )
|
||||
set(COMPONENT_PRIV_REQUIRES spi_flash )
|
||||
set(COMPONENT_SRCS hello_world_main.c)
|
||||
set(COMPONENT_ADD_INCLUDEDIRS "")
|
||||
|
||||
register_component()
|
||||
40
third_party/open62541/tools/azure-devops/freeRTOS/components/main/hello_world_main.c
vendored
Normal file
40
third_party/open62541/tools/azure-devops/freeRTOS/components/main/hello_world_main.c
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
/* Hello World Example
|
||||
|
||||
This example code is in the Public Domain (or CC0 licensed, at your option.)
|
||||
|
||||
Unless required by applicable law or agreed to in writing, this
|
||||
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
||||
CONDITIONS OF ANY KIND, either express or implied.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
#include "esp_system.h"
|
||||
#include "esp_spi_flash.h"
|
||||
|
||||
|
||||
void app_main()
|
||||
{
|
||||
printf("Hello world!\n");
|
||||
|
||||
/* Print chip information */
|
||||
esp_chip_info_t chip_info;
|
||||
esp_chip_info(&chip_info);
|
||||
printf("This is ESP32 chip with %d CPU cores, WiFi%s%s, ",
|
||||
chip_info.cores,
|
||||
(chip_info.features & CHIP_FEATURE_BT) ? "/BT" : "",
|
||||
(chip_info.features & CHIP_FEATURE_BLE) ? "/BLE" : "");
|
||||
|
||||
printf("silicon revision %d, ", chip_info.revision);
|
||||
|
||||
printf("%dMB %s flash\n", spi_flash_get_chip_size() / (1024 * 1024),
|
||||
(chip_info.features & CHIP_FEATURE_EMB_FLASH) ? "embedded" : "external");
|
||||
|
||||
for (int i = 10; i >= 0; i--) {
|
||||
printf("Restarting in %d seconds...\n", i);
|
||||
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
||||
}
|
||||
printf("Restarting now.\n");
|
||||
fflush(stdout);
|
||||
esp_restart();
|
||||
}
|
||||
16
third_party/open62541/tools/azure-devops/freeRTOS/install.sh
vendored
Normal file
16
third_party/open62541/tools/azure-devops/freeRTOS/install.sh
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
sudo apt-get update
|
||||
sudo apt install -y cmake python3-pip check libsubunit-dev wget tar git
|
||||
|
||||
git clone -b v3.2.3 --recursive https://github.com/espressif/esp-idf.git $IDF_PATH
|
||||
cd $IDF_PATH
|
||||
python -m pip install wheel
|
||||
python -m pip install --user -r $IDF_PATH/requirements.txt
|
||||
|
||||
# See https://docs.espressif.com/projects/esp-idf/en/stable/get-started/linux-setup.html#toolchain-setup
|
||||
wget -q https://dl.espressif.com/dl/xtensa-esp32-elf-linux64-1.22.0-80-g6c4433a-5.2.0.tar.gz
|
||||
tar -xf xtensa-esp32-elf-linux64-1.22.0-80-g6c4433a-5.2.0.tar.gz -C $IDF_PATH
|
||||
rm xtensa-esp32-elf-linux64-1.22.0-80-g6c4433a-5.2.0.tar.gz
|
||||
147
third_party/open62541/tools/azure-devops/win/build.ps1
vendored
Normal file
147
third_party/open62541/tools/azure-devops/win/build.ps1
vendored
Normal file
@@ -0,0 +1,147 @@
|
||||
Write-Host -ForegroundColor Green "`n## Build Path $env:Build_Repository_LocalPath #####`n"
|
||||
|
||||
$build_encryption = "MBEDTLS"
|
||||
|
||||
if ($env:CC_SHORTNAME -eq "vs2008" -or $env:CC_SHORTNAME -eq "vs2013") {
|
||||
# on VS2008 mbedtls can not be built since it includes stdint.h which is not available there
|
||||
$build_encryption = "OFF"
|
||||
Write-Host -ForegroundColor Green "`n## Building without encryption on VS2008 or VS2013 #####`n"
|
||||
}
|
||||
|
||||
if ($env:CC_SHORTNAME -eq "mingw" -or $env:CC_SHORTNAME -eq "clang-mingw") {
|
||||
# Workaround for CMake not wanting sh.exe on PATH for MinGW (necessary for CMake 3.12.2)
|
||||
$env:PATH = ($env:PATH.Split(';') | Where-Object { $_ -ne 'C:\Program Files\Git\bin' }) -join ';'
|
||||
$env:PATH = ($env:PATH.Split(';') | Where-Object { $_ -ne 'C:\Program Files\Git\usr\bin' }) -join ';'
|
||||
# Add mingw to path so that CMake finds e.g. clang
|
||||
$env:PATH = "$env:MSYS2_ROOT\mingw64\bin;$env:PATH"
|
||||
[System.Environment]::SetEnvironmentVariable('Path', $path, 'Machine')
|
||||
}
|
||||
|
||||
$vcpkg_toolchain = ""
|
||||
$vcpkg_triplet = ""
|
||||
|
||||
if ($env:CC_SHORTNAME -eq "mingw") {
|
||||
|
||||
} elseif ($env:CC_SHORTNAME -eq "clang-mingw") {
|
||||
# Setup clang
|
||||
$env:CC = "clang --target=x86_64-w64-mingw32"
|
||||
$env:CXX = "clang++ --target=x86_64-w64-mingw32"
|
||||
clang --version
|
||||
} else {
|
||||
$vcpkg_toolchain = '-DCMAKE_TOOLCHAIN_FILE="C:/vcpkg/scripts/buildsystems/vcpkg.cmake"'
|
||||
$vcpkg_triplet = '-DVCPKG_TARGET_TRIPLET="x64-windows-static"'
|
||||
}
|
||||
|
||||
$cmake_cnf="$vcpkg_toolchain", "$vcpkg_triplet", "-G`"$env:GENERATOR`""
|
||||
|
||||
Write-Host -ForegroundColor Green "`n###################################################################"
|
||||
Write-Host -ForegroundColor Green "`n##### Testing $env:CC_NAME with unit tests #####`n"
|
||||
New-Item -ItemType directory -Path "build"
|
||||
cd build
|
||||
& cmake $cmake_cnf `
|
||||
-DBUILD_SHARED_LIBS:BOOL=OFF `
|
||||
-DCMAKE_BUILD_TYPE=Debug `
|
||||
-DUA_BUILD_EXAMPLES=OFF `
|
||||
-DUA_BUILD_UNIT_TESTS=ON `
|
||||
-DUA_ENABLE_ALLOW_REUSEADDR=ON `
|
||||
-DUA_ENABLE_DA=ON `
|
||||
-DUA_ENABLE_DISCOVERY=ON `
|
||||
-DUA_ENABLE_ENCRYPTION:STRING=$build_encryption `
|
||||
-DUA_ENABLE_JSON_ENCODING:BOOL=ON `
|
||||
-DUA_ENABLE_PUBSUB:BOOL=ON `
|
||||
-DUA_ENABLE_PUBSUB_INFORMATIONMODEL:BOOL=ON `
|
||||
-DUA_ENABLE_PUBSUB_MONITORING:BOOL=ON `
|
||||
-DUA_FORCE_WERROR=ON `
|
||||
..
|
||||
& cmake --build .
|
||||
if ($LASTEXITCODE -and $LASTEXITCODE -ne 0) {
|
||||
Write-Host -ForegroundColor Red "`n`n*** Make failed. Exiting ... ***"
|
||||
exit $LASTEXITCODE
|
||||
}
|
||||
& cmake --build . --target test-verbose -j 1
|
||||
if ($LASTEXITCODE -and $LASTEXITCODE -ne 0) {
|
||||
Write-Host -ForegroundColor Red "`n`n*** Test failed. Exiting ... ***"
|
||||
exit $LASTEXITCODE
|
||||
}
|
||||
cd ..
|
||||
Remove-Item -Path build -Recurse -Force
|
||||
|
||||
Write-Host -ForegroundColor Green "`n###################################################################"
|
||||
Write-Host -ForegroundColor Green "`n##### Building $env:CC_NAME examples #####`n"
|
||||
New-Item -ItemType directory -Path "build"
|
||||
cd build
|
||||
& cmake $cmake_cnf `
|
||||
-DBUILD_SHARED_LIBS:BOOL=OFF `
|
||||
-DCMAKE_BUILD_TYPE=Debug `
|
||||
-DUA_BUILD_EXAMPLES:BOOL=ON `
|
||||
-DUA_ENABLE_AMALGAMATION:BOOL=OFF `
|
||||
-DUA_FORCE_WERROR=ON `
|
||||
..
|
||||
& cmake --build .
|
||||
if ($LASTEXITCODE -and $LASTEXITCODE -ne 0) {
|
||||
Write-Host -ForegroundColor Red "`n`n*** Make install failed. Exiting ... ***"
|
||||
exit $LASTEXITCODE
|
||||
}
|
||||
cd ..
|
||||
Remove-Item -Path build -Recurse -Force
|
||||
|
||||
Write-Host -ForegroundColor Green "`n###################################################################"
|
||||
Write-Host -ForegroundColor Green "`n##### Testing $env:CC_NAME with amalgamation #####`n"
|
||||
New-Item -ItemType directory -Path "build"
|
||||
cd build
|
||||
& cmake $cmake_cnf `
|
||||
-DBUILD_SHARED_LIBS:BOOL=OFF `
|
||||
-DCMAKE_BUILD_TYPE=Debug `
|
||||
-DUA_BUILD_EXAMPLES:BOOL=OFF `
|
||||
-DUA_ENABLE_AMALGAMATION:BOOL=ON `
|
||||
-DUA_ENABLE_SUBSCRIPTIONS_EVENTS:BOOL=ON `
|
||||
-DUA_ENABLE_ENCRYPTION:STRING=$build_encryption `
|
||||
-DUA_FORCE_WERROR=ON `
|
||||
..
|
||||
& cmake --build .
|
||||
if ($LASTEXITCODE -and $LASTEXITCODE -ne 0) {
|
||||
Write-Host -ForegroundColor Red "`n`n*** Make failed. Exiting ... ***"
|
||||
exit $LASTEXITCODE
|
||||
}
|
||||
cd ..
|
||||
Remove-Item -Path build -Recurse -Force
|
||||
|
||||
Write-Host -ForegroundColor Green "`n###################################################################"
|
||||
Write-Host -ForegroundColor Green "`n##### Testing $env:CC_NAME with full NS0 #####`n"
|
||||
New-Item -ItemType directory -Path "build"
|
||||
cd build
|
||||
& cmake $cmake_cnf `
|
||||
-DBUILD_SHARED_LIBS:BOOL=OFF `
|
||||
-DCMAKE_BUILD_TYPE=Debug `
|
||||
-DUA_ENABLE_DA:BOOL=ON `
|
||||
-DUA_ENABLE_JSON_ENCODING:BOOL=ON `
|
||||
-DUA_ENABLE_PUBSUB:BOOL=ON `
|
||||
-DUA_ENABLE_PUBSUB_INFORMATIONMODEL:BOOL=ON `
|
||||
-DUA_ENABLE_SUBSCRIPTIONS_EVENTS:BOOL=ON `
|
||||
-DUA_FORCE_WERROR=ON `
|
||||
-DUA_NAMESPACE_ZERO:STRING=FULL `
|
||||
..
|
||||
& cmake --build .
|
||||
if ($LASTEXITCODE -and $LASTEXITCODE -ne 0) {
|
||||
Write-Host -ForegroundColor Red "`n`n*** Make failed. Exiting ... ***"
|
||||
exit $LASTEXITCODE
|
||||
}
|
||||
cd ..
|
||||
Remove-Item -Path build -Recurse -Force
|
||||
|
||||
Write-Host -ForegroundColor Green "`n###################################################################"
|
||||
Write-Host -ForegroundColor Green "`n##### Testing $env:CC_NAME (.dll) #####`n"
|
||||
New-Item -ItemType directory -Path "build"
|
||||
cd build
|
||||
& cmake $cmake_cnf `
|
||||
-DBUILD_SHARED_LIBS:BOOL=ON `
|
||||
-DCMAKE_BUILD_TYPE=Debug `
|
||||
-DUA_FORCE_WERROR=ON `
|
||||
..
|
||||
& cmake --build .
|
||||
if ($LASTEXITCODE -and $LASTEXITCODE -ne 0) {
|
||||
Write-Host -ForegroundColor Red "`n`n*** Make failed. Exiting ... ***"
|
||||
exit $LASTEXITCODE
|
||||
}
|
||||
cd ..
|
||||
Remove-Item -Path build -Recurse -Force
|
||||
41
third_party/open62541/tools/azure-devops/win/install.ps1
vendored
Normal file
41
third_party/open62541/tools/azure-devops/win/install.ps1
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
if ($env:CC_SHORTNAME -eq "mingw" -or $env:CC_SHORTNAME -eq "clang-mingw") {
|
||||
Write-Host -ForegroundColor Green "`n### Installing msys64 ###`n"
|
||||
& choco install -y msys2 --no-progress --params="/InstallDir:$env:MSYS2_ROOT /NoPath"
|
||||
if ($LASTEXITCODE -and $LASTEXITCODE -ne 0) {
|
||||
Write-Host -ForegroundColor Red "`n`n*** Install failed. Exiting ... ***"
|
||||
exit $LASTEXITCODE
|
||||
}
|
||||
# pacman may complain that the directory does not exist, thus create it.
|
||||
# Se https://github.com/open62541/open62541/issues/2068
|
||||
& C:\msys64\usr\bin\mkdir -p /var/cache/pacman/pkg
|
||||
# Update all packages. Ensure that we have up-to-date clang version.
|
||||
# Otherwise we run into issue: https://github.com/msys2/MINGW-packages/issues/6576
|
||||
& C:\msys64\usr\bin\pacman -Syu
|
||||
|
||||
Write-Host -ForegroundColor Green "`n### Installing mbedtls via PacMan ###`n"
|
||||
& C:\msys64\usr\bin\pacman --noconfirm --needed -S mingw-w64-x86_64-mbedtls
|
||||
if ($LASTEXITCODE -and $LASTEXITCODE -ne 0) {
|
||||
Write-Host -ForegroundColor Red "`n`n*** Install of mbedTLS failed. Exiting ... ***"
|
||||
exit $LASTEXITCODE
|
||||
}
|
||||
|
||||
& C:\msys64\usr\bin\pacman --noconfirm --needed -S mingw-w64-x86_64-check
|
||||
if ($LASTEXITCODE -and $LASTEXITCODE -ne 0) {
|
||||
Write-Host -ForegroundColor Red "`n`n*** Install of check failed. Exiting ... ***"
|
||||
exit $LASTEXITCODE
|
||||
}
|
||||
} else {
|
||||
Write-Host -ForegroundColor Green "`n### Installing mbedtls via vcpkg ###`n"
|
||||
& vcpkg install mbedtls:x64-windows-static
|
||||
if ($LASTEXITCODE -and $LASTEXITCODE -ne 0) {
|
||||
Write-Host -ForegroundColor Red "`n`n*** Install failed. Exiting ... ***"
|
||||
exit $LASTEXITCODE
|
||||
}
|
||||
|
||||
Write-Host -ForegroundColor Green "`n### Installing libcheck via vcpkg ###`n"
|
||||
& vcpkg install check:x64-windows-static
|
||||
if ($LASTEXITCODE -and $LASTEXITCODE -ne 0) {
|
||||
Write-Host -ForegroundColor Red "`n`n*** Install failed. Exiting ... ***"
|
||||
exit $LASTEXITCODE
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user