Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions misc/CanopenNode/profile/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,74 @@

menu "CANopen profiles"

config PKG_CANOPENNODE_PROFILE_REGISTRY
bool "Enable common logical-device profile registry"
default n
help
Build the Pure-C fixed-capacity registry that validates one CANopen
node's logical-device slot ownership against generated Device Type
entries. The registry uses no heap, RT-Thread, BSP, HAL, or concrete
Device Profile dependency.

config PKG_CANOPENNODE_PROFILE_CONTROLLER_PORT
bool
default n
help
Internal switch for the stack- and RTOS-neutral Device Profile Controller
transport contract. Portable profile clients select this without pulling
in CANopenNode, RT-Thread, or a concrete CANopen backend.

config PKG_CANOPENNODE_PROFILE_MASTER_RTT
bool "Enable common RT-Thread profile Master transport"
default n
depends on !PKG_CANOPENNODE_DEMO_SDO_CLIENT_TEST
select PKG_CANOPENNODE_PROFILE_CONTROLLER_PORT
select PKG_CANOPENNODE_USING_SDO_CLIENT
select PKG_CANOPENNODE_RTT_LIFECYCLE_EXTENSIONS
help
Add one profile-neutral CANopenNode Master transport which serializes
remote scalar SDO and NMT operations through co_main. Profile-specific
Controller adapters reuse this transport instead of calling CANopenNode
protocol objects from arbitrary application threads. Each attached
transport instance requires exclusive ownership of its selected SDO
client object. The package demo SDO client is mutually exclusive because
it directly owns generated SDO client 0 outside this transport.

rsource "cia401/Kconfig"
rsource "cia402/Kconfig"
rsource "mixed/Kconfig"

config PKG_CANOPENNODE_PROFILE_RTT_SHARED_WORKER
bool
default y if PKG_CANOPENNODE_CIA401_DEVICE_RTT_THREAD && !PKG_CANOPENNODE_CIA401_DEVICE_RTT_DEDICATED_WORKER
default y if PKG_CANOPENNODE_CIA402_DEVICE_RTT_THREAD && !PKG_CANOPENNODE_CIA402_DEVICE_RTT_DEDICATED_WORKER
help
Internal derived switch for the common deferred lifecycle worker used by
Device Profiles that did not request a dedicated RT-Thread worker.

if PKG_CANOPENNODE_PROFILE_RTT_SHARED_WORKER

menu "Shared RT-Thread profile worker"

config PKG_CANOPENNODE_PROFILE_THREAD_STACK_SIZE
int "Stack size"
default 2048
help
Stack size in bytes for the common co_prof worker. Profile callbacks run
sequentially, so size this for the deepest enabled shared Profile pass,
not the sum of all Profile stack sizes. Confirm the final margin on target.

config PKG_CANOPENNODE_PROFILE_THREAD_PRIORITY
int "Priority"
default 5
help
RT-Thread priority for the common co_prof worker. Lower numeric values are
higher priority. It must remain numerically greater than co_rt priority.
A Profile requiring stronger isolation should enable its dedicated-worker
option instead of increasing this shared priority arbitrarily.

endmenu

endif

endmenu
1 change: 1 addition & 0 deletions misc/CanopenNode/profile/cia401/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ menuconfig PKG_CANOPENNODE_CIA401

if PKG_CANOPENNODE_CIA401

rsource "controller/Kconfig"
rsource "device/Kconfig"
rsource "port/rtthread/Kconfig"
rsource "demo/Kconfig"
Expand Down
29 changes: 29 additions & 0 deletions misc/CanopenNode/profile/cia401/controller/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
config PKG_CANOPENNODE_CIA401_CONTROLLER
bool "Transport-agnostic CiA 401 Controller API"
default n
help
Enable the Pure-C remote CiA 401 I/O Controller core. It resolves the
remote logical-device profile block and validates configured basic
digital/analogue process-image channels without owning Node-ID, SDO,
PDO, RT-Thread resources or heap memory.

