Hello.
I'm using Windows 7 64-bit, CCS Version: 6.1.2.00015, and AM335x Processor SDK v1.0.2.
The code that I am looking at comes from the StarterWare in pdk_am335x_1_0_2.
The file is <pdk_install_dir>\packages\ti\starterware\examples\dmtimer\countdown_timer\countdown_timer_app_main.c
The function is DmtimerAppGetSocInfo.
After the timer instance number is acquired, this function is called to populate the .instAddr and .intrLine fields of the pAppObj->dmtimerObj object, a pointer to access which (pAppObj) is passed to the function.
The bug is that after these two values are acquired, error checking APPEARS to be designed to check if either value is invalid. However, what it does instead is compare CHIPDB_INVALID_ADDRESS and CHIPDB_INVALID_INTERRUPT_NUM (the invalid values that can be returned by the functions called) to the .instNum field.
Specifically, this:
if (CHIPDB_INVALID_ADDRESS == pAppObj->dmtimerObj.instNum) { ... } else if (CHIPDB_INVALID_INTERRUPT_NUM == pAppObj->dmtimerObj.instNum) { ... } else { ... }
should instead be:
if (CHIPDB_INVALID_ADDRESS == pAppObj->dmtimerObj.instAddr) { ... } else if (CHIPDB_INVALID_INTERRUPT_NUM == pAppObj->dmtimerObj.intrLine) { ... } else { ... }
If you look closely at the CHIP-DB code that is called, this can be easily verified. This does not prevent the example from working when the CHIP-DB calls return valid values, but it DOES prevent invalid values from being detected, violating the (what appears to be) the design intention.
Kind regards,
Vic