This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[Questions] OAD for CC2640 with internal Flash

Other Parts Discussed in Thread: CC2640

All,

I already set up CC2640 OAD with internal Flash, however, there is some questions that still need your further help. Would you please give a hand? Thanks.

Q1:  For OAD Manager, now we can’t only use CC254x EM+SerialBootTool to set up OAD, neither BLE device monitor nor IOS multitool and Sensortag can set up OAD. How about the case in your side? Any suggestion for using mobile APP to set up OAD demo?

 

Q2: If we already use OAD target to download Image B one time, if we want to upgrade Image B again, what should we do? How to trigger OAD target again? Thanks.

 

Q3: As below, even I remove GAP Bond Manager& SNV, stack code size is around 54004/1024 = 52.7KB, can’t set offset 0x00012000. For Page, at maximum, should have 14Page for Stack. Would you please kindly check whether it is right? Or something we’re missed.

 

 

Code Size

Address

Size

Default Stack

  58 927 bytes of readonly  code memory

   4 671 bytes of readonly  data memory

   1 265 bytes of readwrite data memory

0xF000~0x1DFFF

60KB, 15Page

Remove GAP Bond Manager

  55 220 bytes of readonly  code memory

   4 652 bytes of readonly  data memory

   1 061 bytes of readwrite data memory

0x10000~0x1DFFF

56KB, 14Page

Remove GAP Bond Manager& SNV

54 004 bytes of readonly  code memory

     552 bytes of readonly  data memory

   1 057 bytes of readwrite data memory

0x10000~0x1DFFF

56KB, 14Page

 