config PKG_CANOPENNODE_CIA401_CONTROLLER_CLIENT
bool "Portable CiA 401 Controller transport client"
default n
depends on PKG_CANOPENNODE_CIA401_CONTROLLER
select PKG_CANOPENNODE_PROFILE_CONTROLLER_PORT
help
Add the stack- and RTOS-neutral CiA 401 remote I/O client on top of the
common profile transport contract. A platform port only implements the
common transport operations; the CiA 401 object translation and typed
SDO control-plane behavior are reused unchanged.

config PKG_CANOPENNODE_CIA401_CONTROLLER_RTT
bool "CANopenNode RT-Thread CiA 401 Controller SDO adapter"
default n
depends on PKG_CANOPENNODE_CIA401_CONTROLLER_CLIENT
depends on !PKG_CANOPENNODE_DEMO_SDO_CLIENT_TEST
select PKG_CANOPENNODE_PROFILE_MASTER_RTT
help
Add the thin RT-Thread compatibility facade which binds the portable
CiA 401 client to the common CANopenNode RT-Thread Master backend.
34 changes: 25 additions & 9 deletions misc/CanopenNode/profile/cia401/port/rtthread/Kconfig
Original file line number Diff line number Diff line change
@@ -1,30 +1,45 @@
# RT-Thread lifecycle adapter for the local CiA 401 Device core.

config PKG_CANOPENNODE_CIA401_DEVICE_RTT_THREAD
bool "Enable RT-Thread CiA 401 Device worker"
bool "Enable RT-Thread CiA 401 Device adapter"
default n
depends on PKG_CANOPENNODE_CIA401_DEVICE
depends on RT_USING_HEAP
select PKG_CANOPENNODE_RTT_LIFECYCLE_EXTENSIONS
select PKG_CANOPENNODE_RTT_CAN_TX_SUCCESS_OBSERVER if PKG_CANOPENNODE_CIA401_DIGITAL_EVENTS || PKG_CANOPENNODE_CIA401_ANALOG_EVENTS
help
Bind the Pure-C CiA 401 Device before PDO initialization and run one
bounded process pass from a lower-priority co_401 worker woken by the
existing realtime timer. Communication Reset drains stale tokens and
rebinds the new Object Dictionary generation.
Bind the Pure-C CiA 401 Device before PDO initialization and schedule
bounded process passes from the common profile worker by default.
Communication Reset drains stale worker requests and rebinds the new
Object Dictionary generation. Enable the dedicated-worker option below
only when CiA 401 backend latency must be isolated from other profiles.

if PKG_CANOPENNODE_CIA401_DEVICE_RTT_THREAD

config PKG_CANOPENNODE_CIA401_DEVICE_RTT_DEDICATED_WORKER
bool "Use a dedicated co_401 worker thread"
default n
help
Create a profile-private co_401 thread and semaphore instead of running
CiA 401 process passes on the common co_prof worker. Use this when product
IOIF callbacks have a materially different WCET/blocking risk or require
independent scheduling priority. The default shared worker minimizes
thread/stack/context-switch overhead across Device Profiles.

if PKG_CANOPENNODE_CIA401_DEVICE_RTT_DEDICATED_WORKER

config PKG_CANOPENNODE_CIA401_THREAD_STACK_SIZE
int "CiA 401 worker stack size"
int "CiA 401 dedicated worker stack size"
default 1536

config PKG_CANOPENNODE_CIA401_THREAD_PRIORITY
int "CiA 401 worker priority"
int "CiA 401 dedicated worker priority"
default 6
help
Must be numerically greater (lower scheduling priority) than the existing co_rt worker.

endif

config PKG_CANOPENNODE_CIA401_DEVICE_RTT_EMCY_BRIDGE
bool "Bridge CiA 401 profile warnings to EMCY"
default y
Expand Down Expand Up @@ -58,7 +73,8 @@ config PKG_CANOPENNODE_CIA401_DEVICE_RTT_MSH
Register the cia401 MSH command for the software-only RT-Thread demo.
Commands inject raw DI/AI process values, inspect physical DO/AO state,
write the same bound output OD entries used by SDO/RPDO, inject output
fault/supervision state, and wake the existing co_401 worker. This is
bench/debug functionality only and does not change the product IOIF API.
fault/supervision state, and wake the configured shared or dedicated
profile worker. This is bench/debug functionality only and does not
change the product IOIF API.

