I am using openOCD with production version of SAM3,  I have found that
openocd does not recognize the cidr because of the increase in version
number.  The easy fix is the following (also shown in the code below)...

Do an AND operation on cidr and 0xFFFFFFE0 to make comparison succeed when
device is the same, but version different.

In file /src/flash/nor/at91sam3.c

static int
sam3_GetDetails(struct sam3_bank_private *pPrivate)
{
 const struct sam3_chip_details *pDetails;
 struct sam3_chip *pChip;
 struct flash_bank *saved_banks[SAM3_MAX_FLASH_BANKS];
 unsigned x;
 LOG_DEBUG("Begin");
 pDetails = all_sam3_details;
 while (pDetails->name) {
  if (pDetails->chipid_cidr == (pPrivate->pChip->cfg.CHIPID_CIDR &
0xFFFFFFE0)) {
   break;
  } else {
   pDetails++;
  }
 }
 if (pDetails->name == NULL) {
  LOG_ERROR("SAM3 ChipID 0x%08x not found in table (perhaps you can this
chip?)",
      (unsigned int)(pPrivate->pChip->cfg.CHIPID_CIDR));
  // Help the victim, print details about the chip
  LOG_INFO("SAM3 CHIPID_CIDR: 0x%08x decodes as follows",
      pPrivate->pChip->cfg.CHIPID_CIDR);
  sam3_explain_chipid_cidr(pPrivate->pChip);
  return ERROR_FAIL;
 }
 // DANGER: THERE ARE DRAGONS HERE
 // get our pChip - it is going
 // to be over-written shortly
 pChip = pPrivate->pChip;
 // Note that, in reality:
 //
 //     pPrivate = &(pChip->details.bank[0])
 // or  pPrivate = &(pChip->details.bank[1])
 //
 // save the "bank" pointers
 for (x = 0 ; x < SAM3_MAX_FLASH_BANKS ; x++) {
  saved_banks[ x ] = pChip->details.bank[x].pBank;
 }
 // Overwrite the "details" structure.
 memcpy(&(pPrivate->pChip->details),
   pDetails,
   sizeof(pPrivate->pChip->details));
 // now fix the ghosted pointers
 for (x = 0 ; x < SAM3_MAX_FLASH_BANKS ; x++) {
  pChip->details.bank[x].pChip = pChip;
  pChip->details.bank[x].pBank = saved_banks[x];
 }
 // update the *BANK*SIZE*
 LOG_DEBUG("End");
 return ERROR_OK;
}
_______________________________________________
Openocd-development mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to