Hi Ryan,
Thinking about programming at the level of "commands sent to the BDM" is way too low level.
The BDM provides a low-level interface that allows interaction with the CPU. This is described in the Coldfire manual.
This interface is then used to download a program to the target.
This program is used to program the chip i.e. the chip programs itself one block of data at a time under control of an external program..
This is quite an involved process.
It would be possible to do what you suggest but you should be looking at the firmware in the BDM for approaches to the BDM communication and then at the actually programming utility for information on how to do the programming. This higher level information is not available for OSBDM (it is P&E proprietary).
You can look at the USBDM firmware and programs if you wish but they are quite convoluted since they program a range of chip types. There is a good quality one available that is mentioned in these forums.
Flash routines that are downloaded to the target to do the programming:
podonoghue/usbdm-flash-routines · GitHub
BDM firmware - The code that is in the BDM that communicates with the target using the BDM protocol.
podonoghue/usbdm-firmware · GitHub
Programming utilities
podonoghue/usbdm-eclipse-makefiles-build · GitHub
If you intend to re-program chips rather than programming blank chips you would be better off considering a bootloader that can be once-off programmed into the chip and then used to re-program the remainder of the chip at a later time. This would usually be done over a serial interface.
bye