Files
Codesys-Library-Atom-Modbus/docs/BUILD-AND-USAGE.md
T
2026-10-06 23:50:02 -06:00

62 lines
3.2 KiB
Markdown

# Build and upgrade to atMb 0.6
## Build on ARM64 Linux
From the repository root:
```sh
sudo apt install build-essential m4 dos2unix python3
make -C component-source/component SDKDIR="$(realpath ExtensionSDK)" clean
make -C component-source/component SDKDIR="$(realpath ExtensionSDK)" all
mkdir -p artifacts/arm64
cp component-source/component/out/libCmpAtomModbus.so artifacts/arm64/
```
Run these commands on an ARM64 build machine. On an x86 laptop, ordinary gcc
builds x86 output; use the appropriate cross-compiler instead.
## Cross-compile ARMv7 hard-float on the laptop
```sh
sudo apt install gcc-arm-linux-gnueabihf binutils-arm-linux-gnueabihf make m4 dos2unix
make -C component-source/component SDKDIR="$(realpath ExtensionSDK)" clean
make -C component-source/component SDKDIR="$(realpath ExtensionSDK)" CC="arm-linux-gnueabihf-gcc -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=hard" all
mkdir -p artifacts/armv7hf
cp component-source/component/out/libCmpAtomModbus.so artifacts/armv7hf/
arm-linux-gnueabihf-readelf --version-info artifacts/armv7hf/libCmpAtomModbus.so
```
The makefile supplies `-pthread` during compilation/linking. Always clean between
architectures. Check `file`, ELF attributes, NEEDED libraries and GLIBC symbol
requirements against the target. Adding pthread can change the required glibc
version; the previously checked binaries do not establish compatibility of this build.
The WL2000 runtime was ARMv7/VFPv3-D16 hard-float. The UC20 OS was ARM64/glibc 2.39;
its runtime architecture/component support still needs target verification.
## CODESYS
1. Keep the prior working `.library` and PLC application for rollback.
2. Create a fresh library project named `CmpAtomModbus.library` and import
`library/atMb-Threaded.export`. Importing into an old project does not delete
renamed/removed objects; a fresh project avoids duplicate old methods.
3. Preserve Project Information title `CmpAtomModbus`, namespace `atMb`, and
Standard/SysTime references. Verify library version 0.6.0.0 in Project Information.
4. Add a C Implemented Library object and attach the **new 0.4.0.0** component for
each exact target device. Do not attach files from `backup/`.
5. Compile, install the library and update application references. Rename application
diagnostic accesses using `RENAMED-MEMBERS.json`. `ClientTCP`/`ClientRTU` and
request function-block names remain the same.
6. Use a full download and verify the runtime loads component 0.4.0.0. If manually
preloading an old component, remove/replace that preload during maintenance so
it does not conflict with the embedded component.
7. Start on a bench with the default worker settings; verify unplug/replug, device
reboot, disabled client and PLC stop/start behavior before deployment.
The C ABI layout/signature is unchanged (0x709EE65B, API 0.2.0.0). Component version
is 0.4.0.0. Command 41 capability checking prevents this IEC export operating with
an old component; it does not eliminate target/compiler compatibility checks.
Host validation: `make -C component-source test`. Host frame/function compilation
used the supplied SDK and generated headers; a fresh SDK/M4 build and the IDE
compile were not available in the execution environment.