I'm porting USBDM to my programming tool, most code is portable and do not need to be changed.
But the endianness is not concerned in the USBDM code.
For example:
U8 f_CMD_GET_CAPABILITIES(void)
{
*(U16*)(commandBuffer+1) = CAPABILITY; // Returns 16-bit value
returnSize = 3;
return BDM_RC_OK;
}
How about:
U8 f_CMD_GET_CAPABILITIES(void)
{
SET_BE_U16(&commandBuffer[1], CAPABILITY); // Returns 16-bit value
returnSize = 3;
return BDM_RC_OK;
}
Here, BE means big endian.
SET_BE_U16 can be defined to swap the endian if controller is not big endian.
And it can be no effect on original controller, because no swap is done if controller is big endian.
And GET_BE_U16 chould be defined to read a U16 value from a BE buffer, example:
U16 addr = GET_BE_U16(&commandBuffer[6]);
BTW:
Does USBDM accpet patches? Does it has a SVN or GIT?
I can try to modify such code and provide the patch.
With these changes, the code will be more generic.
code is available at
http://code.google.com/p/vsprog/source/browse/trunk/dongle/firmware/USBDM/USBDM.
Dear simonqian,
I suggest you leave this for the moment. I am currently working on V4 which has significant changes including:
Linux support.
DSC targets
Use of libusbV2
You may find a great deal of work to re-do.
bye
HCS08 and HCS12(X) port is ready on Versaloon, it takes about 2 days, because most code is unchanged. You did great job.
Yes, V4 sounds exciting. I'll wait for this version and prepare patches if acceptable.