Vendor ID, Device Type, etc.

145 views
Skip to first unread message

ATSAM User

unread,
Oct 11, 2021, 3:16:58 PM10/11/21
to EIP Stack Group OpENer users
Background: Ubuntu Linux development PC; Microchip SAMA5D27-SOM1-EK1 (arm) target device; Buildroot generated Linux OS.

    I've been trying to figure out an easy way to set these values. I could edit the devicedata.h file directly, but this just seemed messy. What I ultimately wound up doing was adding to the setup_posix.sh file. My thinking was that I could ultimately have multiple setup scripts for the multiple devices that may ultimately be using OpENer.
    Unfortunately this won't work for the major and minor revision. They always stay 2 and 3, respectively. For example, I can add the following line for vendor ID:

-DOpENer_Device_Config_Vendor_Id=1234

but this won't work for major revision:

-DOpENer_VERSION_MAJOR=1

    Any thoughts?

stm-at-esd

unread,
Oct 12, 2021, 7:51:21 AM10/12/21
to EIP Stack Group OpENer users
I had some times ago the same requirement.  Because the config file devicedata.h is copied to the build directory I
patched the devicedata.h in the build directory. The shell code looked like this

#!/bin/sh
# Setup the revisions for the device's Identity class
DEVICE_MAJOR_REVISION=2
DEVICE_MINOR_REVISION=1
#
# ... More shell code / cmake calls etc.
#
# We need to patch the DEVICE_xxxOR_REVISION manually in src/ports/devicedata.h
#   because we can't override the OpENer_VERSION_MAJOR and OpENer_VERSION_MINOR
#   from the cmake command line with -DOpENer_VERSION_MAJOR:STRING="1" because
#   cmake derives these versions from the project() directive and handles
#   them as immutable!
echo "Patch the device's MAJOR and MINOR revision to deviate from the OpENer version!"
echo "    DEVICE_MAJOR_REVISION=$DEVICE_MAJOR_REVISION"
echo "    DEVICE_MINOR_REVISION=$DEVICE_MINOR_REVISION"

sed -e "s/OPENER_DEVICE_MAJOR_REVISION.*/OPENER_DEVICE_MAJOR_REVISION      $DEVICE_MAJOR_REVISION/" \
    -e "s/OPENER_DEVICE_MINOR_REVISION.*/OPENER_DEVICE_MINOR_REVISION      $DEVICE_MINOR_REVISION/" \
    src/ports/devicedata.h > src/ports/devicedata.out
if ! mv src/ports/devicedata.out src/ports/devicedata.h; then
    echo "Problems moving config file. Abort"
    exit 1
fi

Best regards,
    Stefan

ATSAM User

unread,
Oct 13, 2021, 12:10:03 PM10/13/21
to EIP Stack Group OpENer users
Thank you, Stefan, but it's still getting around the overall issue: why not allow those two fields to be changed? The default matches the version number for OpENer, which is fine, but these fields should be able to be changed in the same fashion as the other fields: through the setup_xxx.sh script. I think fixing this would be broadly popular.

martin...@gmail.com

unread,
Oct 18, 2021, 8:30:40 AM10/18/21
to EIP Stack Group OpENer users
Hi,

good point. I probably never added it, because for my internal tests I didn't need it and nobody ever put up a feature request for that :D
Please add a feature request here https://github.com/EIPStackGroup/OpENer/issues and I will add it to my schedule.

Best regards,
Martin

Reply all
Reply to author
Forward
0 new messages