canopennode/canopennode ? reverse-engineered prompt

Reverse engineered prompt

Build me a portable CANopen protocol stack in ANSI C for embedded devices.

I want it to support a clear Object Dictionary, NMT, heartbeat, PDO, SDO server and client, emergency messages, sync, time stamp, LSS, and a simple CANopen gateway style command interface. Keep it usable on small microcontrollers as well as with an RTOS, and make the code easy to reuse on different targets by keeping the device specific CAN and timer parts separate.

Please also include a basic example that shows how to initialize the stack, define a few variables in the Object Dictionary, and run the main communication loop even without real CAN hardware, using stubbed or simulated drivers if needed.

Make the code clean and well documented, follow the existing style, and keep it compatible with the project’s MISRA friendly approach. If anything is unclear, look up the current CANopenNode docs online and match the project’s intended behavior.

Are you gonna build this?

make sure you review the code using coderabbit

Try freeSponsored — opens CodeRabbit in a new tab