Re: USBDM On Linux Does NOT Require CW
Posted: Sun Dec 09, 2012 10:50 am
Installed the USBDM without CW, but using my own quick hack script (viewtopic.php?p=30882#p30882). Didn't know at the time Fred had already did this . There is a small difference though. I used the 4.10.3 version and there is no "Utilities" folder anymore, but instead it is "bin" now. Also "Device_data" is "DeviceData" and along with FlashImages they are now installed into /usr/local/share/usbdm instead of ~/.usbdm.
Got my BDM this week and I'm trying it out today. Tested USBDMs HCS12_FlashProgrammer first on winxp (32bit) and seems to work ok. On ubuntu (12.10 32bit) there is a problem. After the install with this "no cw" script the program starts, but gives an error:
It does not stop the application, but only affects the device database. The application detects my USB device correctly (in sudo), but the device pulldownmenu says "invalid database". So, the devicedata is either corrupt or there is a problem with the XML parser...
The DeviceData folder and files are ok. Used both binary and source dist ones and they are ok. No difference between them. Compiled a new programmer from source, but still the same problem. Checked the parseSecurity method and hardcoded the value to 16 to test things out. Worked, but now gives a similar error concerning check address or some shit...
Turns out the string value from xml to unsigned long conversion in causing this. Looked into the parser code and there are two strToULong methods separated by a preprocessor #if 0. Switched to the other one and it's way too broken to use...
What the method does is only the conversion:
This works as expected but the method is returning false because of errno.h. strtoul will turn errno into ERANGE if the value is out of range. In this case this does not happen, but someone is turning the errno != 0. There is a ERANGE check anyway after the conversion:
Usually you reset the errno to zero before your call and this is done here, but it is commented out for some reason? If I release the comment on:
It works. Everything is ok now. Devicedata is parsed ok, etc... Just wondering if anyone else if experiencing this? Why is this left in this kind of condition without people noticing? Weird... or is it just me?
Got my BDM this week and I'm trying it out today. Tested USBDMs HCS12_FlashProgrammer first on winxp (32bit) and seems to work ok. On ubuntu (12.10 32bit) there is a problem. After the install with this "no cw" script the program starts, but gives an error:
Code: Select all
* Error loading devices
Failed to load device database
Reason: DeviceXmlParser::parseSecurity() - illegal size in securityInfo = 16
Current device = Shared data
The DeviceData folder and files are ok. Used both binary and source dist ones and they are ok. No difference between them. Compiled a new programmer from source, but still the same problem. Checked the parseSecurity method and hardcoded the value to 16 to test things out. Worked, but now gives a similar error concerning check address or some shit...
Turns out the string value from xml to unsigned long conversion in causing this. Looked into the parser code and there are two strToULong methods separated by a preprocessor #if 0. Switched to the other one and it's way too broken to use...
What the method does is only the conversion:
Code: Select all
unsigned long value_t = strtoul(start, &end_t, 0);
Code: Select all
if ((ULONG_MAX == value_t) && ERANGE == errno) { // too large
printf("strToULong() - Number too large\n");
return false;
}
Code: Select all
// errno = 0;
It works. Everything is ok now. Devicedata is parsed ok, etc... Just wondering if anyone else if experiencing this? Why is this left in this kind of condition without people noticing? Weird... or is it just me?