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.

Warning about change to number of virtual registers?

Hello -

We have a running proprietary sample application that was developed from an installer sample application from 1.1.a. Our sample app ported to the 1.2.1 just fine. Then on 1.3 it crashed. We lost an engineering day tracking the problem down to the change in the 1.3 suite of sample apps which uses 16 instead of 8 virtual registers:

Project-->Options-->General Options-->Target-->Number of virtual registers

I must assume that this choice is built into the new 1.3 libraries and that is why it must be changed in our proprietary sample application as well in order to match some kind of linking consistency with the IAR tool.

So - how could I have saved this wasted day? I re-reviewed the README.txt from the 1.3 installer and searched this forum, but I saw no mention.

Also, the sample projects have changed a lot and it is not easy to follow with certainty (or even complete understanding) all of the diffs of any one sample app between the two installers. So - is there any other significant changes that need to be made to a sample app in order to be 100% compatible with the new 1.3 installer and libraries?

Thanks.

P.S. The symptom leading to the crash and constant resetting of the device was a memory corruption of the memory pointed to by a osal_msg_alloc() during a call into the library, some HCI_CommandCompleteEvent() according to the call stack trace.

  • Hi Codesmith,

    There should not be any obvious difficulties in porting applications from BLEv1.2.1 to BLEv1.3. Could you be more specific on the sample apps you are referring to? I know that profiles/services were re-structured (simplified) I while back in BLEv1.2 and that the keyfobdemo has been modified/improved with the BLEv1.3.

    Could you provide a simple step by step to reproduce the issue you are seeing? If so, it will be easier for us to locate the possible issue.

    Best Regards.

  • I had the same problem, we're using a custom build system with the IAR compiler.

    In v1.2.1 of the sample code the SimpleBLEPeripheral, I had a line in the map file (from the IAR linker) which was:

    -D_NR_OF_VIRTUAL_REGISTERS=8'

    After about a day of trying to figure out why my v1.3 code would re-set ever time it called into the BLE library, I compared the v1.2.1 project map file to the v1.3 project map file, and found I had to change to

    '-D_NR_OF_VIRTUAL_REGISTERS=10'

    In the IAR Embedded work bench, these settings are controlled by the setting listed by  the original author of this thread.

  • Thank you for replying with your experience, Thomas. I only fear that your application could suffer again in a different scenario (with a different call-stack depth, perhaps, in which IAR is using more virtual registers) and I suspect that the only sure fix is to set the _NR_OF_VIRTUAL_REGISTERS to be identical to what the libraries are compiled with. I strongly suspect that the libraries are compiled with -D_NR_OF_VIRTUAL_REGISTERS=16 because in the 1.3 installer, suddenly that is the setting of the sample apps.

    So my two questions to TI stand:

    1. How could I have saved the engineering day lost to discovering this new setting the hard way - where in the documentation did I miss this?

    2. Are there any other subtle gotchas to porting an existing app to the new 1.3 installer/libraries (probably, if there are, they are documented in the same place where I failed to find the change of the number of virtual registers, so this question will probably be answered by the answer to #1)?

  • Thanks codesmith -- I had just been looking at the .map file for setting this. After you comment, I went back and looked again. The _NR_OF_VIRTUAL_REGISTERS appears to be set in hex.

    It's used to configure VREG, which I confirmed is 16 bytes long.

    And I'd still like to second your questions, it would have been nice to have an idea of what needed to change.

  • Hi guys,

    I can confirm that the setting used to compile the library files is 16 virtual registers.

    Why this has changed and how this has slipped through release notes and documentation I cannot say at this time.

    It is my hope that we can make up for your lost time through supporting your further development on this forum.

    Best regards,
    Aslak 

  • Thanks, Aslak - since you did not address question #2, I will presume that there are no other gotchas and mark this as answered.