endif
22 changes: 22 additions & 0 deletions misc/CanopenNode/profile/cia402/controller/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,25 @@ config PKG_CANOPENNODE_CIA402_CONTROLLER
observes a remote Statusword and generates PDS-owned Controlword updates.
It does not select or own NMT, Heartbeat Consumer, SDO Client, PDO, SYNC,
Object Dictionary, Node-ID, CAN transport, RT-Thread tasks, or heap memory.


config PKG_CANOPENNODE_CIA402_CONTROLLER_CLIENT
bool "Portable CiA 402 Controller transport client"
default n
depends on PKG_CANOPENNODE_CIA402_CONTROLLER
select PKG_CANOPENNODE_PROFILE_CONTROLLER_PORT
help
Add the stack- and RTOS-neutral CiA 402 SDO control-plane client on top
of the common profile transport contract. It preserves the existing PDS
retry/Fault Reset semantics without depending on CANopenNode or RT-Thread.

config PKG_CANOPENNODE_CIA402_CONTROLLER_RTT
bool "CANopenNode RT-Thread CiA 402 Controller SDO adapter"
default n
depends on PKG_CANOPENNODE_CIA402_CONTROLLER_CLIENT
depends on !PKG_CANOPENNODE_DEMO_SDO_CLIENT_TEST
select PKG_CANOPENNODE_PROFILE_MASTER_RTT
help
Add the thin RT-Thread compatibility facade which binds the portable
CiA 402 client to the common CANopenNode RT-Thread Master backend.
Cyclic motion modes should still use PDO/SYNC-specific integration.
4 changes: 3 additions & 1 deletion misc/CanopenNode/profile/cia402/demo/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@ config PKG_CANOPENNODE_CIA402_DEMO_SYNC_LOG
bool "Log cyclic synchronous command/feedback snapshots"
default n
depends on PKG_CANOPENNODE_CIA402_DEVICE_SYNC_FASTPATH
select PKG_CANOPENNODE_CIA402_DEVICE_RTT_DEDICATED_WORKER
help
Print CSP/CSV/CST command and feedback snapshots from the lower-priority
co_402 worker. If that worker lags co_rt, intermediate SYNC generations may
dedicated co_402 worker. This option selects dedicated-worker mode so ULOG
remains outside the common lifecycle lock. If that worker lags co_rt, intermediate SYNC generations may
be coalesced. This is intended for protocol bring-up only; leave it disabled
for WCET, jitter, or production realtime measurements.

Expand Down
43 changes: 29 additions & 14 deletions misc/CanopenNode/profile/cia402/port/rtthread/Kconfig
Original file line number Diff line number Diff line change
@@ -1,39 +1,55 @@
# Kconfig for the RT-Thread CiA 402 Device adapter.

config PKG_CANOPENNODE_CIA402_DEVICE_RTT_THREAD
bool "Enable RT-Thread CiA 402 Device thread"
bool "Enable RT-Thread CiA 402 Device adapter"
default y
depends on PKG_CANOPENNODE_CIA402_DEVICE
select PKG_CANOPENNODE_RTT_LIFECYCLE_EXTENSIONS
help
Integrate an attached local Device manager with CANopenNodeRTT. The
existing realtime timer wakes a lower-priority co_402 supervisor thread.
Disable this option to retain the Pure-C Device core without adding any
CiA 402 RT-Thread thread or semaphore.
Integrate an attached local Device manager with CANopenNodeRTT. By
default the existing realtime timer wakes one common lower-priority
profile worker which runs the CiA 402 supervisor together with other
shared Device Profiles. Enable the dedicated-worker option below only
when CiA 402 supervisor latency must be isolated from other profiles.
Disable this adapter to retain the Pure-C Device core without any
CiA 402 RT-Thread scheduling resources.

if PKG_CANOPENNODE_CIA402_DEVICE_RTT_THREAD

config PKG_CANOPENNODE_CIA402_DEVICE_RTT_DEDICATED_WORKER
bool "Use a dedicated co_402 worker thread"
default n
help
Create a profile-private co_402 thread and semaphore instead of running
CiA 402 supervisor passes on the common co_prof worker. This is intended
for products that require independent PDS supervisor scheduling or need
to isolate DriveIF execution time from other Device Profiles.