Looking forward to your reply. Thanks. 

  • Hi Lina,

    Lina Lian said:
    Q1:  For OAD Manager, now we can’t only use CC254x EM+SerialBootTool to set up OAD, neither BLE device monitor nor IOS multitool and Sensortag can set up OAD. How about the case in your side? Any suggestion for using mobile APP to set up OAD demo?

    With Sensortag, we have external flash OAD capability. You can use iOS App, Android App, or Device Monitor to download the image to the sensortag's external flash memory. Please see www.ti.com/.../gettingStarted.html. By the way, we are going to introduce enhanced enhanced OAD feature in the uncoming BLE Stack 2.1 release.

    Lina Lian said:
    Q2: If we already use OAD target to download Image B one time, if we want to upgrade Image B again, what should we do? How to trigger OAD target again?

    Once Image B is downloaded and verified, the BIM(boot image manager) jumps to the Image B, so there is no chance for Image A to run. The only way to get Image A run again in that situation is to invalidate Image B. If you write 0x0000 to the crc[0] area, the Image B gets invalidated and eventually the BIM will jump to Image A upon reset. Refer to the following code snippet. This feature will be available in BLE Stack 2.1 release.

      uint16_t crc[2] = { 0x0000, 0xFFFF };
          
      OADTarget_writeFlash(OAD_IMG_R_PAGE, OAD_IMG_R_OSET + OAD_IMG_CRC_OSET, (uint8_t *)crc, 2);
      OADTarget_systemReset();
    

    Lina Lian said:
    Q3: As below, even I remove GAP Bond Manager& SNV, stack code size is around 54004/1024 = 52.7KB, can’t set offset 0x00012000. For Page, at maximum, should have 14Page for Stack. Would you please kindly check whether it is right? Or something we’re missed.

    If you don't need GAP Bond Manager and SNV, please follow the instructions below to reduce the stack size:

    • Stack project
      • buildConfig.opt
        • Comment out –DGAP_BOND_MGR.
      • Linker option
        • In Config tab, set ICALL_STACK0_ADDR to 0x11000.
      • Compiler option
        • In Preprocessor tab, undefine OSAL_SNV=1 and define NO_OSAL_SNV.
    • Image A project
      • Compiler option
        • In Preprocessor tab, set ICALL_STACK0_ADDR and OAD_IMG_B_AREA to 0x11000 and 11 respectively.
      • Build Actions option
        • At the end of Post-build command line, modify the range to 11000:1EFFF.
    • Image B project
      • Compiler option
        • In Preprocessor tab, set ICALL_STACK0_ADDR and OAD_IMG_B_AREA to 0x11000 and 11 respectively.
      • Linker option
        • In Checksum tab, set End address to 0x10FFF.
      • Build Actions option
        • In Post-build command line, set the range to 6000:10FFF.

     Additionally, you can save 4 more kB by removing GATT Client feature from the stack. That option will be added to the BLE Stack 2.1 release.

    - Cetri

  • Cetri,

    Thanks a lot for your kindly reply and detailed guidance. :)  It seems that BLE Stack2.1 will enhance OAD feature a lot. When will BLE stack2.1 be released on TI website? 

    Cetri said:
    Additionally, you can save 4 more kB by removing GATT Client feature from the stack. That option will be added to the BLE Stack 2.1 release.

    What's more, before BLE stack2.1 is released on website, we want to use more Flash size for OAD Image B (>40KB), how to remove GATT Client feature? now we don't need GATT client feature, only use it as server. Thanks.

    BR,

    Lina

  • Hi Lina,

    To remove GATT client feature, please modify some functions in bleDispatch.c as follows and define GATT_NO_CLIENT in the compiler preprocessor option.

    static uint8 processICallATT(uint8 cmdID, ICall_CmdMsg *msg_ptr, uint8 *pSendCS)
    {
      uint16 connHandle = msg_ptr->attParamAndPtr.connHandle;
      attMsg_t *pMsg = msg_ptr->attParamAndPtr.pMsg;
      bStatus_t stat;
    
      switch(cmdID)
      {
    
        ...
          
    #if !defined(GATT_NO_CLIENT)
        case ATT_HANDLE_VALUE_CFM:
          stat = ATT_HandleValueCfm(connHandle);
          break;
    #endif // !GATT_NO_CLIENT
          
        default:
          /* 
           * For all other ATT commands, the corresponding GATT procedure should
           * be used instead.
           */
          stat = FAILURE;
          break;
      }
    
      return (stat);
    }
    
    
    static uint8 processICallGATT(uint8 cmdID, ICall_CmdMsg *msg_ptr,
                                  uint8 *pSendCS)
    {
    #if !defined(GATT_NO_CLIENT)
      attMsg_t *pReq = msg_ptr->gattReq.pReq;
      uint8 taskId = msg_ptr->gattReq.taskId;
    #endif // !GATT_NO_CLIENT
      uint16 connHandle = msg_ptr->gattReq.connHandle;
      bStatus_t stat;
    
      switch(cmdID)
      {
    #if !defined(GATT_NO_CLIENT)
        case ATT_EXCHANGE_MTU_REQ: // GATT Exchange MTU
          stat = GATT_ExchangeMTU(connHandle, &pReq->exchangeMTUReq, taskId);
          break;
    
        ...
    
        case GATT_WRITE_CHAR_DESC: // GATT Write Characteristic Descriptor
          stat = GATT_WriteCharDesc(connHandle, &pReq->writeReq, taskId);
          break;
    #endif // !GATT_NO_CLIENT
    
        ...
    
        default:
          stat = FAILURE;
          break;
      }
    
      return (stat);
    }
    
    
    static uint8 processDispGATTProfile(ICall_CmdMsg *msg_ptr, uint8 *pSendCS)
    {
      bStatus_t stat = SUCCESS;
      uint16 cmdID = msg_ptr->hciExtCmd.cmdId;
    
      switch(cmdID)
      {
    #if !defined(GATT_NO_CLIENT)
        case DISPATCH_GATT_INIT_CLIENT:
          // Initialize GATT Client
          stat = GATT_InitClient();
          break;
    
        case DISPATCH_GATT_REG_4_IND:
          // Register to receive incoming ATT Indications/Notifications
          GATT_RegisterForInd(msg_ptr->gattRegisterForInd.taskId);
          *pSendCS = FALSE;
          break;
    #endif // !GATT_NO_CLIENT
          
        ...
        
        default:
          stat = FAILURE;
          break;
      }
    
      return (stat);
    }
    

    For 2.1 release schedule, please contact the local representative internally. There is an alpha program as well.

    - Cetri

  • Cetri,

    Thank you very much for your kindly help. Got it. Have a nice day.

    BR,

    Lina