if PKG_CANOPENNODE_CIA402_DEVICE_RTT_DEDICATED_WORKER

config PKG_CANOPENNODE_CIA402_THREAD_STACK_SIZE
int "CiA 402 thread stack size"
int "CiA 402 dedicated worker stack size"
default 2048

config PKG_CANOPENNODE_CIA402_THREAD_PRIORITY
int "CiA 402 thread priority"
int "CiA 402 dedicated worker priority"
default 5
help
Initial supervisor priority. The default keeps co_rt (priority 3)
higher priority. Final priority requires target WCET/jitter validation.

endif

config PKG_CANOPENNODE_CIA402_DEVICE_RTT_EMCY_BRIDGE
bool "Bridge CiA 402 axis faults to CANopen EMCY"
default y
depends on PKG_CANOPENNODE_CIA402_DEVICE_DIAGNOSTICS
depends on PKG_CANOPENNODE_EM_ERR_STATUS_BITS_COUNT >= 72
select PKG_CANOPENNODE_EM_PRODUCER
help
Flush axis diagnostic REPORT/RESET events after the Device worker releases
the OD lock while lifecycleMutex still protects the current CO_t. Axis
source uses manufacturer-specific error-status bits 0x40..0x47.
Flush axis diagnostic REPORT/RESET events after the Device supervisor
releases the OD lock while lifecycleMutex still protects the current
CO_t. Axis source uses manufacturer-specific error-status bits 0x40..0x47.
Communication Reset rebinds the new CO_EM_t and replays active faults.

config PKG_CANOPENNODE_CIA402_DEVICE_RTT_AUTOSTART
Expand All @@ -59,9 +75,8 @@ config PKG_CANOPENNODE_CIA402_DEVICE_RTT_MSH
help
Register the cia402 MSH command for the default auto-attached local
Device runtime. Commands update the same Object Dictionary consumed by
SDO/RPDO and wake the existing co_402 supervisor; they never call the
DriveIF directly. This is intended for bench/debug use and may be
disabled without affecting the Pure-C Device or CAN behavior.

SDO/RPDO and wake the configured shared or dedicated Device supervisor;
they never call the DriveIF directly. This is intended for bench/debug
use and may be disabled without affecting the Pure-C Device or CAN behavior.

endif
13 changes: 13 additions & 0 deletions misc/CanopenNode/profile/mixed/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
config PKG_CANOPENNODE_PROFILE_MIXED_RTT
bool "Enable generic mixed-profile RT-Thread ownership validator"
default n
depends on RT_USING_HEAP
select PKG_CANOPENNODE_PROFILE_REGISTRY
select PKG_CANOPENNODE_RTT_LIFECYCLE_EXTENSIONS
help
Enable the profile-neutral RT-Thread lifecycle adapter that validates a
caller-provided logical-device descriptor table against generated Device
Type entries before profile-specific OD binding. The adapter does not
choose Device Profile numbers, Logical Device slots, or demo topology.

rsource "demo/Kconfig"
14 changes: 14 additions & 0 deletions misc/CanopenNode/profile/mixed/demo/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
config PKG_CANOPENNODE_PROFILE_MIXED_RTT_DEMO
bool "Validate the mixed CiA 402/CiA 401 logical-device demo"
default y
depends on PKG_CANOPENNODE_PROFILE_MIXED_RTT
depends on PKG_CANOPENNODE_CIA401_DEVICE_RTT_DEMO
depends on PKG_CANOPENNODE_CIA402_DEVICE_RTT_DEMO
depends on PKG_CANOPENNODE_CIA402_DEMO_AXIS_COUNT = 3
depends on PKG_CANOPENNODE_RTT_LIFECYCLE_EXTENSION_CAPACITY >= 3
help
Provide the package demo descriptor table and register the generic mixed
lifecycle validator before the CiA 401 and CiA 402 demo adapters bind
their Object Dictionary extensions. This reference demo claims logical
devices 0..2 for CiA 402 and logical device 3 for CiA 401; other products
can supply a different descriptor table through CO_profileMixedRTTAttach().